Merge pull request #3829 from chiehw/release

Release modifiers when exit
This commit is contained in:
RustDesk 2023-03-29 13:12:36 +08:00 committed by GitHub
commit a2cfeca7f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View File

@ -35,7 +35,8 @@ pub fn is_xfce() -> bool {
pub fn breakdown_callback() {
#[cfg(target_os = "linux")]
crate::input_service::clear_remapped_keycode()
crate::input_service::clear_remapped_keycode();
crate::input_service::release_modifiers();
}
// Android

View File

@ -618,6 +618,7 @@ impl Connection {
}
#[cfg(target_os = "linux")]
clear_remapped_keycode();
release_modifiers();
log::info!("Input thread exited");
}

View File

@ -551,6 +551,24 @@ fn record_key_to_key(record_key: u64) -> Option<Key> {
}
}
pub fn release_modifiers() {
let mut en = ENIGO.lock().unwrap();
for modifier in [
Key::Shift,
Key::Control,
Key::Alt,
Key::Meta,
Key::RightShift,
Key::RightControl,
Key::RightAlt,
Key::RWin,
] {
if get_modifier_state(modifier, &mut en) {
en.key_up(modifier);
}
}
}
#[inline]
fn release_record_key(record_key: KeysDown) {
let func = move || match record_key {