[mutter] events: Use the event target actor to determine window for event



commit 0280b0aaa563db65bf79a3643f6a9e8e76bfe458
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sat Mar 5 23:46:24 2022 +0100

    events: Use the event target actor to determine window for event
    
    We use get_window_for_event() to check whether an event happened on top
    of a window or on top of shell UI to decide whether to bypass delivering
    the event to Clutter. In case of crossing events though, we can't just
    use the device actor to determine whether to forward the event to
    Clutter or not: We do want to forward CLUTTER_LEAVE events which
    happened on top of shell UI. In that case the device actor is already a
    window actor (the pointer already is on top of a window), but the shell
    still needs to get the LEAVE crossing event.
    
    Since the event source actor got removed from the detail of
    ClutterEvent, the context we're looking for (which actor did the pointer
    leave) is now the target actor that the event gets emitted to. Since the
    last commit, we also made event filters aware of this context by passing
    the target actor to them, so use this context now to determine whether
    we're on top of a window or not.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2321>

 src/core/events.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/core/events.c b/src/core/events.c
index 7dfd974563..0dc3a73222 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -81,23 +81,20 @@ stage_has_grab (MetaDisplay *display)
 
 static MetaWindow *
 get_window_for_event (MetaDisplay        *display,
-                      const ClutterEvent *event)
+                      const ClutterEvent *event,
+                      ClutterActor       *event_actor)
 {
   switch (display->event_route)
     {
     case META_EVENT_ROUTE_NORMAL:
       {
-        ClutterActor *target;
         MetaWindowActor *window_actor;
 
         /* Always use the key focused window for key events. */
         if (IS_KEY_EVENT (event))
             return stage_has_key_focus () ? display->focus_window : NULL;
 
-        target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
-                                                 clutter_event_get_device (event),
-                                                 clutter_event_get_event_sequence (event));
-        window_actor = meta_window_actor_from_actor (target);
+        window_actor = meta_window_actor_from_actor (event_actor);
         if (window_actor)
           return meta_window_actor_get_meta_window (window_actor);
         else
@@ -339,7 +336,7 @@ meta_display_handle_event (MetaDisplay        *display,
     }
 #endif
 
-  window = get_window_for_event (display, event);
+  window = get_window_for_event (display, event, event_actor);
 
   display->current_time = event->any.time;
 


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