diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c index e186417a2..539bc5928 100644 --- a/clutter/clutter/clutter-text.c +++ b/clutter/clutter/clutter-text.c @@ -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));