Don't proxy methods through overview; add a getWorkspacesForWindow()

Duplicating the methods was unnecessary.  Also, we want a getWorkspacesForWindow()
method as preparation for multi-monitor work.

https://bugzilla.gnome.org/show_bug.cgi?id=594699
This commit is contained in:
Colin Walters 2009-09-11 12:47:53 -04:00
parent 2812c21322
commit 33f9895d71
3 changed files with 37 additions and 29 deletions

View File

@ -848,8 +848,8 @@ RunningWellItem.prototype = {
if (this._menu == null) { if (this._menu == null) {
this._menu = new WellMenu(this); this._menu = new WellMenu(this);
this._menu.connect('highlight-window', Lang.bind(this, function (menu, window) { this._menu.connect('highlight-window', Lang.bind(this, function (menu, metaWindow) {
Main.overview.setHighlightWindow(window); Main.overview.getWorkspacesForWindow(metaWindow).setHighlightWindow(metaWindow);
})); }));
this._menu.connect('popup', Lang.bind(this, function (menu, isPoppedUp) { this._menu.connect('popup', Lang.bind(this, function (menu, isPoppedUp) {
let id; let id;
@ -858,7 +858,8 @@ RunningWellItem.prototype = {
id = this.appInfo.get_id(); id = this.appInfo.get_id();
else else
id = null; id = null;
Main.overview.setApplicationWindowSelection(id);
Main.overview.getWorkspacesForWindow(null).setApplicationWindowSelection(id);
})); }));
} }

View File

@ -386,6 +386,18 @@ Overview.prototype = {
this.show(); this.show();
}, },
/**
* getWorkspacesForWindow:
* @metaWindow: A #MetaWindow
*
* Returns the Workspaces object associated with the given window.
* This method is not be accessible if the overview is not open
* and will return %null.
*/
getWorkspacesForWindow: function(metaWindow) {
return this._workspaces;
},
/** /**
* activateWindow: * activateWindow:
* @metaWindow: A #MetaWindow * @metaWindow: A #MetaWindow
@ -401,31 +413,6 @@ Overview.prototype = {
this.hide(); this.hide();
}, },
/**
* setHighlightWindow:
* @metaWindow: A #MetaWindow
*
* Draw the user's attention to the given window @metaWindow.
*/
setHighlightWindow: function (metaWindow) {
if (this._workspaces)
this._workspaces.setHighlightWindow(metaWindow);
},
/**
* setApplicationWindowSelection:
* @appid: Application identifier string
*
* Enter a mode which shows only the windows owned by the
* given application, and allow highlighting of a specific
* window with setHighlightWindow().
*/
setApplicationWindowSelection: function (appid) {
if (this._workspaces)
this._workspaces.setApplicationWindowSelection(appid);
},
//// Private methods //// //// Private methods ////
_showDone: function() { _showDone: function() {

View File

@ -544,6 +544,13 @@ Workspace.prototype = {
return -1; return -1;
}, },
/**
* lookupCloneForMetaWindow:
* @metaWindow: A #MetaWindow
*
* Given a #MetaWindow instance, find the WindowClone object
* which represents it in the workspaces display.
*/
lookupCloneForMetaWindow: function (metaWindow) { lookupCloneForMetaWindow: function (metaWindow) {
let index = this._lookupIndex (metaWindow); let index = this._lookupIndex (metaWindow);
return index < 0 ? null : this._windows[index]; return index < 0 ? null : this._windows[index];
@ -573,6 +580,12 @@ Workspace.prototype = {
} }
}, },
/**
* setHighlightWindow:
* @metaWindow: A #MetaWindow
*
* Draw the user's attention to the given window @metaWindow.
*/
setHighlightWindow: function (metaWindow) { setHighlightWindow: function (metaWindow) {
for (let i = 0; i < this._windows.length; i++) { for (let i = 0; i < this._windows.length; i++) {
this._windows[i].actor.lower(this._lightbox); this._windows[i].actor.lower(this._lightbox);
@ -1157,7 +1170,14 @@ Workspaces.prototype = {
} }
}, },
// See comments in overview.js /**
* setApplicationWindowSelection:
* @appid: Application identifier string
*
* Enter a mode which shows only the windows owned by the
* given application, and allow highlighting of a specific
* window with setHighlightWindow().
*/
setApplicationWindowSelection: function (appId) { setApplicationWindowSelection: function (appId) {
let appSys = Shell.AppMonitor.get_default(); let appSys = Shell.AppMonitor.get_default();