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