[mutter] screen: Make meta_screen_foreach_window scan Wayland windows



commit 9c62a907c5371e936f6a40efd282bd3353c9802f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Aug 15 20:02:21 2014 -0400

    screen: Make meta_screen_foreach_window scan Wayland windows
    
    Scanning over the hash table of XIDs is a terrible idea. Not only were
    we excluding Wayland windows, but we were also looking at alarms and
    barriers, too. We were lucky that that only contained GObjects where
    our checks would work.

 src/core/screen.c |   48 +++++++-----------------------------------------
 1 files changed, 7 insertions(+), 41 deletions(-)
---
diff --git a/src/core/screen.c b/src/core/screen.c
index a73c4f0..7f61acf 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -958,27 +958,6 @@ get_screen_name (MetaDisplay *display,
   return scr;
 }
 
-static gint
-ptrcmp (gconstpointer a, gconstpointer b)
-{
-  if (a < b)
-    return -1;
-  else if (a > b)
-    return 1;
-  else
-    return 0;
-}
-
-static void
-listify_func (gpointer key, gpointer value, gpointer data)
-{
-  GSList **listp;
-
-  listp = data;
-
-  *listp = g_slist_prepend (*listp, value);
-}
-
 /**
  * meta_screen_foreach_window:
  * @screen: a #MetaScreen
@@ -993,34 +972,21 @@ meta_screen_foreach_window (MetaScreen *screen,
                             MetaScreenWindowFunc func,
                             gpointer data)
 {
-  GSList *winlist, *l;
+  GSList *windows, *l;
 
   /* If we end up doing this often, just keeping a list
    * of windows might be sensible.
    */
 
-  winlist = NULL;
-  g_hash_table_foreach (screen->display->xids,
-                        listify_func,
-                        &winlist);
-
-  winlist = g_slist_sort (winlist, ptrcmp);
+  windows = meta_display_list_windows (screen->display, META_LIST_DEFAULT);
 
-  for (l = winlist; l != NULL; l = l->next)
+  for (l = windows; l != NULL; l = l->next)
     {
-      /* If the next node doesn't contain this window
-       * a second time, delete the window.
-       */
-      if (l->next == NULL ||
-          (l->next && l->next->data != l->data))
-        {
-          MetaWindow *window = l->data;
-
-          if (META_IS_WINDOW (window) && !window->override_redirect)
-            (* func) (screen, window, data);
-        }
+      MetaWindow *window = l->data;
+      func (screen, window, data);
     }
-  g_slist_free (winlist);
+
+  g_slist_free (windows);
 }
 
 int


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