pub struct InputSimulator { /* private fields */ }Expand description
Platform-independent input simulator.
Construct with InputSimulator::new; on unsupported platforms it returns
crate::error::RdesktopError::UnsupportedPlatform. The simulator holds no
threads and is cheap to keep around — create one and reuse it.
Implementations§
Source§impl InputSimulator
impl InputSimulator
Sourcepub fn release_key(&self, key: Key) -> Result<()>
pub fn release_key(&self, key: Key) -> Result<()>
Release a held key.
Sourcepub fn tap_combo(&self, keys: &[Key]) -> Result<()>
pub fn tap_combo(&self, keys: &[Key]) -> Result<()>
Press every key in keys, then release them in reverse order. Use this
for chords such as Ctrl+C: pass [Key::Letter('c')] after holding Ctrl
via InputSimulator::press_key, or build the whole chord from raw
keys and let this method do press/release ordering.
Sourcepub fn type_text(&self, text: &str) -> Result<()>
pub fn type_text(&self, text: &str) -> Result<()>
Type arbitrary text as if entered on the keyboard. Uses Unicode input events, so it works for any character (including non-ASCII).
Sourcepub fn move_mouse(&self, x: i32, y: i32, absolute: bool) -> Result<()>
pub fn move_mouse(&self, x: i32, y: i32, absolute: bool) -> Result<()>
Move the mouse. When absolute is true, (x, y) are screen coordinates;
otherwise they are relative mickeys (pixels).
Sourcepub fn press_mouse(&self, button: MouseButton) -> Result<()>
pub fn press_mouse(&self, button: MouseButton) -> Result<()>
Hold a mouse button down.
Sourcepub fn release_mouse(&self, button: MouseButton) -> Result<()>
pub fn release_mouse(&self, button: MouseButton) -> Result<()>
Release a held mouse button.
Sourcepub fn click(&self, button: MouseButton) -> Result<()>
pub fn click(&self, button: MouseButton) -> Result<()>
Click (press + release) a mouse button at the current position.