]> Pileus Git - ~andy/gtk/commitdiff
gdk: Get rid of GdkDisplayDeviceHooks
authorBenjamin Otte <otte@redhat.com>
Mon, 3 Jan 2011 16:31:54 +0000 (17:31 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 3 Jan 2011 16:44:24 +0000 (17:44 +0100)
Move the only user to call the function directly and copy the called
function over.

gdk/gdkdevice.c
gdk/gdkdisplay.c
gdk/gdkdisplayprivate.h

index e8fdeabdb064b32da07ea03f260beddad5e11410..bd529cbe89a30a5acba9f0193638062d8ea1bded 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "config.h"
 
+#include <math.h>
+
 #include "gdkdeviceprivate.h"
 #include "gdkdisplayprivate.h"
 #include "gdkinternals.h"
@@ -441,6 +443,36 @@ gdk_device_get_position (GdkDevice        *device,
     *y = tmp_y;
 }
 
+static GdkWindow *
+gdk_display_real_get_window_at_device_position (GdkDisplay *display,
+                                                GdkDevice  *device,
+                                                gint       *win_x,
+                                                gint       *win_y)
+{
+  GdkWindow *window;
+  gint x, y;
+
+  window = _gdk_device_window_at_position (device, &x, &y, NULL, FALSE);
+
+  /* This might need corrections, as the native window returned
+     may contain client side children */
+  if (window)
+    {
+      double xx, yy;
+
+      window = _gdk_window_find_descendant_at (window,
+                                              x, y,
+                                              &xx, &yy);
+      x = floor (xx + 0.5);
+      y = floor (yy + 0.5);
+    }
+
+  *win_x = x;
+  *win_y = y;
+
+  return window;
+}
+
 /**
  * gdk_device_get_window_at_position:
  * @device: pointer #GdkDevice to query info to.
@@ -470,7 +502,7 @@ gdk_device_get_window_at_position (GdkDevice  *device,
 
   display = gdk_device_get_display (device);
 
-  window = display->device_hooks->window_at_device_position (display, device, &tmp_x, &tmp_y);
+  window = gdk_display_real_get_window_at_device_position (display, device, &tmp_x, &tmp_y);
 
   if (win_x)
     *win_x = tmp_x;
index 5d7441bf29a30d945d256c067fdb2ae4140f05be..fa2e645467a9ced58749642d608af765273c93c3 100644 (file)
@@ -34,7 +34,6 @@
 #include "gdkscreen.h"
 
 #include <glib.h>
-#include <math.h>
 
 
 /**
@@ -72,18 +71,10 @@ static void gdk_display_dispose     (GObject         *object);
 static void gdk_display_finalize    (GObject         *object);
 
 
-static GdkWindow *gdk_display_real_get_window_at_device_position (GdkDisplay       *display,
-                                                                  GdkDevice        *device,
-                                                                  gint             *win_x,
-                                                                  gint             *win_y);
 static GdkAppLaunchContext *gdk_display_real_get_app_launch_context (GdkDisplay *display);
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-static const GdkDisplayDeviceHooks default_device_hooks = {
-  gdk_display_real_get_window_at_device_position
-};
-
 G_DEFINE_TYPE (GdkDisplay, gdk_display, G_TYPE_OBJECT)
 
 static void
@@ -191,8 +182,6 @@ gdk_display_init (GdkDisplay *display)
   display->double_click_time = 250;
   display->double_click_distance = 5;
 
-  display->device_hooks = &default_device_hooks;
-
   display->device_grabs = g_hash_table_new (NULL, NULL);
   display->motion_hint_info = g_hash_table_new_full (NULL, NULL, NULL,
                                                      (GDestroyNotify) g_free);
@@ -660,36 +649,6 @@ gdk_display_get_pointer (GdkDisplay      *display,
     *mask = tmp_mask;
 }
 
-static GdkWindow *
-gdk_display_real_get_window_at_device_position (GdkDisplay *display,
-                                                GdkDevice  *device,
-                                                gint       *win_x,
-                                                gint       *win_y)
-{
-  GdkWindow *window;
-  gint x, y;
-
-  window = _gdk_device_window_at_position (device, &x, &y, NULL, FALSE);
-
-  /* This might need corrections, as the native window returned
-     may contain client side children */
-  if (window)
-    {
-      double xx, yy;
-
-      window = _gdk_window_find_descendant_at (window,
-                                              x, y,
-                                              &xx, &yy);
-      x = floor (xx + 0.5);
-      y = floor (yy + 0.5);
-    }
-
-  *win_x = x;
-  *win_y = y;
-
-  return window;
-}
-
 /**
  * gdk_display_get_window_at_pointer:
  * @display: a #GdkDisplay
index ad89d6a9c9f3b725431a97fe42c2a7e82b4be178..fc82f4f0931059dd9c3ceb36e940811b88139277 100644 (file)
@@ -31,16 +31,6 @@ G_BEGIN_DECLS
 #define GDK_DISPLAY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass))
 
 
-typedef struct _GdkDisplayDeviceHooks GdkDisplayDeviceHooks;
-
-struct _GdkDisplayDeviceHooks
-{
-  GdkWindow * (* window_at_device_position)  (GdkDisplay *display,
-                                              GdkDevice  *device,
-                                              gint       *win_x,
-                                              gint       *win_y);
-};
-
 typedef struct _GdkDisplayClass GdkDisplayClass;
 
 /* Tracks information about the keyboard grab on this display */
@@ -110,8 +100,6 @@ struct _GdkDisplay
   guint double_click_time;  /* Maximum time between clicks in msecs */
   GdkDevice *core_pointer;  /* Core pointer device */
 
-  const GdkDisplayDeviceHooks *device_hooks; /* Hooks for querying pointer */
-
   guint closed             : 1;  /* Whether this display has been closed */
   guint ignore_core_events : 1;  /* Don't send core motion and button event */