Recover legacy keyboard mode when simulate

This commit is contained in:
Asura 2022-07-17 20:59:14 -07:00
parent 5dab7bd9a2
commit 3c61773d75
2 changed files with 13 additions and 6 deletions
libs/enigo/src
src/server

@ -438,9 +438,9 @@ impl KeyboardControllable for Enigo {
if self.xdo.is_null() { if self.xdo.is_null() {
return Ok(()); return Ok(());
} }
// if self.send_pynput(&key, true) { if self.send_pynput(&key, true) {
// return Ok(()); return Ok(());
// } }
let string = CString::new(&*keysequence(key))?; let string = CString::new(&*keysequence(key))?;
unsafe { unsafe {
xdo_send_keysequence_window_down( xdo_send_keysequence_window_down(
@ -456,9 +456,9 @@ impl KeyboardControllable for Enigo {
if self.xdo.is_null() { if self.xdo.is_null() {
return; return;
} }
// if self.send_pynput(&key, false) { if self.send_pynput(&key, false) {
// return; return;
// } }
if let Ok(string) = CString::new(&*keysequence(key)) { if let Ok(string) = CString::new(&*keysequence(key)) {
unsafe { unsafe {
xdo_send_keysequence_window_up( xdo_send_keysequence_window_up(

@ -420,7 +420,14 @@ impl Connection {
} }
MessageInput::Key((mut msg, press)) => { MessageInput::Key((mut msg, press)) => {
// todo: press and down have similar meanings. // todo: press and down have similar meanings.
if press && msg.mode == 3 {
msg.down = true;
}
handle_key(&msg); handle_key(&msg);
if press && msg.mode == 3 {
msg.down = false;
handle_key(&msg);
}
} }
MessageInput::BlockOn => { MessageInput::BlockOn => {
if crate::platform::block_input(true) { if crate::platform::block_input(true) {