x11: Add a helper to get all toplevels

This will let us avoid frontend API for this task.
This commit is contained in:
Matthias Clasen 2017-11-05 18:33:56 -05:00
parent e980f68f5b
commit 76b6d86659
2 changed files with 23 additions and 0 deletions

View File

@ -3160,6 +3160,28 @@ gdk_x11_display_get_root_window (GdkDisplay *display)
return gdk_x11_screen_get_root_window (GDK_X11_DISPLAY (display)->screen); return gdk_x11_screen_get_root_window (GDK_X11_DISPLAY (display)->screen);
} }
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;
}
static void static void
gdk_x11_display_class_init (GdkX11DisplayClass * class) gdk_x11_display_class_init (GdkX11DisplayClass * class)
{ {

View File

@ -243,6 +243,7 @@ void _gdk_x11_display_create_window_impl (GdkDisplay *display,
GdkWindow *real_parent, GdkWindow *real_parent,
GdkEventMask event_mask, GdkEventMask event_mask,
GdkWindowAttr *attributes); GdkWindowAttr *attributes);
GList * gdk_x11_display_get_toplevel_windows (GdkDisplay *display);
void _gdk_x11_precache_atoms (GdkDisplay *display, void _gdk_x11_precache_atoms (GdkDisplay *display,
const gchar * const *atom_names, const gchar * const *atom_names,