[mutter/wip/carlosg/no-event-source: 9/14] cally: Get key focus from stage instead of event




commit a92159bbf1426e57390f6d8b8bc0280e8d395e40
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Feb 25 15:46:09 2022 +0100

    cally: Get key focus from stage instead of event
    
    Avoid usage of clutter_event_get_source(), and use the stage key
    focus.

 clutter/clutter/cally/cally-util.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/clutter/clutter/cally/cally-util.c b/clutter/clutter/cally/cally-util.c
index e25a6eeae3..5332951006 100644
--- a/clutter/clutter/cally/cally-util.c
+++ b/clutter/clutter/cally/cally-util.c
@@ -282,8 +282,11 @@ insert_hf (gpointer key, gpointer value, gpointer data)
 static gunichar
 check_key_visibility (ClutterEvent *event)
 {
-  ClutterKeyEvent *key_event = (ClutterKeyEvent *)event;
-  AtkObject *accessible = clutter_actor_get_accessible (key_event->source);
+  AtkObject *accessible;
+  ClutterActor *focus;
+
+  focus = clutter_stage_get_key_focus (clutter_event_get_stage (event));
+  accessible = clutter_actor_get_accessible (focus);
 
   g_return_val_if_fail (accessible != NULL, 0);
 
@@ -299,8 +302,8 @@ check_key_visibility (ClutterEvent *event)
      still better fill this with a default unichar that the original
      one */
 
-  if (CLUTTER_IS_TEXT (key_event->source))
-    return clutter_text_get_password_char (CLUTTER_TEXT (key_event->source));
+  if (CLUTTER_IS_TEXT (focus))
+    return clutter_text_get_password_char (CLUTTER_TEXT (focus));
   else
     return DEFAULT_PASSWORD_CHAR;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]