mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 22:10:08 +00:00
gdk: Move window_get_device_position function out of the device hooks
This commit is contained in:
parent
c07f9c040f
commit
8d2104fdc9
@ -72,12 +72,6 @@ static void gdk_display_dispose (GObject *object);
|
|||||||
static void gdk_display_finalize (GObject *object);
|
static void gdk_display_finalize (GObject *object);
|
||||||
|
|
||||||
|
|
||||||
static GdkWindow *gdk_window_real_window_get_device_position (GdkDisplay *display,
|
|
||||||
GdkDevice *device,
|
|
||||||
GdkWindow *window,
|
|
||||||
gint *x,
|
|
||||||
gint *y,
|
|
||||||
GdkModifierType *mask);
|
|
||||||
static GdkWindow *gdk_display_real_get_window_at_device_position (GdkDisplay *display,
|
static GdkWindow *gdk_display_real_get_window_at_device_position (GdkDisplay *display,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *win_x,
|
gint *win_x,
|
||||||
@ -94,7 +88,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
|
|||||||
|
|
||||||
static const GdkDisplayDeviceHooks default_device_hooks = {
|
static const GdkDisplayDeviceHooks default_device_hooks = {
|
||||||
gdk_display_real_get_device_state,
|
gdk_display_real_get_device_state,
|
||||||
gdk_window_real_window_get_device_position,
|
|
||||||
gdk_display_real_get_window_at_device_position
|
gdk_display_real_get_window_at_device_position
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -694,38 +687,6 @@ gdk_display_real_get_window_at_device_position (GdkDisplay *display,
|
|||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkWindow *
|
|
||||||
gdk_window_real_window_get_device_position (GdkDisplay *display,
|
|
||||||
GdkDevice *device,
|
|
||||||
GdkWindow *window,
|
|
||||||
gint *x,
|
|
||||||
gint *y,
|
|
||||||
GdkModifierType *mask)
|
|
||||||
{
|
|
||||||
gint tmpx, tmpy;
|
|
||||||
GdkModifierType tmp_mask;
|
|
||||||
gboolean normal_child;
|
|
||||||
|
|
||||||
normal_child = GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_device_state (window,
|
|
||||||
device,
|
|
||||||
&tmpx, &tmpy,
|
|
||||||
&tmp_mask);
|
|
||||||
/* We got the coords on the impl, convert to the window */
|
|
||||||
tmpx -= window->abs_x;
|
|
||||||
tmpy -= window->abs_y;
|
|
||||||
|
|
||||||
if (x)
|
|
||||||
*x = tmpx;
|
|
||||||
if (y)
|
|
||||||
*y = tmpy;
|
|
||||||
if (mask)
|
|
||||||
*mask = tmp_mask;
|
|
||||||
|
|
||||||
if (normal_child)
|
|
||||||
return _gdk_window_find_child_at (window, tmpx, tmpy);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_display_get_window_at_pointer:
|
* gdk_display_get_window_at_pointer:
|
||||||
* @display: a #GdkDisplay
|
* @display: a #GdkDisplay
|
||||||
|
@ -41,12 +41,6 @@ struct _GdkDisplayDeviceHooks
|
|||||||
gint *x,
|
gint *x,
|
||||||
gint *y,
|
gint *y,
|
||||||
GdkModifierType *mask);
|
GdkModifierType *mask);
|
||||||
GdkWindow * (* window_get_device_position) (GdkDisplay *display,
|
|
||||||
GdkDevice *device,
|
|
||||||
GdkWindow *window,
|
|
||||||
gint *x,
|
|
||||||
gint *y,
|
|
||||||
GdkModifierType *mask);
|
|
||||||
GdkWindow * (* window_at_device_position) (GdkDisplay *display,
|
GdkWindow * (* window_at_device_position) (GdkDisplay *display,
|
||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
gint *win_x,
|
gint *win_x,
|
||||||
|
@ -4938,6 +4938,38 @@ gdk_window_get_pointer (GdkWindow *window,
|
|||||||
return gdk_window_get_device_position (window, display->core_pointer, x, y, mask);
|
return gdk_window_get_device_position (window, display->core_pointer, x, y, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GdkWindow *
|
||||||
|
gdk_window_real_window_get_device_position (GdkDisplay *display,
|
||||||
|
GdkDevice *device,
|
||||||
|
GdkWindow *window,
|
||||||
|
gint *x,
|
||||||
|
gint *y,
|
||||||
|
GdkModifierType *mask)
|
||||||
|
{
|
||||||
|
gint tmpx, tmpy;
|
||||||
|
GdkModifierType tmp_mask;
|
||||||
|
gboolean normal_child;
|
||||||
|
|
||||||
|
normal_child = GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_device_state (window,
|
||||||
|
device,
|
||||||
|
&tmpx, &tmpy,
|
||||||
|
&tmp_mask);
|
||||||
|
/* We got the coords on the impl, convert to the window */
|
||||||
|
tmpx -= window->abs_x;
|
||||||
|
tmpy -= window->abs_y;
|
||||||
|
|
||||||
|
if (x)
|
||||||
|
*x = tmpx;
|
||||||
|
if (y)
|
||||||
|
*y = tmpy;
|
||||||
|
if (mask)
|
||||||
|
*mask = tmp_mask;
|
||||||
|
|
||||||
|
if (normal_child)
|
||||||
|
return _gdk_window_find_child_at (window, tmpx, tmpy);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_window_get_device_position:
|
* gdk_window_get_device_position:
|
||||||
* @window: a #GdkWindow.
|
* @window: a #GdkWindow.
|
||||||
@ -4975,8 +5007,8 @@ gdk_window_get_device_position (GdkWindow *window,
|
|||||||
tmp_y = 0;
|
tmp_y = 0;
|
||||||
|
|
||||||
display = gdk_window_get_display (window);
|
display = gdk_window_get_display (window);
|
||||||
child = display->device_hooks->window_get_device_position (display, device, window,
|
child = gdk_window_real_window_get_device_position (display, device, window,
|
||||||
&tmp_x, &tmp_y, &tmp_mask);
|
&tmp_x, &tmp_y, &tmp_mask);
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
*x = tmp_x;
|
*x = tmp_x;
|
||||||
|
Loading…
Reference in New Issue
Block a user