When in window filtering mode, reset filter before showing window

When we had a filtered set of windows, and want to exit the overview
into a particular window, what we do is re-show all the old windows
first, but don't reset the scaling on them.  This will involve
some overlapping, but that's not a big deal because we'll immediately
get overlap anyways in the normal case zooming the windows back.

https://bugzilla.gnome.org/show_bug.cgi?id=594699
This commit is contained in:
Colin Walters 2009-09-11 12:39:59 -04:00
parent 33f9895d71
commit 9feda69888
3 changed files with 77 additions and 26 deletions

View File

@ -663,6 +663,7 @@ WellMenu.prototype = {
_onMenuButtonRelease: function (actor, event) { _onMenuButtonRelease: function (actor, event) {
let clone = this._findWindowCloneForActor(event.get_source()); let clone = this._findWindowCloneForActor(event.get_source());
if (clone) { if (clone) {
this.didActivateWindow = true;
Main.overview.activateWindow(clone.metaWindow, event.get_time()); Main.overview.activateWindow(clone.metaWindow, event.get_time());
} }
}, },
@ -707,6 +708,7 @@ WellMenu.prototype = {
_onWindowActivate: function (actor, child) { _onWindowActivate: function (actor, child) {
let metaWindow = child._window; let metaWindow = child._window;
this.didActivateWindow = true;
Main.overview.activateWindow(metaWindow, Clutter.get_current_event_time()); Main.overview.activateWindow(metaWindow, Clutter.get_current_event_time());
this.emit('popup', false); this.emit('popup', false);
this.actor.hide(); this.actor.hide();
@ -854,6 +856,10 @@ RunningWellItem.prototype = {
this._menu.connect('popup', Lang.bind(this, function (menu, isPoppedUp) { this._menu.connect('popup', Lang.bind(this, function (menu, isPoppedUp) {
let id; let id;
// If we successfully picked a window, don't reset the workspace
// state, since picking a window already did that.
if (!isPoppedUp && menu.didActivateWindow)
return;
if (isPoppedUp) if (isPoppedUp)
id = this.appInfo.get_id(); id = this.appInfo.get_id();
else else

View File

@ -342,7 +342,7 @@ Overview.prototype = {
this.emit('showing'); this.emit('showing');
}, },
hide : function() { hide: function() {
if (!this.visible || this._hideInProgress) if (!this.visible || this._hideInProgress)
return; return;
@ -410,7 +410,6 @@ Overview.prototype = {
*/ */
activateWindow: function (metaWindow, time) { activateWindow: function (metaWindow, time) {
this._workspaces.activateWindowFromOverview(metaWindow, time); this._workspaces.activateWindowFromOverview(metaWindow, time);
this.hide();
}, },
//// Private methods //// //// Private methods ////

View File

@ -560,9 +560,11 @@ Workspace.prototype = {
return this._lookupIndex(metaWindow) >= 0; return this._lookupIndex(metaWindow) >= 0;
}, },
setShowOnlyWindows: function(showOnlyWindows) { setShowOnlyWindows: function(showOnlyWindows, reposition) {
this._showOnlyWindows = showOnlyWindows; this._showOnlyWindows = showOnlyWindows;
this.positionWindows(false); this._resetCloneVisibility();
if (reposition)
this.positionWindows(false);
}, },
/** /**
@ -643,9 +645,24 @@ Workspace.prototype = {
this._desktop.actor.height + 2 * FRAME_SIZE / this.actor.scale_y); this._desktop.actor.height + 2 * FRAME_SIZE / this.actor.scale_y);
}, },
// Reposition all windows in their zoomed-to-Overview position. if workspaceZooming _resetCloneVisibility: function () {
// is true, then the workspace is moving at the same time and we need to take for (let i = 1; i < this._windows.length; i++) {
// that into account let clone = this._windows[i];
let icon = this._windowIcons[i];
if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows)) {
clone.setVisibleWithChrome(false);
icon.hide();
} else {
clone.setVisibleWithChrome(true);
}
}
},
/**
* positionWindows:
* @workspaceZooming: If true, then the workspace is moving at the same time and we need to take that into account.
*/
positionWindows : function(workspaceZooming) { positionWindows : function(workspaceZooming) {
let totalVisible = 0; let totalVisible = 0;
@ -664,13 +681,8 @@ Workspace.prototype = {
let clone = this._windows[i]; let clone = this._windows[i];
let icon = this._windowIcons[i]; let icon = this._windowIcons[i];
if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows)) { if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows))
clone.setVisibleWithChrome(false);
icon.hide();
continue; continue;
} else {
clone.setVisibleWithChrome(true);
}
clone.stackAbove = previousWindow.actor; clone.stackAbove = previousWindow.actor;
previousWindow = clone; previousWindow = clone;
@ -1100,6 +1112,8 @@ Workspaces.prototype = {
this._x = x; this._x = x;
this._y = y; this._y = y;
this._windowSelectionAppId = null;
this._workspaces = []; this._workspaces = [];
this._highlightWindow = null; this._highlightWindow = null;
@ -1170,6 +1184,17 @@ Workspaces.prototype = {
} }
}, },
_clearApplicationWindowSelection: function(reposition) {
if (this._windowSelectionAppId == null)
return;
this._windowSelectionAppId = null;
for (let i = 0; i < this._workspaces.length; i++) {
this._workspaces[i].setLightboxMode(false);
this._workspaces[i].setShowOnlyWindows(null, reposition);
}
},
/** /**
* setApplicationWindowSelection: * setApplicationWindowSelection:
* @appid: Application identifier string * @appid: Application identifier string
@ -1179,26 +1204,31 @@ Workspaces.prototype = {
* window with setHighlightWindow(). * window with setHighlightWindow().
*/ */
setApplicationWindowSelection: function (appId) { setApplicationWindowSelection: function (appId) {
if (appId == null) {
this._clearApplicationWindowSelection(true);
return;
}
if (appId == this._windowSelectionAppId)
return;
this._windowSelectionAppId = appId;
let appSys = Shell.AppMonitor.get_default(); let appSys = Shell.AppMonitor.get_default();
let showOnlyWindows; let showOnlyWindows = {};
if (appId) { let windows = appSys.get_windows_for_app(appId);
let windows = appSys.get_windows_for_app(appId); for (let i = 0; i < windows.length; i++) {
showOnlyWindows = {}; showOnlyWindows[windows[i]] = 1;
for (let i = 0; i < windows.length; i++) {
showOnlyWindows[windows[i]] = 1;
}
} else {
showOnlyWindows = null;
} }
for (let i = 0; i < this._workspaces.length; i++) { for (let i = 0; i < this._workspaces.length; i++) {
this._workspaces[i].setLightboxMode(showOnlyWindows != null); this._workspaces[i].setLightboxMode(true);
this._workspaces[i].setShowOnlyWindows(showOnlyWindows); this._workspaces[i].setShowOnlyWindows(showOnlyWindows, true);
} }
}, },
// Should only be called from active Overview context _activateWindowInternal: function (metaWindow, time) {
activateWindowFromOverview: function (metaWindow, time) {
let activeWorkspaceNum = global.screen.get_active_workspace_index(); let activeWorkspaceNum = global.screen.get_active_workspace_index();
let windowWorkspaceNum = metaWindow.get_workspace().index(); let windowWorkspaceNum = metaWindow.get_workspace().index();
@ -1213,6 +1243,22 @@ Workspaces.prototype = {
} }
}, },
/**
* activateWindowFromOverview:
* @metaWindow: A #MetaWindow
* @time: Integer even timestamp
*
* This function exits the overview, switching to the given @metaWindow.
* If an application filter is in effect, it will be cleared.
*/
activateWindowFromOverview: function (metaWindow, time) {
if (this._windowSelectionAppId != null) {
this._clearApplicationWindowSelection(false);
}
this._activateWindowInternal(metaWindow, time);
Main.overview.hide();
},
hide : function() { hide : function() {
let activeWorkspaceIndex = global.screen.get_active_workspace_index(); let activeWorkspaceIndex = global.screen.get_active_workspace_index();
let activeWorkspace = this._workspaces[activeWorkspaceIndex]; let activeWorkspace = this._workspaces[activeWorkspaceIndex];