[gnome-shell] Main.activateWindow: always exit the overview if it's currently open



commit cec62a7ca55c4a3ec5c73aeef960542ef0123940
Author: Dan Winship <danw gnome org>
Date:   Wed Feb 17 14:05:06 2010 -0500

    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

 js/ui/appDisplay.js     |    8 ++++----
 js/ui/main.js           |    5 ++++-
 js/ui/overview.js       |   14 --------------
 js/ui/workspace.js      |    2 +-
 js/ui/workspacesView.js |   20 +++-----------------
 5 files changed, 12 insertions(+), 37 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 1af7994..026ec11 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -55,7 +55,7 @@ AppDisplayItem.prototype = {
         let windows = app.get_windows();
         if (windows.length > 0) {
             let mostRecentWindow = windows[0];
-            Main.overview.activateWindow(mostRecentWindow, global.get_current_time());
+            Main.activateWindow(mostRecentWindow);
         } else {
             this._appInfo.launch();
         }
@@ -240,7 +240,7 @@ BaseAppSearchProvider.prototype = {
         let windows = app.get_windows();
 
         if (windows.length > 0)
-            Main.overview.activateWindow(windows[0], global.get_current_time());
+            Main.activateWindow(windows[0]);
         else
             app.launch();
     },
@@ -439,7 +439,7 @@ AppWellIcon.prototype = {
 
     activateMostRecentWindow: function () {
         let mostRecentWindow = this.app.get_windows()[0];
-        Main.overview.activateWindow(mostRecentWindow, global.get_current_time());
+        Main.activateWindow(mostRecentWindow);
     },
 
     highlightWindow: function(metaWindow) {
@@ -453,7 +453,7 @@ AppWellIcon.prototype = {
     activateWindow: function(metaWindow) {
         if (metaWindow) {
             this._didActivateWindow = true;
-            Main.overview.activateWindow(metaWindow, global.get_current_time());
+            Main.activateWindow(metaWindow);
         } else
             Main.overview.hide();
     },
diff --git a/js/ui/main.js b/js/ui/main.js
index aced139..a749a01 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -401,7 +401,8 @@ function getRunDialog() {
  * @window: the Meta.Window to activate
  * @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) {
     let activeWorkspaceNum = global.screen.get_active_workspace_index();
@@ -416,6 +417,8 @@ function activateWindow(window, time) {
     } else {
         window.activate(time);
     }
+
+    overview.hide();
 }
 
 // TODO - replace this timeout with some system to guess when the user might
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 488ddd8..50edd9c 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -564,20 +564,6 @@ Overview.prototype = {
         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 ////
 
     _showDone: function() {
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index f7668d4..c91ea12 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -1419,7 +1419,7 @@ Workspace.prototype = {
     },
 
     _onCloneSelected : function (clone, time) {
-        Main.overview.activateWindow(clone.metaWindow, time);
+        Main.activateWindow(clone.metaWindow, time);
     },
 
     _removeSelf : function(actor, event) {
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index dc6aa7d..c78d1d4 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -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() {
         let activeWorkspaceIndex = global.screen.get_active_workspace_index();
         let activeWorkspace = this._workspaces[activeWorkspaceIndex];
 
+        if (this._windowSelectionAppId != null)
+            this._clearApplicationWindowSelection(false);
+
         activeWorkspace.actor.raise_top();
 
         for (let w = 0; w < this._workspaces.length; w++)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]