layout: Replace uses of find(Monitor|Index)ForWindow with window.get_monitor()
Mutter already does the math for us, so we shouldn't have to do it.
This commit is contained in:
parent
0335f2726a
commit
d9b33e01ee
@ -355,7 +355,7 @@ const LayoutManager = new Lang.Class({
|
||||
} else {
|
||||
let focusWindow = global.display.focus_window;
|
||||
if (focusWindow)
|
||||
i = this.findIndexForWindow(focusWindow);
|
||||
i = focusWindow.get_monitor();
|
||||
}
|
||||
|
||||
return i;
|
||||
@ -655,14 +655,6 @@ const LayoutManager = new Lang.Class({
|
||||
return -1;
|
||||
},
|
||||
|
||||
findIndexForWindow: function(window) {
|
||||
let rect = window.get_input_rect();
|
||||
let i = this._findMonitorForRect(rect.x, rect.y, rect.width, rect.height);
|
||||
if (i >= 0)
|
||||
return i;
|
||||
return this.primaryIndex; // Not on any monitor, pretend its on the primary
|
||||
},
|
||||
|
||||
// This call guarantees that we return some monitor to simplify usage of it
|
||||
// In practice all tracked actors should be visible on some monitor anyway
|
||||
findIndexForActor: function(actor) {
|
||||
@ -674,15 +666,6 @@ const LayoutManager = new Lang.Class({
|
||||
return this.primaryIndex; // Not on any monitor, pretend its on the primary
|
||||
},
|
||||
|
||||
findMonitorForWindow: function(window) {
|
||||
let rect = window.get_input_rect();
|
||||
let i = this._findMonitorForRect(rect.x, rect.y, rect.width, rect.height);
|
||||
if (i >= 0)
|
||||
return this.monitors[i];
|
||||
else
|
||||
return null;
|
||||
},
|
||||
|
||||
findMonitorForActor: function(actor) {
|
||||
return this.monitors[this.findIndexForActor(actor)];
|
||||
},
|
||||
@ -733,7 +716,7 @@ const LayoutManager = new Lang.Class({
|
||||
continue;
|
||||
|
||||
if (layer == Meta.StackLayer.FULLSCREEN) {
|
||||
let monitor = this.findMonitorForWindow(metaWindow);
|
||||
let monitor = this.monitors[metaWindow.get_monitor()];
|
||||
if (monitor)
|
||||
monitor.inFullscreen = true;
|
||||
}
|
||||
@ -750,7 +733,7 @@ const LayoutManager = new Lang.Class({
|
||||
}
|
||||
|
||||
// Or whether it is monitor sized
|
||||
let monitor = this.findMonitorForWindow(metaWindow);
|
||||
let monitor = this.monitors[metaWindow.get_monitor()];
|
||||
if (monitor &&
|
||||
window.x <= monitor.x &&
|
||||
window.x + window.width >= monitor.x + monitor.width &&
|
||||
|
@ -253,12 +253,9 @@ const WindowManager = new Lang.Class({
|
||||
xScale = geom.width / actor.width;
|
||||
yScale = geom.height / actor.height;
|
||||
} else {
|
||||
/* scale window down to 0x0. */
|
||||
let monitor = Main.layoutManager.findMonitorForWindow(actor.meta_window);
|
||||
xDest = monitor.x;
|
||||
yDest = monitor.y;
|
||||
xScale = 0.0;
|
||||
yScale = 0.0;
|
||||
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
||||
let xDest = monitor.x;
|
||||
let yDest = monitor.y;
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
xDest += monitor.width;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user