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
This commit is contained in:
Tim L 2012-06-08 18:26:58 +10:00 committed by Jasper St. Pierre
parent 07f1a05ab4
commit dc004f6eb7
2 changed files with 4 additions and 21 deletions

View File

@ -228,26 +228,9 @@ const LayoutManager = new Lang.Class({
return false; return false;
}, },
get focusIndex() { get currentMonitor() {
let focusWindow = global.display.focus_window; let index = global.screen.get_current_monitor();
return Main.layoutManager.monitors[index];
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];
}, },
_startupAnimation: function() { _startupAnimation: function() {

View File

@ -180,7 +180,7 @@ const ModalDialog = new Lang.Class({
}, },
_fadeOpen: function() { _fadeOpen: function() {
let monitor = Main.layoutManager.focusMonitor; let monitor = Main.layoutManager.currentMonitor;
this._backgroundBin.set_position(monitor.x, monitor.y); this._backgroundBin.set_position(monitor.x, monitor.y);
this._backgroundBin.set_size(monitor.width, monitor.height); this._backgroundBin.set_size(monitor.width, monitor.height);