Drop root windows from some internal apis

_gdk_device_query_state was needlessly shuffling
root windows around.
This commit is contained in:
Matthias Clasen 2017-08-08 15:43:03 -04:00
parent 8d3dd50948
commit c409fca703
11 changed files with 10 additions and 41 deletions

View File

@ -42,7 +42,6 @@ static void gdk_broadway_device_warp (GdkDevice *device,
gdouble y);
static void gdk_broadway_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -143,7 +142,6 @@ gdk_broadway_device_warp (GdkDevice *device,
static void
gdk_broadway_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -170,12 +168,6 @@ gdk_broadway_device_query_state (GdkDevice *device,
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
toplevel = impl->wrapper;
if (root_window)
{
screen = gdk_window_get_screen (window);
*root_window = gdk_screen_get_root_window (screen);
}
_gdk_broadway_server_query_mouse (broadway_display->server,
&mouse_toplevel_id,
&device_root_x,
@ -347,7 +339,7 @@ gdk_broadway_device_window_at_position (GdkDevice *device,
screen = gdk_display_get_default_screen (gdk_device_get_display (device));
root_window = gdk_screen_get_root_window (screen);
gdk_broadway_device_query_state (device, root_window, NULL, &window, NULL, NULL, win_x, win_y, mask);
gdk_broadway_device_query_state (device, root_window, &window, NULL, NULL, win_x, win_y, mask);
return window;
}

View File

@ -586,7 +586,6 @@ gdk_device_get_position_double (GdkDevice *device,
GdkDisplay *display;
gdouble tmp_x, tmp_y;
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);
@ -600,12 +599,12 @@ gdk_device_get_position_double (GdkDevice *device,
_gdk_device_query_state (device,
gdk_screen_get_root_window (default_screen),
&root, NULL,
NULL,
&tmp_x, &tmp_y,
NULL, NULL, NULL);
if (screen)
*screen = gdk_window_get_screen (root);
*screen = default_screen;
if (x)
*x = tmp_x;
if (y)
@ -1838,7 +1837,6 @@ _gdk_device_translate_axis (GdkDevice *device,
void
_gdk_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -1848,7 +1846,6 @@ _gdk_device_query_state (GdkDevice *device,
{
GDK_DEVICE_GET_CLASS (device)->query_state (device,
window,
root_window,
child_window,
root_x,
root_y,

View File

@ -94,7 +94,6 @@ struct _GdkDeviceClass
gdouble y);
void (* query_state) (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -172,7 +171,6 @@ void _gdk_device_remove_slave (GdkDevice *device,
GdkDevice *slave);
void _gdk_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,

View File

@ -1327,7 +1327,7 @@ gdk_mir_window_impl_get_device_state (GdkWindow *window,
{
GdkWindow *child;
_gdk_device_query_state (device, window, NULL, &child, NULL, NULL, x, y, mask);
_gdk_device_query_state (device, window, &child, NULL, NULL, x, y, mask);
return child != NULL;
}

View File

@ -583,7 +583,6 @@ device_get_modifiers (GdkDevice *device)
static void
gdk_wayland_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -591,16 +590,10 @@ gdk_wayland_device_query_state (GdkDevice *device,
gdouble *win_y,
GdkModifierType *mask)
{
GdkWaylandSeat *seat;
GdkWaylandPointerData *pointer;
GdkScreen *default_screen;
seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
pointer = GDK_WAYLAND_DEVICE (device)->pointer;
default_screen = gdk_display_get_default_screen (seat->display);
if (root_window)
*root_window = gdk_screen_get_root_window (default_screen);
if (child_window)
/* Set child only if actually a child of the given window, as XIQueryPointer() does */
*child_window = g_list_find (window->children, pointer->focus) ? pointer->focus : NULL;

View File

@ -2780,7 +2780,7 @@ gdk_window_wayland_get_device_state (GdkWindow *window,
GdkWindow *child;
GDK_DEVICE_GET_CLASS (device)->query_state (device, window,
NULL, &child,
&child,
NULL, NULL,
x, y, mask);
return_val = (child != NULL);

View File

@ -133,7 +133,6 @@ gdk_device_virtual_warp (GdkDevice *device,
static void
gdk_device_virtual_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -144,7 +143,7 @@ gdk_device_virtual_query_state (GdkDevice *device,
GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
_gdk_device_query_state (virtual->active_device,
window, root_window, child_window,
window, child_window,
root_x, root_y,
win_x, win_y,
mask);

View File

@ -2214,7 +2214,7 @@ gdk_window_win32_get_device_state (GdkWindow *window,
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), FALSE);
GDK_DEVICE_GET_CLASS (device)->query_state (device, window,
NULL, &child,
&child,
NULL, NULL,
x, y, mask);
return (child != NULL);

View File

@ -60,7 +60,6 @@ static void gdk_x11_device_core_warp (GdkDevice *device,
gdouble y);
static void gdk_x11_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -250,7 +249,6 @@ gdk_x11_device_core_warp (GdkDevice *device,
static void
gdk_x11_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -297,9 +295,6 @@ gdk_x11_device_core_query_state (GdkDevice *device,
XDestroyWindow (xdisplay, w);
}
if (root_window)
*root_window = gdk_x11_window_lookup_for_display (display, xroot_window);
if (child_window)
*child_window = gdk_x11_window_lookup_for_display (display, xchild_window);

View File

@ -85,7 +85,6 @@ static void gdk_x11_device_xi2_warp (GdkDevice *device,
gdouble y);
static void gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -271,7 +270,7 @@ gdk_x11_device_xi2_get_state (GdkDevice *device,
if (mask)
gdk_x11_device_xi2_query_state (device, window,
NULL, NULL,
NULL,
NULL, NULL,
NULL, NULL,
mask);
@ -321,7 +320,6 @@ gdk_x11_device_xi2_warp (GdkDevice *device,
static void
gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
@ -347,7 +345,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkDevice *master = gdk_device_get_associated_device (device);
if (master)
_gdk_device_query_state (master, window, root_window, child_window,
_gdk_device_query_state (master, window, child_window,
root_x, root_y, win_x, win_y, mask);
return;
}
@ -387,9 +385,6 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
XDestroyWindow (xdisplay, w);
}
if (root_window)
*root_window = gdk_x11_window_lookup_for_display (display, xroot_window);
if (child_window)
*child_window = gdk_x11_window_lookup_for_display (display, xchild_window);

View File

@ -2791,7 +2791,7 @@ gdk_window_x11_get_device_state (GdkWindow *window,
/*HIDPI: handle coords here?*/
GDK_DEVICE_GET_CLASS (device)->query_state (device, window,
NULL, &child,
&child,
NULL, NULL,
x, y, mask);
return child != NULL;