[gnome-shell] shell-app: Raise windows in reverse order to preserve the stacking



commit b61ada72cc1394126f2fbfcb9b883ce3a8481034
Author: Rui Matos <tiagomatos gmail com>
Date:   Sat May 19 17:25:00 2012 +0200

    shell-app: Raise windows in reverse order to preserve the stacking
    
    ShellApp keeps track of windows sorted by most recently used first
    which means that when raising windows we need to start from the end of
    the list to finish with the correct stacking order.
    
    This patch just makes the code agree with the comment which was
    already there.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676371

 src/shell-app.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index e164841..31756a3 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -493,7 +493,7 @@ shell_app_activate_window (ShellApp     *app,
     return;
   else
     {
-      GSList *iter;
+      GSList *windows_reversed, *iter;
       ShellGlobal *global = shell_global_get ();
       MetaScreen *screen = shell_global_get_screen (global);
       MetaDisplay *display = meta_screen_get_display (screen);
@@ -511,13 +511,16 @@ shell_app_activate_window (ShellApp     *app,
       /* Now raise all the other windows for the app that are on
        * the same workspace, in reverse order to preserve the stacking.
        */
-      for (iter = windows; iter; iter = iter->next)
+      windows_reversed = g_slist_copy (windows);
+      windows_reversed = g_slist_reverse (windows_reversed);
+      for (iter = windows_reversed; iter; iter = iter->next)
         {
           MetaWindow *other_window = iter->data;
 
           if (other_window != window)
             meta_window_raise (other_window);
         }
+      g_slist_free (windows_reversed);
 
       /* If we have a transient that the user's interacted with more recently than
        * the window, pick that.



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