[gnome-shell] [AppSwitcher] Put apps with only minimized windows at end of list



commit 7f468b36e7ac7414edfaa8ce8b1c698a251396c7
Author: Dan Winship <danw gnome org>
Date:   Sat Sep 26 10:56:41 2009 -0400

    [AppSwitcher] Put apps with only minimized windows at end of list
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596389

 js/ui/altTab.js |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 06d5509..c49d470 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -102,12 +102,7 @@ AltTabPopup.prototype = {
         let icons = [];
         for (let i = 0; i < apps.length; i++)
             icons.push(new AppIcon.AppIcon(apps[i], AppIcon.MenuType.BELOW));
-        icons.sort(function(i1, i2) {
-                       // The app's most-recently-used window is first
-                       // in its list
-                       return (i2.windows[0].get_user_time() -
-                               i1.windows[0].get_user_time());
-                   });
+        icons.sort(Lang.bind(this, this._sortAppIcon));
         for (let i = 0; i < icons.length; i++)
             this._addIcon(icons[i]);
 
@@ -125,6 +120,30 @@ AltTabPopup.prototype = {
         return true;
     },
 
+    _hasVisibleWindows : function(appIcon) {
+        for (let i = 0; i < appIcon.windows.length; i++) {
+            if (appIcon.windows[i].showing_on_its_workspace())
+                return true;
+        }
+        return false;
+    },
+
+    _sortAppIcon : function(appIcon1, appIcon2) {
+        let vis1 = this._hasVisibleWindows(appIcon1);
+        let vis2 = this._hasVisibleWindows(appIcon2);
+
+        if (vis1 && !vis2) {
+            return -1;
+        } else if (vis2 && !vis1) {
+            return 1;
+        } else {
+            // The app's most-recently-used window is first
+            // in its list
+            return (appIcon2.windows[0].get_user_time() -
+                    appIcon1.windows[0].get_user_time());
+        }
+    },
+
     _keyPressEvent : function(actor, event) {
         let keysym = event.get_key_symbol();
         let backwards = (event.get_state() & Clutter.ModifierType.SHIFT_MASK);



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