From db250de3feda60cda16dc234d18e8af630ccf59e Mon Sep 17 00:00:00 2001 From: Ygor Souza Date: Mon, 30 Sep 2024 17:28:05 +0200 Subject: [PATCH] Ignore Ime::Enabled event on Linux It means different things on X11 and Wayland, and causes us to assume IME is active when it isn't, causing the backspace and arrow keys to be disabled. --- crates/egui-winit/src/lib.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 7110ef3fe216..638148500e8d 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -344,7 +344,13 @@ impl State { // between Commits. match ime { winit::event::Ime::Enabled => { - self.ime_event_enable(); + if cfg!(target_os = "linux") { + // This event means different things in X11 and Wayland, but we can just + // ignore it and enable IME on the preedit event. + // See + } else { + self.ime_event_enable(); + } } winit::event::Ime::Preedit(text, Some(_cursor)) => { self.ime_event_enable(); @@ -502,9 +508,9 @@ impl State { pub fn ime_event_enable(&mut self) { if !self.has_sent_ime_enabled { - self.egui_input - .events - .push(egui::Event::Ime(egui::ImeEvent::Enabled)); + // self.egui_input + // .events + // .push(egui::Event::Ime(egui::ImeEvent::Enabled)); self.has_sent_ime_enabled = true; } }