st/entry: Unset key focus when made unreactive
It seems reasonable that an entry shouldn't allow entering text when not reactive. The same could be achieved by changing the text's :editable property, however that will disable scrolling if the text doesn't fit, which may result in an unwanted size change. https://gitlab.gnome.org/GNOME/gnome-shell/issues/2423
This commit is contained in:
parent
34c4627db9
commit
6d3c740b37
@ -513,6 +513,26 @@ st_entry_allocate (ClutterActor *actor,
|
||||
clutter_actor_allocate (priv->entry, &child_box, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_reactive_changed_cb (ClutterActor *text,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
||||
if (clutter_actor_get_reactive (text))
|
||||
return;
|
||||
|
||||
if (!clutter_actor_has_key_focus (text))
|
||||
return;
|
||||
|
||||
stage = clutter_actor_get_stage (text);
|
||||
if (stage == NULL)
|
||||
return;
|
||||
|
||||
clutter_stage_set_key_focus (CLUTTER_STAGE (stage), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_focus_in_cb (ClutterText *text,
|
||||
ClutterActor *actor)
|
||||
@ -981,6 +1001,9 @@ st_entry_init (StEntry *entry)
|
||||
priv->entry, "reactive",
|
||||
G_BINDING_DEFAULT);
|
||||
|
||||
g_signal_connect(priv->entry, "notify::reactive",
|
||||
G_CALLBACK (clutter_text_reactive_changed_cb), entry);
|
||||
|
||||
g_signal_connect (priv->entry, "key-focus-in",
|
||||
G_CALLBACK (clutter_text_focus_in_cb), entry);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user