[mutter] display: Add meta_display_list_all_windows()



commit 525cb7e10e95d41e4eebc503792afbcef17d7c30
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Dec 15 19:02:24 2021 +0100

    display: Add meta_display_list_all_windows()
    
    We now have a use case in gnome-shell for getting a list of all
    windows (including OR ones), but the existing API is private.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4751
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2163>

 src/core/display.c | 25 +++++++++++++++++++++++++
 src/meta/display.h |  3 +++
 2 files changed, 28 insertions(+)
---
diff --git a/src/core/display.c b/src/core/display.c
index c99edc8f08..60b8add77e 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -2389,6 +2389,31 @@ mru_cmp (gconstpointer a,
     return 0;
 }
 
+/**
+ * meta_display_list_all_windows:
+ * @display: a #MetaDisplay
+ *
+ * List all windows, including override-redirect ones. The windows are
+ * in no particular order.
+ *
+ * Returns: (transfer container) (element-type Meta.Window): List of windows
+ */
+GList *
+meta_display_list_all_windows (MetaDisplay *display)
+{
+  GList *all_windows = NULL;
+  g_autoptr (GSList) windows = NULL;
+  GSList *l;
+
+  windows = meta_display_list_windows (display,
+                                       META_LIST_INCLUDE_OVERRIDE_REDIRECT);
+
+  /* Yay for mixing GList and GSList in the API */
+  for (l = windows; l; l = l->next)
+    all_windows = g_list_prepend (all_windows, l->data);
+  return all_windows;
+}
+
 /**
  * meta_display_get_tab_list:
  * @display: a #MetaDisplay
diff --git a/src/meta/display.h b/src/meta/display.h
index 23bcbd0f5a..e59bd03939 100644
--- a/src/meta/display.h
+++ b/src/meta/display.h
@@ -110,6 +110,9 @@ guint32 meta_display_get_current_time (MetaDisplay *display);
 META_EXPORT
 guint32 meta_display_get_current_time_roundtrip (MetaDisplay *display);
 
+META_EXPORT
+GList * meta_display_list_all_windows (MetaDisplay *display);
+
 META_EXPORT
 GList* meta_display_get_tab_list (MetaDisplay   *display,
                                   MetaTabList    type,


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