clutter: Check the ClutterTextInputFocus has focus before filtering events

Checking correct state is responsibility of the ClutterInputFocus user, and
it is indeed possible to get a focused ClutterText while its
ClutterInputFocus didn't get itself focused (eg. lack of IM).

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

Closes: #36
This commit is contained in:
Carlos Garnacho 2018-02-18 15:19:41 +01:00
parent 69f56578a3
commit bcd5882081

View File

@ -2247,7 +2247,8 @@ clutter_text_key_press (ClutterActor *actor,
{ {
gunichar key_unichar; gunichar key_unichar;
if (clutter_input_focus_filter_key_event (priv->input_focus, event)) if (clutter_input_focus_is_focused (priv->input_focus) &&
clutter_input_focus_filter_key_event (priv->input_focus, event))
return CLUTTER_EVENT_STOP; return CLUTTER_EVENT_STOP;
/* Skip keys when control is pressed */ /* Skip keys when control is pressed */
@ -2293,7 +2294,8 @@ clutter_text_key_release (ClutterActor *actor,
ClutterText *self = CLUTTER_TEXT (actor); ClutterText *self = CLUTTER_TEXT (actor);
ClutterTextPrivate *priv = self->priv; ClutterTextPrivate *priv = self->priv;
if (clutter_input_focus_filter_key_event (priv->input_focus, event)) if (clutter_input_focus_is_focused (priv->input_focus) &&
clutter_input_focus_filter_key_event (priv->input_focus, event))
return CLUTTER_EVENT_STOP; return CLUTTER_EVENT_STOP;
return CLUTTER_EVENT_PROPAGATE; return CLUTTER_EVENT_PROPAGATE;