Ignore dead keys in Linux

This commit is contained in:
Asura
2022-08-02 06:07:44 -07:00
parent 1996a27c72
commit 5dfc41a7b8
2 changed files with 12 additions and 2 deletions

View File

@@ -1077,7 +1077,17 @@ impl Handler {
let string = match KEYBOARD.lock() {
Ok(mut keyboard) => {
let string = keyboard.add(&evt.event_type).unwrap_or_default();
if keyboard.last_is_dead && string == "" {
#[cfg(target_os = "windows")]
let is_dead = keyboard.last_is_dead;
#[cfg(target_os = "linux")]
let is_dead = unsafe {
CStr::from_ptr(XKeysymToString(*keyboard.keysym))
.to_str()
.unwrap_or_default()
.to_owned()
.starts_with("dead")
};
if is_dead && string == "" {
return;
}
string