[gnome-shell] modalDialog: show dialogs on monitor with the mouse pointer



commit dc004f6eb7c6574e8fa3a5b55e7ef6d51e183479
Author: Tim L <tim feathertop org>
Date:   Fri Jun 8 18:26:58 2012 +1000

    modalDialog: show dialogs on monitor with the mouse pointer
    
    Show the dialog on the monitor containing the pointer, rather than
    the monitor with active focused window. This brings it inline with
    the behaviour seen when launching applications.
    
    Remove the focusMonitor/focusIndex from LayoutManager. These
    properties were only used by the modal dialogs. Remove them since
    they are not being used elsewhere.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642591

 js/ui/layout.js      |   23 +++--------------------
 js/ui/modalDialog.js |    2 +-
 2 files changed, 4 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 6351ad9..ef1a1b2 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -228,26 +228,9 @@ const LayoutManager = new Lang.Class({
         return false;
     },
 
-    get focusIndex() {
-        let focusWindow = global.display.focus_window;
-
-        if (focusWindow) {
-            let wrect = focusWindow.get_outer_rect();
-            for (let i = 0; i < this.monitors.length; i++) {
-                let monitor = this.monitors[i];
-
-                if (monitor.x <= wrect.x && monitor.y <= wrect.y &&
-                    monitor.x + monitor.width > wrect.x &&
-                    monitor.y + monitor.height > wrect.y)
-                    return i;
-            }
-        }
-
-        return this.primaryIndex;
-    },
-
-    get focusMonitor() {
-        return this.monitors[this.focusIndex];
+    get currentMonitor() {
+        let index = global.screen.get_current_monitor();
+        return Main.layoutManager.monitors[index];
     },
 
     _startupAnimation: function() {
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index 6109b32..e30b705 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -180,7 +180,7 @@ const ModalDialog = new Lang.Class({
     },
 
     _fadeOpen: function() {
-        let monitor = Main.layoutManager.focusMonitor;
+        let monitor = Main.layoutManager.currentMonitor;
 
         this._backgroundBin.set_position(monitor.x, monitor.y);
         this._backgroundBin.set_size(monitor.width, monitor.height);



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