[mutter] display: Clean up meta_display_get_tab_list()



commit 3797ecaa65d34c4d461cf9013c9870c6ddb4e067
Author: Florian MÃllner <fmuellner gnome org>
Date:   Tue Dec 4 00:05:22 2012 +0100

    display: Clean up meta_display_get_tab_list()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688913

 src/core/display.c |   91 +++++++++++++++++++--------------------------------
 1 files changed, 34 insertions(+), 57 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index bd35748..a79c7e1 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -4762,76 +4762,53 @@ meta_display_get_tab_list (MetaDisplay   *display,
                            MetaScreen    *screen,
                            MetaWorkspace *workspace)
 {
-  GList *tab_list;
+  GList *tab_list = NULL;
+  GList *tmp;
+  GSList *windows = meta_display_list_windows (display, META_LIST_DEFAULT);
+  GSList *w;
 
   g_return_val_if_fail (workspace != NULL, NULL);
 
   /* Windows sellout mode - MRU order. Collect unminimized windows
    * then minimized so minimized windows aren't in the way so much.
    */
-  {
-    GList *tmp;
-    
-    tab_list = NULL;
-    tmp = workspace->mru_list;
-    while (tmp != NULL)
-      {
-        MetaWindow *window = tmp->data;
-        
-        if (!window->minimized &&
-            window->screen == screen &&
-            IN_TAB_CHAIN (window, type))
-          tab_list = g_list_prepend (tab_list, window);
-        
-        tmp = tmp->next;
-      }
-  }
-
-  {
-    GList *tmp;
-    
-    tmp = workspace->mru_list;
-    while (tmp != NULL)
-      {
-        MetaWindow *window = tmp->data;
-        
-        if (window->minimized &&
-            window->screen == screen &&
-            IN_TAB_CHAIN (window, type))
-          tab_list = g_list_prepend (tab_list, window);
-        
-        tmp = tmp->next;
-      }
-  }
+  for (tmp = workspace->mru_list; tmp; tmp = tmp->next)
+    {
+      MetaWindow *window = tmp->data;
 
-  tab_list = g_list_reverse (tab_list);
+      if (!window->minimized &&
+          window->screen == screen &&
+          IN_TAB_CHAIN (window, type))
+        tab_list = g_list_prepend (tab_list, window);
+    }
 
-  {
-    GSList *windows, *tmp;
-    MetaWindow *l_window;
+  for (tmp = workspace->mru_list; tmp; tmp = tmp->next)
+    {
+      MetaWindow *window = tmp->data;
 
-    windows = meta_display_list_windows (display, META_LIST_DEFAULT);
+      if (window->minimized &&
+          window->screen == screen &&
+          IN_TAB_CHAIN (window, type))
+        tab_list = g_list_prepend (tab_list, window);
+    }
 
-    /* Go through all windows */
-    tmp = windows;
-    while (tmp != NULL)
-      {
-        l_window=tmp->data;
+  tab_list = g_list_reverse (tab_list);
 
-        /* Check to see if it demands attention */
-        if (l_window->wm_state_demands_attention && 
-            l_window->workspace!=workspace &&
-            IN_TAB_CHAIN (l_window, type)) 
-          {
-            /* if it does, add it to the popup */
-            tab_list = g_list_prepend (tab_list, l_window);
-          }
+  for (w = windows; w; w = w->next)
+    {
+      MetaWindow *l_window = w->data;
 
-        tmp = tmp->next;
-      } /* End while tmp!=NULL */
+      /* Check to see if it demands attention */
+      if (l_window->wm_state_demands_attention &&
+          l_window->workspace != workspace &&
+          IN_TAB_CHAIN (l_window, type))
+        {
+          /* if it does, add it to the popup */
+          tab_list = g_list_prepend (tab_list, l_window);
+        }
+    }
 
-    g_slist_free (windows);
-  }
+  g_slist_free (windows);
   
   return tab_list;
 }



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