x11: Store toplevel list in GdkDisplay

This will let us get rid of the root window.
This commit is contained in:
Matthias Clasen 2017-11-13 16:32:34 -05:00
parent 8af666cb4f
commit 5999b1c73a
8 changed files with 14 additions and 27 deletions

View File

@ -523,8 +523,6 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
}
}
g_list_free (toplevels);
xwindow = pointer_window;
}

View File

@ -606,7 +606,6 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
}
}
g_list_free (toplevels);
if (pointer_window != None)
break;
}

View File

@ -3160,23 +3160,7 @@ gdk_x11_display_get_root_window (GdkDisplay *display)
GList *
gdk_x11_display_get_toplevel_windows (GdkDisplay *display)
{
GdkWindow * root_window;
GList *new_list = NULL;
GList *tmp_list;
root_window = gdk_x11_display_get_root_window (display);
tmp_list = root_window->children;
while (tmp_list)
{
GdkWindow *w = tmp_list->data;
if (w->window_type != GDK_WINDOW_FOREIGN)
new_list = g_list_prepend (new_list, w);
tmp_list = tmp_list->next;
}
return new_list;
return GDK_X11_DISPLAY (display)->toplevels;
}
static void

View File

@ -40,6 +40,7 @@ struct _GdkX11Display
Display *xdisplay;
GdkScreen *screen;
GList *screens;
GList *toplevels;
GSource *event_source;

View File

@ -600,7 +600,6 @@ gdk_window_cache_new (GdkDisplay *display)
height * impl->window_scale,
gdk_window_is_visible (window));
}
g_list_free (toplevel_windows);
return result;
}

View File

@ -55,8 +55,6 @@ gdk_monitor_has_fullscreen_window (GdkMonitor *monitor)
}
}
g_list_free (toplevels);
return has_fullscreen;
}

View File

@ -840,8 +840,6 @@ _gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen,
_gdk_x11_window_set_window_scale (window, scale);
}
g_list_free (toplevels);
for (i = 0; i < x11_display->monitors->len; i++)
{
GdkMonitor *monitor = GDK_MONITOR (x11_display->monitors->pdata[i]);

View File

@ -61,6 +61,9 @@ _gdk_x11_display_add_window (GdkDisplay *display,
g_warning ("XID collision, trouble ahead");
g_hash_table_insert (display_x11->xid_ht, xid, data);
if (gdk_window_get_parent (GDK_WINDOW (data)) == NULL)
display_x11->toplevels = g_list_prepend (display_x11->toplevels, data);
}
void
@ -68,13 +71,20 @@ _gdk_x11_display_remove_window (GdkDisplay *display,
XID xid)
{
GdkX11Display *display_x11;
GdkWindow *window;
g_return_if_fail (GDK_IS_DISPLAY (display));
display_x11 = GDK_X11_DISPLAY (display);
if (display_x11->xid_ht)
g_hash_table_remove (display_x11->xid_ht, &xid);
if (!display_x11->xid_ht)
return;
window = g_hash_table_lookup (display_x11->xid_ht, &xid);
if (window && gdk_window_get_parent (window) == NULL)
display_x11->toplevels = g_list_remove (display_x11->toplevels, window);
g_hash_table_remove (display_x11->xid_ht, &xid);
}
/**