[gtk+/client-side-windows: 279/284] Tweak the click-through handling so active apps get it (but not inactive ones)



commit 730a44a51694bb5933ae395ea3631d815a9f8a9c
Author: Richard Hult <richard imendio com>
Date:   Fri Feb 20 15:36:15 2009 +0100

    Tweak the click-through handling so active apps get it (but not inactive ones)
---
 gdk/quartz/gdkevents-quartz.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 5b93ad5..db73a11 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -1040,9 +1040,10 @@ gdk_event_translate (GdkEvent *event,
 	}
     }
 
-  /* If the app is not active, or the window (when not grabbed) is not
-   * active, leave the event to AppKit so the window gets focused correctly
-   * and don't do click-through (so we behave like most native apps).
+  /* If the app is not active leave the event to AppKit so the window gets
+   * focused correctly and don't do click-through (so we behave like most
+   * native apps). If the app is active, we focus the window and then handle
+   * the event, also to match native apps.
    */
   if ((event_type == NSRightMouseDown ||
        event_type == NSOtherMouseDown ||
@@ -1057,7 +1058,13 @@ gdk_event_translate (GdkEvent *event,
           return FALSE;
         }
       else if (![impl->toplevel isKeyWindow])
-        return FALSE;
+        {
+          GdkPointerGrabInfo *grab;
+
+          grab = _gdk_display_get_last_pointer_grab (_gdk_display);
+          if (!grab)
+            [impl->toplevel makeKeyWindow];
+        }
     }
 
   current_event_mask = get_event_mask_from_ns_event (nsevent);



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