[gtk+] x11: Add a helper to get all toplevels



commit 76b6d86659b16f2de9fb950d90073110b552a5c9
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Nov 5 18:33:56 2017 -0500

    x11: Add a helper to get all toplevels
    
    This will let us avoid frontend API for this task.

 gdk/x11/gdkdisplay-x11.c |   22 ++++++++++++++++++++++
 gdk/x11/gdkprivate-x11.h |    1 +
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index e4b9bb8..eb18348 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -3160,6 +3160,28 @@ gdk_x11_display_get_root_window (GdkDisplay *display)
   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
 gdk_x11_display_class_init (GdkX11DisplayClass * class)
 {
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index eb0e631..ade987d 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -243,6 +243,7 @@ void       _gdk_x11_display_create_window_impl     (GdkDisplay    *display,
                                                     GdkWindow     *real_parent,
                                                     GdkEventMask   event_mask,
                                                     GdkWindowAttr *attributes);
+GList *    gdk_x11_display_get_toplevel_windows    (GdkDisplay *display);
 
 void _gdk_x11_precache_atoms (GdkDisplay          *display,
                               const gchar * const *atom_names,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]