From 306133af7a0d478080e3d81c6c9e909a6eb36bbc Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 2 Jan 2022 17:20:29 -0700 Subject: [PATCH] window: implement dead key status events for x11/wayland refs: #688 --- window/src/os/x11/keyboard.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/window/src/os/x11/keyboard.rs b/window/src/os/x11/keyboard.rs index 664a2c593..9fc81a2ae 100644 --- a/window/src/os/x11/keyboard.rs +++ b/window/src/os/x11/keyboard.rs @@ -1,7 +1,7 @@ use crate::os::xkeysyms::keysym_to_keycode; use crate::{ - Handled, KeyCode, KeyEvent, Modifiers, RawKeyEvent, WindowEvent, WindowEventSender, - WindowKeyEvent, + DeadKeyStatus, Handled, KeyCode, KeyEvent, Modifiers, RawKeyEvent, WindowEvent, + WindowEventSender, WindowKeyEvent, }; use anyhow::{anyhow, ensure}; use libc; @@ -211,6 +211,7 @@ impl Keyboard { match cstate { ComposeStatus::Composing => { // eat + events.dispatch(WindowEvent::AdviseDeadKeyStatus(DeadKeyStatus::Holding)); return None; } ComposeStatus::Composed => { @@ -220,6 +221,7 @@ impl Keyboard { kc.replace(crate::KeyCode::composed(&utf8)); } compose_state.reset(); + events.dispatch(WindowEvent::AdviseDeadKeyStatus(DeadKeyStatus::None)); res.unwrap_or(xsym) } ComposeStatus::Nothing => { @@ -231,6 +233,7 @@ impl Keyboard { } ComposeStatus::Cancelled => { self.compose_state.borrow_mut().reset(); + events.dispatch(WindowEvent::AdviseDeadKeyStatus(DeadKeyStatus::None)); return None; } }