Commit 6c39cade authored by Benjamin Otte's avatar Benjamin Otte

gdk: Get rid of GdkDisplayDeviceHooks

Move the only user to call the function directly and copy the called
function over.
parent 6e18276f
......@@ -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;
......
......@@ -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
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment