Main.activateWindow: always exit the overview if it's currently open

This way, clicking a message tray icon while the overview is open will
close the overview when activating its window.

Remove some other overview-related activation code which is now
redundant.

Also, remove calls to "global.get_current_time()" when calling
Main.activateWindow, since it's unnecessary (activateWindow will call
it itself if you don't pass in that arg).

https://bugzilla.gnome.org/show_bug.cgi?id=609765
This commit is contained in:
Dan Winship 2010-02-17 14:05:06 -05:00
parent 77fe0db623
commit cec62a7ca5
5 changed files with 12 additions and 37 deletions

View File

@ -55,7 +55,7 @@ AppDisplayItem.prototype = {
let windows = app.get_windows(); let windows = app.get_windows();
if (windows.length > 0) { if (windows.length > 0) {
let mostRecentWindow = windows[0]; let mostRecentWindow = windows[0];
Main.overview.activateWindow(mostRecentWindow, global.get_current_time()); Main.activateWindow(mostRecentWindow);
} else { } else {
this._appInfo.launch(); this._appInfo.launch();
} }
@ -240,7 +240,7 @@ BaseAppSearchProvider.prototype = {
let windows = app.get_windows(); let windows = app.get_windows();
if (windows.length > 0) if (windows.length > 0)
Main.overview.activateWindow(windows[0], global.get_current_time()); Main.activateWindow(windows[0]);
else else
app.launch(); app.launch();
}, },
@ -439,7 +439,7 @@ AppWellIcon.prototype = {
activateMostRecentWindow: function () { activateMostRecentWindow: function () {
let mostRecentWindow = this.app.get_windows()[0]; let mostRecentWindow = this.app.get_windows()[0];
Main.overview.activateWindow(mostRecentWindow, global.get_current_time()); Main.activateWindow(mostRecentWindow);
}, },
highlightWindow: function(metaWindow) { highlightWindow: function(metaWindow) {
@ -453,7 +453,7 @@ AppWellIcon.prototype = {
activateWindow: function(metaWindow) { activateWindow: function(metaWindow) {
if (metaWindow) { if (metaWindow) {
this._didActivateWindow = true; this._didActivateWindow = true;
Main.overview.activateWindow(metaWindow, global.get_current_time()); Main.activateWindow(metaWindow);
} else } else
Main.overview.hide(); Main.overview.hide();
}, },

View File

@ -401,7 +401,8 @@ function getRunDialog() {
* @window: the Meta.Window to activate * @window: the Meta.Window to activate
* @time: (optional) current event time * @time: (optional) current event time
* *
* Activates @window, switching to its workspace first if necessary * Activates @window, switching to its workspace first if necessary,
* and switching out of the overview if it's currently active
*/ */
function activateWindow(window, time) { function activateWindow(window, time) {
let activeWorkspaceNum = global.screen.get_active_workspace_index(); let activeWorkspaceNum = global.screen.get_active_workspace_index();
@ -416,6 +417,8 @@ function activateWindow(window, time) {
} else { } else {
window.activate(time); window.activate(time);
} }
overview.hide();
} }
// TODO - replace this timeout with some system to guess when the user might // TODO - replace this timeout with some system to guess when the user might

View File

@ -564,20 +564,6 @@ Overview.prototype = {
return this._workspaces; return this._workspaces;
}, },
/**
* activateWindow:
* @metaWindow: A #MetaWindow
* @time: Event timestamp integer
*
* Make the given MetaWindow be the focus window, switching
* to the workspace it's on if necessary. This function
* should only be used when the Overview is currently active;
* outside of that, use the relevant methods on MetaDisplay.
*/
activateWindow: function (metaWindow, time) {
this._workspaces.activateWindowFromOverview(metaWindow, time);
},
//// Private methods //// //// Private methods ////
_showDone: function() { _showDone: function() {

View File

@ -1419,7 +1419,7 @@ Workspace.prototype = {
}, },
_onCloneSelected : function (clone, time) { _onCloneSelected : function (clone, time) {
Main.overview.activateWindow(clone.metaWindow, time); Main.activateWindow(clone.metaWindow, time);
}, },
_removeSelf : function(actor, event) { _removeSelf : function(actor, event) {

View File

@ -163,27 +163,13 @@ GenericWorkspacesView.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);
}
Main.activateWindow(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];
if (this._windowSelectionAppId != null)
this._clearApplicationWindowSelection(false);
activeWorkspace.actor.raise_top(); activeWorkspace.actor.raise_top();
for (let w = 0; w < this._workspaces.length; w++) for (let w = 0; w < this._workspaces.length; w++)