[gnome-shell] Handle workspaces going empty due to windows changing monitors



commit 0c99f66547bedbac6c4ee8a6173e8699676bd44f
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Mar 16 11:37:08 2011 +0100

    Handle workspaces going empty due to windows changing monitors
    
    If a workspace becomes empty due to a window changing to/from the
    primary monitor, but not changing its original workspace then we
    were not noticing this. This can happen for instance if you drag
    a thumbnail window to a non-primary window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=609258

 js/ui/main.js |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 2b4c20f..b558997 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -219,6 +219,10 @@ function start() {
     }
 
     global.screen.connect('notify::n-workspaces', _nWorkspacesChanged);
+
+    global.screen.connect('window-entered-monitor', _windowEnteredMonitor);
+    global.screen.connect('window-left-monitor', _windowLeftMonitor);
+
     Mainloop.idle_add(_nWorkspacesChanged);
 }
 
@@ -306,6 +310,20 @@ function _windowRemoved(workspace, window) {
     });
 }
 
+function _windowLeftMonitor(metaScreen, monitorIndex, metaWin) {
+    // If the window left the primary monitor, that
+    // might make that workspace empty
+    if (monitorIndex == global.get_primary_monitor_index())
+        _queueCheckWorkspaces();
+}
+
+function _windowEnteredMonitor(metaScreen, monitorIndex, metaWin) {
+    // If the window entered the primary monitor, that
+    // might make that workspace non-empty
+    if (monitorIndex == global.get_primary_monitor_index())
+        _queueCheckWorkspaces();
+}
+
 function _queueCheckWorkspaces() {
     if (_checkWorkspacesId == 0)
         _checkWorkspacesId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, _checkWorkspaces);



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