[gtk+/client-side-windows: 243/284] Filter out all native grab/ungrab events with detail INFERIOR



commit fe3c410048a6b069efd63a2007d5a14606d0aa4a
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Feb 3 22:51:27 2009 +0100

    Filter out all native grab/ungrab events with detail INFERIOR
    
    These are generated when we get an implicit grab on a native
    child window, and we can't filter them with _has_grab() because
    they are sent before the button press event where we detect
    the implicit grab.
    
    This makes clicks work in the flash plugin again
---
 gdk/gdkwindow.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index dfa1214..aa96c07 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -8651,12 +8651,25 @@ _gdk_windowing_got_event (GdkDisplay *display,
        event->type == GDK_LEAVE_NOTIFY) &&
       (event->crossing.mode == GDK_CROSSING_GRAB ||
        event->crossing.mode == GDK_CROSSING_UNGRAB) &&
-      _gdk_display_has_pointer_grab (display, serial))
+      (_gdk_display_has_pointer_grab (display, serial) ||
+       event->crossing.detail == GDK_NOTIFY_INFERIOR))
     {
       /* We synthesize all crossing events due to grabs outselves,
-       * so we ignore the native ones when we already have a grab.
-       * Otherwise we would send multiple events when this app grabs
-       * We want to handle grabs from other clients though. */
+       * so we ignore the native ones caused by our native pointer_grab
+       * calls. Otherwise we would proxy these crossing event and cause
+       * multiple copies of crossing events for grabs.
+       * 
+       * We do want to handle grabs from other clients though, as for
+       * instance alt-tab in metacity causes grabs like these and
+       * we want to handle those. Thus the has_pointer_grab check.
+       * 
+       * Implicit grabs on child windows create some grabbing events
+       * that are sent before the button press. This means we can't
+       * detect these with the has_pointer_grab check (as the implicit
+       * grab is only noticed when we get button press event), so we
+       * detect these events by checking for INFERIOR enter or leave 
+       * events. These should never be a problem to filter out.
+       */
 
       /* We ended up in this window after some (perhaps other clients)
 	 grab, so update the toplevel_under_window state */



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