[gtk+] Add gdk_display_get_toplevel_windows



commit 5cb5bdf1bce94eaf7fb71e9f73aeac1532d5fdc0
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 31 20:26:42 2017 -0400

    Add gdk_display_get_toplevel_windows
    
    This is replacing the corresponding GdkScreen api, which
    is going away. To implement this, we need to add a
    get_root_window vfunc to GdkDisplay.

 gdk/broadway/gdkdisplay-broadway.c |    9 +++++++++
 gdk/gdkdisplay.c                   |   22 ++++++++++++++++++++++
 gdk/gdkdisplayprivate.h            |    3 +++
 gdk/quartz/gdkdisplay-quartz.c     |    7 +++++++
 gdk/wayland/gdkdisplay-wayland.c   |    7 +++++++
 gdk/wayland/gdkprivate-wayland.h   |    1 +
 gdk/wayland/gdkscreen-wayland.c    |    2 +-
 gdk/win32/gdkdisplay-win32.c       |    7 +++++++
 gdk/win32/gdkprivate-win32.h       |    1 +
 gdk/win32/gdkscreen-win32.c        |    2 +-
 gdk/x11/gdkdisplay-x11.c           |    7 +++++++
 gdk/x11/gdkscreen-x11.c            |    2 +-
 gdk/x11/gdkscreen-x11.h            |    1 +
 13 files changed, 68 insertions(+), 3 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 194b0cf..7aff3a9 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -316,6 +316,14 @@ gdk_broadway_display_get_setting (GdkDisplay *display,
   return FALSE;
 }
 
+static GdkWindow *
+gdk_broadway_display_get_root_window (GdkDisplay *display)
+{
+  GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
+
+  return gdk_broadway_screen_get_root_window (broadway_display->default_screen);
+}
+
 static void
 gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
 {
@@ -365,5 +373,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
   display_class->get_monitor = gdk_broadway_display_get_monitor;
   display_class->get_primary_monitor = gdk_broadway_display_get_primary_monitor;
   display_class->get_setting = gdk_broadway_display_get_setting;
+  display_class->get_root_window = gdk_broadway_display_get_root_window;
 }
 
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 8ac1826..3af5dc5 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -2249,3 +2249,25 @@ gdk_display_setting_changed (GdkDisplay       *display,
 {
   g_signal_emit (display, signals[SETTING_CHANGED], 0, name);
 }
+
+GList *
+gdk_display_get_toplevel_windows (GdkDisplay *display)
+{
+  GdkWindow * root_window;
+  GList *new_list = NULL;
+  GList *tmp_list;
+
+  root_window = GDK_DISPLAY_GET_CLASS (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;
+}
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index c0b9aa5..463a619 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -224,6 +224,7 @@ struct _GdkDisplayClass
   gboolean               (*get_setting)                (GdkDisplay     *display,
                                                         const char     *name,
                                                         GValue         *value);
+  GdkWindow *            (*get_root_window)            (GdkDisplay     *display);
 
   /* Signals */
   void                   (*opened)                     (GdkDisplay     *display);
@@ -307,6 +308,8 @@ void                gdk_display_emit_opened           (GdkDisplay       *display
 void                gdk_display_setting_changed       (GdkDisplay       *display,
                                                        const char       *name);
 
+GList *             gdk_display_get_toplevel_windows  (GdkDisplay       *display);
+
 G_END_DECLS
 
 #endif  /* __GDK_DISPLAY_PRIVATE_H__ */
diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c
index 3376cbb..944212b 100644
--- a/gdk/quartz/gdkdisplay-quartz.c
+++ b/gdk/quartz/gdkdisplay-quartz.c
@@ -248,6 +248,12 @@ gdk_quartz_display_finalize (GObject *object)
   G_OBJECT_CLASS (gdk_quartz_display_parent_class)->finalize (object);
 }
 
+static GdkWindow *
+gdk_quartz_display_get_root_window (GdkDisplay *display)
+{
+  return _gdk_root;
+}
+`
 static void
 gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
 {
@@ -297,6 +303,7 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
   display_class->get_monitor = gdk_quartz_display_get_monitor;
   display_class->get_primary_monitor = gdk_quartz_display_get_primary_monitor;
   display_class->get_setting = gdk_quartz_display_get_setting;
+  display_class->get_root_window = gdk_quartz_display_get_root_window;
 
   ProcessSerialNumber psn = { 0, kCurrentProcess };
 
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 98cf1c2..5c6fcdc 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -989,6 +989,12 @@ gdk_wayland_display_get_setting (GdkDisplay  *display,
   return gdk_wayland_screen_get_setting (GDK_WAYLAND_DISPLAY (display)->screen, name, value);
 }
 
+static GdkWindow *
+gdk_wayland_display_get_root_window (GdkDisplay *display)
+{
+  return gdk_wayland_screen_get_root_window (GDK_WAYLAND_DISPLAY (display)->screen);
+}
+
 static void
 gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
 {
@@ -1048,6 +1054,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
   display_class->get_monitor = gdk_wayland_display_get_monitor;
   display_class->get_monitor_at_window = gdk_wayland_display_get_monitor_at_window;
   display_class->get_setting = gdk_wayland_display_get_setting;
+  display_class->get_root_window = gdk_wayland_display_get_root_window;
 }
 
 static void
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 6bf9925..1a45bad 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -213,6 +213,7 @@ GdkWindow *_gdk_wayland_screen_create_root_window (GdkScreen *screen,
 gboolean gdk_wayland_screen_get_setting (GdkScreen   *screen,
                                          const gchar *name,
                                          GValue      *value);
+GdkWindow *gdk_wayland_screen_get_root_window (GdkScreen *screen);
 
 GdkScreen *_gdk_wayland_screen_new (GdkDisplay *display);
 void _gdk_wayland_screen_add_output (GdkScreen        *screen,
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 3c46852..0778225 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -105,7 +105,7 @@ gdk_wayland_screen_get_display (GdkScreen *screen)
   return GDK_WAYLAND_SCREEN (screen)->display;
 }
 
-static GdkWindow *
+GdkWindow *
 gdk_wayland_screen_get_root_window (GdkScreen *screen)
 {
   return GDK_WAYLAND_SCREEN (screen)->root_window;
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index 71ffe71..ac19607 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -1238,6 +1238,12 @@ gdk_win32_display_get_setting (GdkDisplay  *display,
                                         value);
 }
 
+static GdkWindow *
+gdk_win32_display_get_root_window (GdkDisplay *display)
+{
+  return gdk_win32_screen_get_root_window (GDK_WIN32_DISPLAY (display)->screen);
+}
+
 static void
 gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
 {
@@ -1300,6 +1306,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
 #endif
 
   display_class->get_setting = gdk_win32_display_get_setting;
+  display_class->get_root_window = gdk_win32_display_get_root_window;
 
   _gdk_win32_windowing_init ();
 }
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index ef51184..ae44ba4 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -504,6 +504,7 @@ void _gdk_win32_window_delete_property (GdkWindow *window, GdkAtom    property);
 /* Stray GdkWin32Screen members */
 gboolean _gdk_win32_screen_get_setting (GdkScreen   *screen, const gchar *name, GValue *value);
 void _gdk_win32_screen_on_displaychange_event (GdkWin32Screen *screen);
+GdkWindow *gdk_win32_screen_get_root_window (GdkScreen *screen);
 
 /* Distributed display manager implementation */
 GdkDisplay *_gdk_win32_display_open (const gchar *display_name);
diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c
index addfe01..a174b9e 100644
--- a/gdk/win32/gdkscreen-win32.c
+++ b/gdk/win32/gdkscreen-win32.c
@@ -183,7 +183,7 @@ gdk_win32_screen_get_display (GdkScreen *screen)
   return _gdk_display;
 }
 
-static GdkWindow *
+GdkWindow *
 gdk_win32_screen_get_root_window (GdkScreen *screen)
 {
   return GDK_WIN32_SCREEN (screen)->root_window;
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 2c3cf7f..768d91d 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -3135,6 +3135,12 @@ gdk_x11_display_get_setting (GdkDisplay  *display,
   return gdk_x11_screen_get_setting (GDK_X11_DISPLAY (display)->screen, name, value);
 }
 
+static GdkWindow *
+gdk_x11_display_get_root_window (GdkDisplay *display)
+{
+  return gdk_x11_screen_get_root_window (GDK_X11_DISPLAY (display)->screen);
+}
+
 static void
 gdk_x11_display_class_init (GdkX11DisplayClass * class)
 {
@@ -3196,6 +3202,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
   display_class->get_monitor = gdk_x11_display_get_monitor;
   display_class->get_primary_monitor = gdk_x11_display_get_primary_monitor;
   display_class->get_setting = gdk_x11_display_get_setting;
+  display_class->get_root_window = gdk_x11_display_get_root_window;
 
   _gdk_x11_windowing_init ();
 }
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 7633e23..9ae1408 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -79,7 +79,7 @@ gdk_x11_screen_get_display (GdkScreen *screen)
   return GDK_X11_SCREEN (screen)->display;
 }
 
-static GdkWindow *
+GdkWindow *
 gdk_x11_screen_get_root_window (GdkScreen *screen)
 {
   return GDK_X11_SCREEN (screen)->root_window;
diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h
index 81c1781..e40670a 100644
--- a/gdk/x11/gdkscreen-x11.h
+++ b/gdk/x11/gdkscreen-x11.h
@@ -117,6 +117,7 @@ void gdk_x11_screen_get_work_area           (GdkScreen    *screen,
 gboolean gdk_x11_screen_get_setting         (GdkScreen    *screen,
                                              const char   *name,
                                              GValue       *value);
+GdkWindow *gdk_x11_screen_get_root_window   (GdkScreen *screen);
 
 G_END_DECLS
 


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