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

https://bugzilla.gnome.org/show_bug.cgi?id=596389
This commit is contained in:
Dan Winship 2009-09-26 10:56:41 -04:00
parent 349e5b39af
commit 7f468b36e7

View File

@ -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);