wayland: Reset text-input state after commit

This was wrongly done just before enable, which is not right as
per the protocol. A side effect was that input purpose/hints were
eagerly reset before being applied, thus not properly honored,
noticed in the doing of emoji/numeric OSK panels.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/410
This commit is contained in:
Carlos Garnacho 2019-01-23 18:31:55 +01:00
parent 3f9b4a1ab5
commit 9e2ed4104d

View File

@ -462,6 +462,7 @@ meta_wayland_text_input_reset (MetaWaylandTextInput *text_input)
text_input->content_type_purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; text_input->content_type_purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL;
text_input->text_change_cause = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD; text_input->text_change_cause = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD;
text_input->cursor_rect = (cairo_rectangle_int_t) { 0, 0, 0, 0 }; text_input->cursor_rect = (cairo_rectangle_int_t) { 0, 0, 0, 0 };
text_input->pending_state = META_WAYLAND_PENDING_STATE_NONE;
} }
static void static void
@ -485,8 +486,6 @@ text_input_commit_state (struct wl_client *client,
if (text_input->enabled) if (text_input->enabled)
{ {
meta_wayland_text_input_reset (text_input);
if (!clutter_input_focus_is_focused (focus)) if (!clutter_input_focus_is_focused (focus))
{ {
if (input_method) if (input_method)
@ -507,7 +506,10 @@ text_input_commit_state (struct wl_client *client,
} }
if (!clutter_input_focus_is_focused (focus)) if (!clutter_input_focus_is_focused (focus))
{
meta_wayland_text_input_reset (text_input);
return; return;
}
if (text_input->pending_state & META_WAYLAND_PENDING_STATE_CONTENT_TYPE) if (text_input->pending_state & META_WAYLAND_PENDING_STATE_CONTENT_TYPE)
{ {
@ -544,7 +546,7 @@ text_input_commit_state (struct wl_client *client,
&cursor_rect); &cursor_rect);
} }
text_input->pending_state = META_WAYLAND_PENDING_STATE_NONE; meta_wayland_text_input_reset (text_input);
if (toggle_panel) if (toggle_panel)
clutter_input_focus_request_toggle_input_panel (focus); clutter_input_focus_request_toggle_input_panel (focus);