[gnome-shell/wip/carlosg/no-event-source: 20/21] st: Move StEntry away from clutter_event_get_source()




commit 22d7caf6c8e95f76c5e0ef896d07b091d1a3c9f9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Feb 25 16:11:54 2022 +0100

    st: Move StEntry away from clutter_event_get_source()
    
    Ask the stage about the device actor instead. Since leaving the
    StEntry also means leaving the contained ClutterText, the checks
    on LEAVE can be just removed.

 src/st/st-entry.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index 2211185b4f..1f337f96ad 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -789,7 +789,17 @@ st_entry_enter_event (ClutterActor         *actor,
                       ClutterCrossingEvent *event)
 {
   StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
-  if (event->source == priv->entry && event->related != NULL)
+  ClutterStage *stage;
+  ClutterInputDevice *device;
+  ClutterEventSequence *sequence;
+  ClutterActor *target;
+
+  stage = clutter_event_get_stage ((ClutterEvent *) event);
+  device = clutter_event_get_device ((ClutterEvent *) event);
+  sequence = clutter_event_get_event_sequence ((ClutterEvent *) event);
+  target = clutter_stage_get_device_actor (stage, device, sequence);
+
+  if (target == priv->entry && event->related != NULL)
     st_entry_set_cursor (ST_ENTRY (actor), TRUE);
 
   return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->enter_event (actor, event);
@@ -799,9 +809,7 @@ static gboolean
 st_entry_leave_event (ClutterActor         *actor,
                       ClutterCrossingEvent *event)
 {
-  StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
-  if (event->source == priv->entry && event->related != NULL)
-    st_entry_set_cursor (ST_ENTRY (actor), FALSE);
+  st_entry_set_cursor (ST_ENTRY (actor), FALSE);
 
   return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->leave_event (actor, event);
 }


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