[gtk+] gdk: Get rid of GdkDisplayDeviceHooks



commit 6c39cade165d023630d7694e499021088a995634
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jan 3 17:31:54 2011 +0100

    gdk: Get rid of GdkDisplayDeviceHooks
    
    Move the only user to call the function directly and copy the called
    function over.

 gdk/gdkdevice.c         |   34 +++++++++++++++++++++++++++++++++-
 gdk/gdkdisplay.c        |   41 -----------------------------------------
 gdk/gdkdisplayprivate.h |   12 ------------
 3 files changed, 33 insertions(+), 54 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index e8fdeab..bd529cb 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -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;
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 5d7441b..fa2e645 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -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
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index ad89d6a..fc82f4f 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -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 */
 



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