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 {
|
} else {
|
||||||
let focusWindow = global.display.focus_window;
|
let focusWindow = global.display.focus_window;
|
||||||
if (focusWindow)
|
if (focusWindow)
|
||||||
i = this.findIndexForWindow(focusWindow);
|
i = focusWindow.get_monitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
@ -655,14 +655,6 @@ const LayoutManager = new Lang.Class({
|
|||||||
return -1;
|
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
|
// 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
|
// In practice all tracked actors should be visible on some monitor anyway
|
||||||
findIndexForActor: function(actor) {
|
findIndexForActor: function(actor) {
|
||||||
@ -674,15 +666,6 @@ const LayoutManager = new Lang.Class({
|
|||||||
return this.primaryIndex; // Not on any monitor, pretend its on the primary
|
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) {
|
findMonitorForActor: function(actor) {
|
||||||
return this.monitors[this.findIndexForActor(actor)];
|
return this.monitors[this.findIndexForActor(actor)];
|
||||||
},
|
},
|
||||||
@ -733,7 +716,7 @@ const LayoutManager = new Lang.Class({
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (layer == Meta.StackLayer.FULLSCREEN) {
|
if (layer == Meta.StackLayer.FULLSCREEN) {
|
||||||
let monitor = this.findMonitorForWindow(metaWindow);
|
let monitor = this.monitors[metaWindow.get_monitor()];
|
||||||
if (monitor)
|
if (monitor)
|
||||||
monitor.inFullscreen = true;
|
monitor.inFullscreen = true;
|
||||||
}
|
}
|
||||||
@ -750,7 +733,7 @@ const LayoutManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Or whether it is monitor sized
|
// Or whether it is monitor sized
|
||||||
let monitor = this.findMonitorForWindow(metaWindow);
|
let monitor = this.monitors[metaWindow.get_monitor()];
|
||||||
if (monitor &&
|
if (monitor &&
|
||||||
window.x <= monitor.x &&
|
window.x <= monitor.x &&
|
||||||
window.x + window.width >= monitor.x + monitor.width &&
|
window.x + window.width >= monitor.x + monitor.width &&
|
||||||
|
@ -253,12 +253,9 @@ const WindowManager = new Lang.Class({
|
|||||||
xScale = geom.width / actor.width;
|
xScale = geom.width / actor.width;
|
||||||
yScale = geom.height / actor.height;
|
yScale = geom.height / actor.height;
|
||||||
} else {
|
} else {
|
||||||
/* scale window down to 0x0. */
|
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
||||||
let monitor = Main.layoutManager.findMonitorForWindow(actor.meta_window);
|
let xDest = monitor.x;
|
||||||
xDest = monitor.x;
|
let yDest = monitor.y;
|
||||||
yDest = monitor.y;
|
|
||||||
xScale = 0.0;
|
|
||||||
yScale = 0.0;
|
|
||||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
xDest += monitor.width;
|
xDest += monitor.width;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user