From 39ff8d15e2f119082bdd5cfebf1ac41d022f4479 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 22 Apr 2022 18:06:39 +0200 Subject: [PATCH] wayland: Reset ClutterInputFocus on focus changes Focus changes should trigger an IM reset, as some engines do want to maybe commit the preedit string before changing focus. In addition, we do not want the preedit string to be able to move between windows/applications. Ensure that the commit string is committed when the IM deems so, and ensure we send a .done event disntinct to the .leave event, so that the client doesn't miss the commit. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2030 Part-of: --- src/wayland/meta-wayland-text-input.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c index fc3d0619e..f1fdc70c9 100644 --- a/src/wayland/meta-wayland-text-input.c +++ b/src/wayland/meta-wayland-text-input.c @@ -343,6 +343,8 @@ meta_wayland_text_input_set_focus (MetaWaylandTextInput *text_input, if (clutter_input_focus_is_focused (focus)) { input_method = clutter_backend_get_input_method (clutter_get_default_backend ()); + clutter_input_focus_reset (focus); + meta_wayland_text_input_focus_flush_done (focus); clutter_input_method_focus_out (input_method); }