[gtk+/xi2] find_toplevel_for_keyboard_event should take an NSEvent as well



commit 33abfef32698f4847373efbc26b4052f4eae7815
Author: Kristian Rietveld <kris gtk org>
Date:   Thu Mar 11 11:25:07 2010 +0100

    find_toplevel_for_keyboard_event should take an NSEvent as well

 gdk/quartz/gdkevents-quartz.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index b41fd92..f98b8ea 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -534,13 +534,19 @@ find_toplevel_under_pointer (GdkDisplay *display,
 }
 
 static GdkWindow *
-find_toplevel_for_keyboard_event (GdkDisplay *display,
-                                  GdkWindow  *toplevel)
+find_toplevel_for_keyboard_event (NSEvent *nsevent)
 {
   GList *list, *l;
-  GdkWindow *window = toplevel;
+  GdkWindow *window;
+  GdkDisplay *display;
+  GdkQuartzView *view;
   GdkDeviceManager *device_manager;
 
+  view = (GdkQuartzView *)[[nsevent window] contentView];
+  window = [view gdkWindow];
+
+  display = gdk_drawable_get_display (GDK_DRAWABLE (window));
+
   device_manager = gdk_display_get_device_manager (display);
   list = gdk_device_manager_list_devices (device_manager,
                                           GDK_DEVICE_TYPE_MASTER);
@@ -772,7 +778,7 @@ find_window_for_ns_event (NSEvent *nsevent,
     case NSKeyDown:
     case NSKeyUp:
     case NSFlagsChanged:
-      return find_toplevel_for_keyboard_event (_gdk_display, toplevel);
+      return find_toplevel_for_keyboard_event (nsevent);
 
     default:
       /* Ignore everything else. */



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