Release modifiers when exit
This commit is contained in:
parent
5a96a6d03d
commit
bd7901af00
3 changed files with 21 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -618,6 +618,7 @@ impl Connection {
|
|||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
clear_remapped_keycode();
|
||||
release_modifiers();
|
||||
log::info!("Input thread exited");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue