[AppSwitcher] Put apps with no window on current workspace at the end.

Following the idea expressed in bug 590563 by mccann ("Minimized or
hidden applications should appear at the end of the list"), we should
also put applications that have no visible window in the active
workspace at the end of the alt-tab window list, after apps which have
minimized windows in the active workspace.
This commit is contained in:
Steve Frécinaux 2009-09-29 19:29:17 +02:00
parent d2bc7b200e
commit 1c69380923

View File

@ -126,6 +126,14 @@ AltTabPopup.prototype = {
return true;
},
_hasWindowsOnWorkspace: function(appIcon, workspace) {
for (let i = 0; i < appIcon.windows.length; i++) {
if (appIcon.windows[i].get_workspace() == workspace)
return true;
}
return false;
},
_hasVisibleWindows : function(appIcon) {
for (let i = 0; i < appIcon.windows.length; i++) {
if (appIcon.windows[i].showing_on_its_workspace())
@ -135,6 +143,22 @@ AltTabPopup.prototype = {
},
_sortAppIcon : function(appIcon1, appIcon2) {
// We intend to sort the application list so applications appear
// with this order:
// 1. Apps with visible windows on the active workspace;
// 2. Apps with minimized windows on the active workspace;
// 3. Apps with visible windows on any other workspace;
// 4. Other apps.
let workspace = global.screen.get_active_workspace();
let ws1 = this._hasWindowsOnWorkspace(appIcon1, workspace);
let ws2 = this._hasWindowsOnWorkspace(appIcon2, workspace);
if (ws1 && !ws2)
return -1;
else if (ws2 && !ws1)
return 1;
let vis1 = this._hasVisibleWindows(appIcon1);
let vis2 = this._hasVisibleWindows(appIcon2);