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

gdk: Move get_device_state out of the display hooks

Previous callers now use _gdk_device_query_state() directly.
parent 22676022
......@@ -416,19 +416,25 @@ gdk_device_get_position (GdkDevice *device,
gint *x,
gint *y)
{
GdkScreen *tmp_screen;
GdkDisplay *display;
gint tmp_x, tmp_y;
GdkModifierType tmp_mask;
GdkScreen *default_screen;
GdkWindow *root;
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
display = gdk_device_get_display (device);
display->device_hooks->get_device_state (display, device, &tmp_screen, &tmp_x, &tmp_y, &tmp_mask);
default_screen = gdk_display_get_default_screen (display);
_gdk_device_query_state (device,
gdk_screen_get_root_window (default_screen),
&root, NULL,
&tmp_x, &tmp_y,
NULL, NULL, NULL);
if (screen)
*screen = tmp_screen;
*screen = gdk_window_get_screen (root);
if (x)
*x = tmp_x;
if (y)
......
......@@ -76,18 +76,11 @@ static GdkWindow *gdk_display_real_get_window_at_device_position (GdkDisplay
GdkDevice *device,
gint *win_x,
gint *win_y);
static void gdk_display_real_get_device_state (GdkDisplay *display,
GdkDevice *device,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask);
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_device_state,
gdk_display_real_get_window_at_device_position
};
......@@ -635,20 +628,30 @@ gdk_display_get_pointer (GdkDisplay *display,
gint *y,
GdkModifierType *mask)
{
GdkScreen *tmp_screen;
GdkScreen *default_screen;
GdkWindow *root;
gint tmp_x, tmp_y;
GdkModifierType tmp_mask;
g_return_if_fail (GDK_IS_DISPLAY (display));
/* We call get_device_state here manually instead of gdk_device_get_position()
* because we also care about the modifier mask */
if (gdk_display_is_closed (display))
return;
default_screen = gdk_display_get_default_screen (display);
/* We call _gdk_device_query_state() here manually instead of
* gdk_device_get_position() because we care about the modifier mask */
_gdk_device_query_state (display->core_pointer,
gdk_screen_get_root_window (default_screen),
&root, NULL,
&tmp_x, &tmp_y,
NULL, NULL,
&tmp_mask);
display->device_hooks->get_device_state (display,
display->core_pointer,
&tmp_screen, &tmp_x, &tmp_y, &tmp_mask);
if (screen)
*screen = tmp_screen;
*screen = gdk_window_get_screen (root);
if (x)
*x = tmp_x;
if (y)
......@@ -716,32 +719,6 @@ gdk_display_get_window_at_pointer (GdkDisplay *display,
return gdk_device_get_window_at_position (display->core_pointer, win_x, win_y);
}
static void
gdk_display_real_get_device_state (GdkDisplay *display,
GdkDevice *device,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask)
{
GdkScreen *default_screen;
GdkWindow *root;
if (gdk_display_is_closed (display))
return;
default_screen = gdk_display_get_default_screen (display);
_gdk_device_query_state (device,
gdk_screen_get_root_window (default_screen),
&root, NULL,
x, y,
NULL, NULL,
mask);
*screen = gdk_window_get_screen (root);
}
static void
generate_grab_broken_event (GdkWindow *window,
GdkDevice *device,
......
......@@ -35,12 +35,6 @@ typedef struct _GdkDisplayDeviceHooks GdkDisplayDeviceHooks;
struct _GdkDisplayDeviceHooks
{
void (* get_device_state) (GdkDisplay *display,
GdkDevice *device,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow * (* window_at_device_position) (GdkDisplay *display,
GdkDevice *device,
gint *win_x,
......
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