clutter: Apply input hints/purpose on ClutterTextInputFocus focus in

And make the ClutterText-level properties independent from the input
focus, as those properties can be set anytime, not just when the
ClutterText actor is focused.

https://gitlab.gnome.org/GNOME/mutter/issues/66

Closes: #66
This commit is contained in:
Carlos Garnacho 2018-03-13 15:44:19 +01:00 committed by Jonas Ådahl
parent 31b5059068
commit 3684f6b0ac

View File

@ -2830,6 +2830,10 @@ clutter_text_key_focus_in (ClutterActor *actor)
if (method && priv->editable) if (method && priv->editable)
{ {
clutter_input_method_focus_in (method, priv->input_focus); clutter_input_method_focus_in (method, priv->input_focus);
clutter_input_focus_set_content_purpose (priv->input_focus,
priv->input_purpose);
clutter_input_focus_set_content_hints (priv->input_focus,
priv->input_hints);
update_cursor_location (CLUTTER_TEXT (actor)); update_cursor_location (CLUTTER_TEXT (actor));
} }
@ -6523,6 +6527,8 @@ clutter_text_set_input_hints (ClutterText *self,
g_return_if_fail (CLUTTER_IS_TEXT (self)); g_return_if_fail (CLUTTER_IS_TEXT (self));
self->priv->input_hints = hints; self->priv->input_hints = hints;
if (clutter_input_focus_is_focused (self->priv->input_focus))
clutter_input_focus_set_content_hints (self->priv->input_focus, hints); clutter_input_focus_set_content_hints (self->priv->input_focus, hints);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_HINTS]); g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_HINTS]);
} }
@ -6542,6 +6548,8 @@ clutter_text_set_input_purpose (ClutterText *self,
g_return_if_fail (CLUTTER_IS_TEXT (self)); g_return_if_fail (CLUTTER_IS_TEXT (self));
self->priv->input_purpose = purpose; self->priv->input_purpose = purpose;
if (clutter_input_focus_is_focused (self->priv->input_focus))
clutter_input_focus_set_content_purpose (self->priv->input_focus, purpose); clutter_input_focus_set_content_purpose (self->priv->input_focus, purpose);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_PURPOSE]); g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_PURPOSE]);
} }