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>
This commit is contained in:
Florian Müllner 2021-12-15 19:02:24 +01:00 committed by Marge Bot
parent 3643e0ba1e
commit 525cb7e10e
2 changed files with 28 additions and 0 deletions

View File

@ -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

View File

@ -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,