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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2384>
This commit is contained in:
Carlos Garnacho 2022-04-22 18:06:39 +02:00
parent b4952c1199
commit 39ff8d15e2

View File

@ -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);
}