Bug 589437 - Switch to workspace of target app to activate

The user explicitly selected a window, so take them to it.
This commit is contained in:
Colin Walters 2009-07-22 18:57:33 -04:00
parent f24169735a
commit 2cc650e389

View File

@ -519,8 +519,17 @@ WellDisplayItem.prototype = {
if (this._windows.length == 0) if (this._windows.length == 0)
this.launch(); this.launch();
else { else {
/* Pick the first window and activate it, switching to its workspace
* if necessary. In the future, we want to have a menu dropdown here. */
let first = this._windows[0]; let first = this._windows[0];
first.activate(Clutter.get_current_event_time()); let firstWorkspace = first.get_workspace();
let currentWorkspaceIndex = Shell.Global.get().screen.get_active_workspace_index();
let currentWorkspace = Shell.Global.get().screen.get_workspace_by_index(currentWorkspaceIndex);
let ts = Clutter.get_current_event_time();
if (currentWorkspace != firstWorkspace)
firstWorkspace.activate_with_focus(first, ts);
else
first.activate(ts);
} }
this.emit('activated'); this.emit('activated');
}, },