wayland: Only enable OSK if receiving .enable when already active

Enable the OSK if receiving .enable consecutively (i.e. the
ClutterInputFocus was already focused). We specifically want to avoid
enabling the panel just because of focus changes within a surface (where
the .disable request across focus change would previously unfocus the
ClutterInputFocus). Prior state should be preserved if possible in that
situation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/432
This commit is contained in:
Carlos Garnacho 2019-02-08 22:51:28 +01:00 committed by Carlos Garnacho
parent 1f1f49dc79
commit eabb789381

View File

@ -471,7 +471,7 @@ text_input_commit_state (struct wl_client *client,
{
MetaWaylandTextInput *text_input = wl_resource_get_user_data (resource);
ClutterInputFocus *focus = text_input->input_focus;
gboolean toggle_panel = FALSE;
gboolean enable_panel = FALSE;
increment_serial (text_input, resource);
@ -493,9 +493,12 @@ text_input_commit_state (struct wl_client *client,
else
return;
}
else
{
enable_panel = TRUE;
}
clutter_input_focus_set_can_show_preedit (focus, TRUE);
toggle_panel = TRUE;
}
else if (clutter_input_focus_is_focused (focus))
{
@ -548,8 +551,8 @@ text_input_commit_state (struct wl_client *client,
meta_wayland_text_input_reset (text_input);
if (toggle_panel)
clutter_input_focus_set_input_panel_state (focus, CLUTTER_INPUT_PANEL_STATE_TOGGLE);
if (enable_panel)
clutter_input_focus_set_input_panel_state (focus, CLUTTER_INPUT_PANEL_STATE_ON);
}
static struct zwp_text_input_v3_interface meta_text_input_interface = {