From bcd58820811901ed913d5970d32e8b3d3a280a2b Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sun, 18 Feb 2018 15:19:41 +0100 Subject: [PATCH] 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 --- clutter/clutter/clutter-text.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c index 48904a47d..280df0340 100644 --- a/clutter/clutter/clutter-text.c +++ b/clutter/clutter/clutter-text.c @@ -2247,7 +2247,8 @@ clutter_text_key_press (ClutterActor *actor, { 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; /* Skip keys when control is pressed */ @@ -2293,7 +2294,8 @@ clutter_text_key_release (ClutterActor *actor, ClutterText *self = CLUTTER_TEXT (actor); 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_PROPAGATE;