[gnome-shell] WorkspacesView: don't fail when doing window DND from the last workspace



commit 9e60a55dd723097cb0fa8af139e9c521e32f405b
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Jan 19 02:26:44 2013 +0100

    WorkspacesView: don't fail when doing window DND from the last workspace
    
    DND of windows has a lot of side effects, including the possibility of
    current workspace disappering from under our feet. We need to account
    for that when trying to activate it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685285

 js/ui/workspacesView.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index ffabaf4..a409223 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -389,6 +389,15 @@ const WorkspacesView = new Lang.Class({
         let current = Math.round(adj.value);
 
         if (active != current) {
+            if (!this._workspaces[current]) {
+                // The current workspace was destroyed. This could happen
+                // when you are on the last empty workspace, and consolidate
+                // windows using the thumbnail bar.
+                // In that case, the intended behavior is to stay on the empty
+                // workspace, which is the last one, so pick it.
+                current = this._workspaces.length - 1;
+            }
+
             let metaWorkspace = this._workspaces[current].metaWorkspace;
             metaWorkspace.activate(global.get_current_time());
         }


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