mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter: Refactor ClutterText IM focus in into separate function
A just focused ClutterInputFocus must set itself up correctly on all situations. Refactor this into a function, so it can be used for the case where a ClutterText gets editable while focused.
This commit is contained in:
parent
e741adb82e
commit
fa8930817e
@ -2815,21 +2815,30 @@ clutter_text_has_overlaps (ClutterActor *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_key_focus_in (ClutterActor *actor)
|
||||
clutter_text_im_focus (ClutterText *text)
|
||||
{
|
||||
ClutterTextPrivate *priv = CLUTTER_TEXT (actor)->priv;
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
|
||||
|
||||
if (method && priv->editable)
|
||||
{
|
||||
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));
|
||||
}
|
||||
if (!method)
|
||||
return;
|
||||
|
||||
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 (text);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_key_focus_in (ClutterActor *actor)
|
||||
{
|
||||
ClutterTextPrivate *priv = CLUTTER_TEXT (actor)->priv;
|
||||
|
||||
if (priv->editable)
|
||||
clutter_text_im_focus (CLUTTER_TEXT (actor));
|
||||
|
||||
priv->has_focus = TRUE;
|
||||
|
||||
@ -4689,7 +4698,7 @@ clutter_text_set_editable (ClutterText *self,
|
||||
if (!priv->editable && clutter_input_focus_is_focused (priv->input_focus))
|
||||
clutter_input_method_focus_out (method);
|
||||
else if (priv->has_focus)
|
||||
clutter_input_method_focus_in (method, priv->input_focus);
|
||||
clutter_text_im_focus (self);
|
||||
}
|
||||
|
||||
clutter_text_queue_redraw (CLUTTER_ACTOR (self));
|
||||
|
Loading…
Reference in New Issue
Block a user