[gnome-shell/gnome-41] shell/app: Do not include OR windows in get_windows()



commit b520cb8e89ef255c864fc037cdc489194d767931
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Mar 20 19:15:58 2022 +0100

    shell/app: Do not include OR windows in get_windows()
    
    We started tracking all windows to make sure the assumption that any
    window can be match to an app holds. It is not expected however to
    ever represent OR windows in the UI, so it seems better to exclude
    them from get_windows() instead of expecting everyone to filter the
    return value themselves.
    
    (The returned list still includes "uninteresting" windows like attached
    dialogs, which can be important for cases like the correct MRU order in
    alt-tab)
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5233
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2252>
    (cherry picked from commit c02ca54943e8ee39356021bbb2c36b39c7f7e4e5)

 src/shell-app.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index 863f4db9d7..c87fec395e 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -417,7 +417,7 @@ shell_app_activate_window (ShellApp     *app,
                            MetaWindow   *window,
                            guint32       timestamp)
 {
-  GSList *windows;
+  g_autoptr (GSList) windows = NULL;
 
   if (shell_app_get_state (app) != SHELL_APP_STATE_RUNNING)
     return;
@@ -777,11 +777,14 @@ shell_app_compare_windows (gconstpointer   a,
  * active workspace, then by whether they're visible, and finally
  * by the time the user last interacted with them.
  *
- * Returns: (transfer none) (element-type MetaWindow): List of windows
+ * Returns: (transfer container) (element-type MetaWindow): List of windows
  */
 GSList *
 shell_app_get_windows (ShellApp *app)
 {
+  GSList *windows = NULL;
+  GSList *l;
+
   if (app->running_state == NULL)
     return NULL;
 
@@ -794,7 +797,11 @@ shell_app_get_windows (ShellApp *app)
       app->running_state->window_sort_stale = FALSE;
     }
 
-  return app->running_state->windows;
+  for (l = app->running_state->windows; l; l = l->next)
+    if (!meta_window_is_override_redirect (META_WINDOW (l->data)))
+      windows = g_slist_prepend (windows, l->data);
+
+  return g_slist_reverse (windows);
 }
 
 guint
@@ -1196,7 +1203,7 @@ GSList *
 shell_app_get_pids (ShellApp *app)
 {
   GSList *result;
-  GSList *iter;
+  g_autoptr (GSList) iter = NULL;
 
   result = NULL;
   for (iter = shell_app_get_windows (app); iter; iter = iter->next)


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