clutter/text: Be more pervasive at updating input method state

More concretely, ensure preedit text goes away after commit/focus_out,
and update cursor position right after focus_in.
This commit is contained in:
Carlos Garnacho 2018-02-11 21:56:30 +01:00
parent 49e8bc8a52
commit 37aab9280a

View File

@ -336,6 +336,7 @@ clutter_text_input_focus_commit_text (ClutterInputFocus *focus,
clutter_text_delete_selection (clutter_text);
clutter_text_insert_text (clutter_text, text,
clutter_text_get_cursor_position (clutter_text));
clutter_text_set_preedit_string (clutter_text, NULL, NULL, 0);
}
}
@ -2824,7 +2825,10 @@ clutter_text_key_focus_in (ClutterActor *actor)
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
if (method && priv->editable)
{
clutter_input_method_focus_in (method, priv->input_focus);
update_cursor_location (CLUTTER_TEXT (actor));
}
priv->has_focus = TRUE;
@ -2841,7 +2845,10 @@ clutter_text_key_focus_out (ClutterActor *actor)
priv->has_focus = FALSE;
if (priv->editable && clutter_input_focus_is_focused (priv->input_focus))
{
clutter_text_set_preedit_string (CLUTTER_TEXT (actor), NULL, NULL, 0);
clutter_input_method_focus_out (method);
}
clutter_text_queue_redraw (actor);
}