Merge pull request #3829 from chiehw/release
Release modifiers when exit
This commit is contained in:
commit
a2cfeca7f2
@ -35,7 +35,8 @@ pub fn is_xfce() -> bool {
|
|||||||
|
|
||||||
pub fn breakdown_callback() {
|
pub fn breakdown_callback() {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
crate::input_service::clear_remapped_keycode()
|
crate::input_service::clear_remapped_keycode();
|
||||||
|
crate::input_service::release_modifiers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Android
|
// Android
|
||||||
|
@ -618,6 +618,7 @@ impl Connection {
|
|||||||
}
|
}
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
clear_remapped_keycode();
|
clear_remapped_keycode();
|
||||||
|
release_modifiers();
|
||||||
log::info!("Input thread exited");
|
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]
|
#[inline]
|
||||||
fn release_record_key(record_key: KeysDown) {
|
fn release_record_key(record_key: KeysDown) {
|
||||||
let func = move || match record_key {
|
let func = move || match record_key {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user