diff --git a/libs/enigo/Cargo.toml b/libs/enigo/Cargo.toml index b1c57ca92..e97f000a6 100644 --- a/libs/enigo/Cargo.toml +++ b/libs/enigo/Cargo.toml @@ -21,7 +21,7 @@ appveyor = { repository = "pythoneer/enigo-85xiy" } [dependencies] serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } -log = "0.4.17" +log = "0.4" rdev = { git = "https://github.com/asur4s/rdev" } [features] diff --git a/libs/enigo/src/linux.rs b/libs/enigo/src/linux.rs index 6b4c99a1b..30c49c014 100644 --- a/libs/enigo/src/linux.rs +++ b/libs/enigo/src/linux.rs @@ -103,7 +103,6 @@ impl Enigo { self.tx.send((PyMsg::Char('\0'), true)).ok(); } - #[inline] fn send_pynput(&mut self, key: &Key, is_press: bool) -> bool { if unsafe { PYNPUT_EXIT || !PYNPUT_REDAY } { @@ -112,14 +111,8 @@ impl Enigo { if let Key::Layout(c) = key { return self.tx.send((PyMsg::Char(*c), is_press)).is_ok(); } - if let Key::Raw(chr) = key { - fn string_to_static_str(s: String) -> &'static str { - Box::leak(s.into_boxed_str()) - } - return self - .tx - .send((PyMsg::Str(string_to_static_str(chr.to_string())), is_press)) - .is_ok(); + if let Key::Raw(_) = key { + return false; } #[allow(deprecated)] let s = match key { diff --git a/src/server/input_service.rs b/src/server/input_service.rs index 81bfcd06f..aadb957a3 100644 --- a/src/server/input_service.rs +++ b/src/server/input_service.rs @@ -450,6 +450,7 @@ pub fn lock_screen() { key_event.down = true; key_event.set_chr('l' as _); key_event.modifiers.push(ControlKey::Meta.into()); + key_event.mode = 3; handle_key(&key_event); key_event.down = false; handle_key(&key_event); @@ -462,6 +463,7 @@ pub fn lock_screen() { key_event.set_chr('q' as _); key_event.modifiers.push(ControlKey::Meta.into()); key_event.modifiers.push(ControlKey::Control.into()); + key_event.mode = 3; handle_key(&key_event); key_event.down = false; handle_key(&key_event);