[gtk+/xi2: 922/1239] GdkDevice: Make window_at_position() also have a GdkModifierType out param.



commit 8272e20cb9d7ac552c2d45d39cd944d6abf49ca0
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Aug 28 18:13:12 2009 +0200

    GdkDevice: Make window_at_position() also have a GdkModifierType out param.
    
    All implementations have changed, this also fixes a crash when getting
    modifiers in _gdk_windowing_window_at_device_position() when window is NULL.

 gdk/gdkdeviceprivate.h   |    7 ++++---
 gdk/x11/gdkdevice-core.c |   17 +++++++++++------
 gdk/x11/gdkdevice-xi2.c  |   17 +++++++++++------
 gdk/x11/gdkwindow-x11.c  |    7 +------
 4 files changed, 27 insertions(+), 21 deletions(-)
---
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index 733442e..7511688 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -78,9 +78,10 @@ struct _GdkDeviceClass
   void          (*ungrab)    (GdkDevice        *device,
                               guint32           time_);
 
-  GdkWindow * (* window_at_position) (GdkDevice *device,
-                                      gint      *win_x,
-                                      gint      *win_y);
+  GdkWindow * (* window_at_position) (GdkDevice       *device,
+                                      gint            *win_x,
+                                      gint            *win_y,
+                                      GdkModifierType *mask);
 };
 
 void  _gdk_device_set_relative (GdkDevice *device,
diff --git a/gdk/x11/gdkdevice-core.c b/gdk/x11/gdkdevice-core.c
index dbee2e3..c5d2af0 100644
--- a/gdk/x11/gdkdevice-core.c
+++ b/gdk/x11/gdkdevice-core.c
@@ -51,9 +51,10 @@ static GdkGrabStatus gdk_device_core_grab   (GdkDevice     *device,
                                              guint32        time_);
 static void          gdk_device_core_ungrab (GdkDevice     *device,
                                              guint32        time_);
-static GdkWindow * gdk_device_core_window_at_position (GdkDevice *device,
-                                                       gint      *win_x,
-                                                       gint      *win_y);
+static GdkWindow * gdk_device_core_window_at_position (GdkDevice       *device,
+                                                       gint            *win_x,
+                                                       gint            *win_y,
+                                                       GdkModifierType *mask);
 
 
 G_DEFINE_TYPE (GdkDeviceCore, gdk_device_core, GDK_TYPE_DEVICE)
@@ -284,9 +285,10 @@ gdk_device_core_ungrab (GdkDevice *device,
 }
 
 static GdkWindow *
-gdk_device_core_window_at_position (GdkDevice *device,
-                                    gint      *win_x,
-                                    gint      *win_y)
+gdk_device_core_window_at_position (GdkDevice       *device,
+                                    gint            *win_x,
+                                    gint            *win_y,
+                                    GdkModifierType *mask)
 {
   GdkDisplay *display;
   GdkScreen *screen;
@@ -341,5 +343,8 @@ gdk_device_core_window_at_position (GdkDevice *device,
   if (win_y)
     *win_y = (window) ? xwin_y : -1;
 
+  if (mask)
+    *mask = xmask;
+
   return window;
 }
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 22ee9fe..b4891a0 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -72,9 +72,10 @@ static GdkGrabStatus gdk_device_xi2_grab   (GdkDevice     *device,
 static void          gdk_device_xi2_ungrab (GdkDevice     *device,
                                             guint32        time_);
 
-static GdkWindow * gdk_device_xi2_window_at_position (GdkDevice *device,
-                                                      gint      *win_x,
-                                                      gint      *win_y);
+static GdkWindow * gdk_device_xi2_window_at_position (GdkDevice       *device,
+                                                      gint            *win_x,
+                                                      gint            *win_y,
+                                                      GdkModifierType *mask);
 
 
 G_DEFINE_TYPE (GdkDeviceXI2, gdk_device_xi2, GDK_TYPE_DEVICE)
@@ -343,9 +344,10 @@ gdk_device_xi2_ungrab (GdkDevice *device,
 }
 
 static GdkWindow *
-gdk_device_xi2_window_at_position (GdkDevice *device,
-                                   gint      *win_x,
-                                   gint      *win_y)
+gdk_device_xi2_window_at_position (GdkDevice       *device,
+                                   gint            *win_x,
+                                   gint            *win_y,
+                                   GdkModifierType *mask)
 {
   GdkDisplay *display;
   GdkScreen *screen;
@@ -400,6 +402,9 @@ gdk_device_xi2_window_at_position (GdkDevice *device,
   if (win_y)
     *win_y = (window) ? xwin_y : -1;
 
+  if (mask)
+    *mask = xmask;
+
   return window;
 }
 
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index e4198de..5088444 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -3241,11 +3241,7 @@ _gdk_windowing_window_at_device_position (GdkDisplay      *display,
    */
   gdk_x11_display_grab (display);
   if (G_LIKELY (GDK_DISPLAY_X11 (display)->trusted_client))
-    {
-      window = GDK_DEVICE_GET_CLASS (device)->window_at_position (device, win_x, win_y);
-      GDK_DEVICE_GET_CLASS (device)->query_state (device, window, NULL, NULL,
-                                                  NULL, NULL, NULL, NULL, mask);
-    }
+    window = GDK_DEVICE_GET_CLASS (device)->window_at_position (device, win_x, win_y, mask);
   else
     {
       gint i, screens, width, height;
@@ -3329,7 +3325,6 @@ _gdk_windowing_window_at_device_position (GdkDisplay      *display,
 
   gdk_x11_display_ungrab (display);
 
-
   return window;
 }
 



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