win32: Stop using gdk_display_get_root_window

Use the newly introduced backend api for this purpose.
This commit is contained in:
Matthias Clasen 2017-11-05 21:00:04 -05:00
parent be75984485
commit c1c919cf7d
8 changed files with 26 additions and 36 deletions

View File

@ -111,7 +111,7 @@ gdk_device_win32_query_state (GdkDevice *device,
GdkWindowImplWin32 *impl;
if (window == NULL)
window = gdk_display_get_root_window (gdk_display_get_default ());
window = gdk_win32_display_get_root_window (gdk_display_get_default ());
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
hwnd = GDK_WINDOW_HWND (window);
@ -131,7 +131,7 @@ gdk_device_win32_query_state (GdkDevice *device,
if (win_y)
*win_y = point.y / impl->window_scale;
if (window == gdk_display_get_root_window (gdk_display_get_default ()))
if (window == gdk_win32_display_get_root_window (gdk_display_get_default ()))
{
if (win_x)
*win_x += _gdk_offset_x;
@ -247,7 +247,7 @@ _gdk_device_win32_window_at_position (GdkDevice *device,
/* If we didn't hit any window at that point, return the desktop */
if (hwnd == NULL)
{
window = gdk_display_get_root_window (gdk_display_get_default ());
window = gdk_win32_display_get_root_window (gdk_display_get_default ());
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (win_x)

View File

@ -123,7 +123,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
device_wintab = GDK_DEVICE_WINTAB (device);
if (window == NULL)
window = gdk_display_get_root_window (gdk_display_get_default ());
window = gdk_win32_display_get_root_window (gdk_display_get_default ());
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
hwnd = GDK_WINDOW_HWND (window);
@ -143,7 +143,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
if (win_y)
*win_y = point.y / impl->window_scale;
if (window == gdk_display_get_root_window (gdk_display_get_default ()))
if (window == gdk_win32_display_get_root_window (gdk_display_get_default ()))
{
if (win_x)
*win_x += _gdk_offset_x;
@ -223,7 +223,7 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
gint i;
device = GDK_DEVICE (device_wintab);
root_window = gdk_display_get_root_window (gdk_window_get_display (window));
root_window = gdk_win32_display_get_root_window (gdk_window_get_display (window));
impl_window = _gdk_window_get_impl_window (window);
temp_x = temp_y = 0;

View File

@ -353,7 +353,7 @@ static void
wintab_init_check (GdkDeviceManagerWin32 *device_manager)
{
GdkDisplay *display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager));
GdkWindow *root = gdk_display_get_root_window (display);
GdkWindow *root = gdk_win32_display_get_root_window (display);
static gboolean wintab_initialized = FALSE;
GdkDeviceWintab *device;
WORD specversion;
@ -961,7 +961,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
G_GNUC_END_IGNORE_DEPRECATIONS;
window = gdk_device_get_window_at_position (device_manager->core_pointer, &x, &y);
if (window == NULL)
window = gdk_display_get_root_window (gdk_display_get_default ());
window = gdk_win32_display_get_root_window (gdk_display_get_default ());
g_object_ref (window);
@ -1004,7 +1004,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
window = g_object_ref (last_grab->window);
}
if (window == gdk_display_get_root_window (gdk_display_get_default ()))
if (window == gdk_win32_display_get_root_window (gdk_display_get_default ()))
{
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... is root\n"));
return FALSE;
@ -1081,8 +1081,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
{
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... not selected\n"));
if (window->parent == gdk_display_get_root_window (gdk_display_get_default ()) ||
window->parent == NULL)
if (window->parent == NULL)
return FALSE;
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);

View File

@ -619,7 +619,7 @@ inner_clipboard_window_procedure (HWND hwnd,
GDK_NOTE (DND, g_print (" \n"));
event = gdk_event_new (GDK_OWNER_CHANGE);
event->owner_change.window = gdk_display_get_root_window (gdk_display_get_default ());
event->owner_change.window = gdk_win32_display_get_root_window (gdk_display_get_default ());
event->owner_change.reason = GDK_OWNER_CHANGE_NEW_OWNER;
event->owner_change.selection = GDK_SELECTION_CLIPBOARD;
event->owner_change.time = _gdk_win32_get_next_tick (0);

View File

@ -732,7 +732,7 @@ idropsource_givefeedback (LPDROPSOURCE This,
else
{
if (ctx->context->dest_window == NULL)
ctx->context->dest_window = g_object_ref (gdk_display_get_root_window (gdk_display_get_default ()));
ctx->context->dest_window = g_object_ref (gdk_win32_display_get_root_window (gdk_display_get_default ()));
}
return DRAGDROP_S_USEDEFAULTCURSORS;
@ -1431,7 +1431,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
context->is_source = FALSE;
context->source_window = gdk_display_get_root_window (gdk_display_get_default ());
context->source_window = gdk_win32_display_get_root_window (gdk_display_get_default ());
g_object_ref (context->source_window);
context->dest_window = event->any.window;

View File

@ -1355,8 +1355,7 @@ propagate (GdkWindow **window,
{
/* Owner doesn't want it, propagate to parent. */
GdkWindow *parent = gdk_window_get_parent (*window);
if (parent == gdk_display_get_root_window (gdk_display_get_default ()) ||
parent == NULL)
if (parent == NULL)
{
/* No parent; check if grabbed */
if (grab_window != NULL)
@ -1434,7 +1433,7 @@ _gdk_win32_get_window_rect (GdkWindow *window,
point.y = client_rect.top;
/* top level windows need screen coords */
if (gdk_window_get_parent (window) == gdk_display_get_root_window (gdk_display_get_default ()))
if (gdk_window_get_parent (window) == NULL)
{
ClientToScreen (hwnd, &point);
point.x += _gdk_offset_x * window_impl->window_scale;
@ -2162,7 +2161,7 @@ gdk_event_translate (MSG *msg,
{
/* Apply global filters */
GdkFilterReturn result = apply_event_filters (window ? window : gdk_display_get_root_window (display),
GdkFilterReturn result = apply_event_filters (window ? window : gdk_win32_display_get_root_window (display),
msg,
&_gdk_default_filters);

View File

@ -295,7 +295,7 @@ _gdk_win32_window_delete_property (GdkWindow *window,
if (property == _gdk_selection)
_gdk_selection_property_delete (window);
else if (property == _wm_transient_for)
gdk_window_set_transient_for (window, gdk_display_get_root_window (gdk_window_get_display (window)));
gdk_window_set_transient_for (window, gdk_win32_display_get_root_window (gdk_window_get_display (window)));
else
{
prop_name = gdk_atom_name (property);

View File

@ -465,7 +465,7 @@ _gdk_win32_window_enable_transparency (GdkWindow *window)
if (!gdk_display_is_composited (gdk_window_get_display (window)))
return FALSE;
if (window == gdk_display_get_root_window (gdk_window_get_display (window)))
if (window == gdk_win32_display_get_root_window (gdk_window_get_display (window)))
return FALSE;
thiswindow = GDK_WINDOW_HWND (window);
@ -719,7 +719,7 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
switch (window->window_type)
{
case GDK_WINDOW_TOPLEVEL:
if (GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT)
if (window->parent && GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT)
{
/* The common code warns for this case. */
hparent = GetDesktopWindow ();
@ -744,7 +744,7 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
case GDK_WINDOW_TEMP:
/* A temp window is not necessarily a top level window */
dwStyle = (gdk_display_get_root_window (display) == real_parent ? WS_POPUP : WS_CHILDWINDOW);
dwStyle = (real_parent == NULL || gdk_win32_display_get_root_window (display) == real_parent) ? WS_POPUP : WS_CHILDWINDOW);
dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
dwExStyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
offset_x = _gdk_offset_x;
@ -893,9 +893,7 @@ gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
parent = GetParent (anid);
/* Always treat foreigns as toplevels */
window->parent = gdk_display_get_root_window (gdk_display_get_default ());
window->parent->children = g_list_concat (&window->children_list_node, window->parent->children);
window->parent = NULL;
GetClientRect ((HWND) anid, &rect);
point.x = rect.left;
@ -2000,14 +1998,6 @@ gdk_win32_window_get_geometry (GdkWindow *window,
display = gdk_window_get_display (window);
if (!window)
{
window = gdk_display_get_root_window (display);
window_is_root = TRUE;
}
else
window_is_root = (gdk_display_get_root_window (display) == window);
if (!GDK_WINDOW_DESTROYED (window))
{
RECT rect;
@ -2023,6 +2013,7 @@ gdk_win32_window_get_geometry (GdkWindow *window,
pt.x = rect.left;
pt.y = rect.top;
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
if (parent)
ScreenToClient (GDK_WINDOW_HWND (parent), &pt);
rect.left = pt.x;
rect.top = pt.y;
@ -2030,11 +2021,12 @@ gdk_win32_window_get_geometry (GdkWindow *window,
pt.x = rect.right;
pt.y = rect.bottom;
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
if (parent)
ScreenToClient (GDK_WINDOW_HWND (parent), &pt);
rect.right = pt.x;
rect.bottom = pt.y;
if (gdk_display_get_root_window (display) == parent)
if (parent == NULL)
{
rect.left += _gdk_offset_x * impl->window_scale;
rect.top += _gdk_offset_y * impl->window_scale;