layout: Compute strut side more precisely for non primary monitors
Don't assume struts are on the primary monitor while computing the strut side. Instead, find the first monitor that overlaps the strut and compute the strut side using it. https://bugzilla.gnome.org/show_bug.cgi?id=744183
This commit is contained in:
parent
f4301147bb
commit
c2f5813463
@ -973,46 +973,39 @@ const LayoutManager = new Lang.Class({
|
|||||||
let y1 = Math.max(y, 0);
|
let y1 = Math.max(y, 0);
|
||||||
let y2 = Math.min(y + h, global.screen_height);
|
let y2 = Math.min(y + h, global.screen_height);
|
||||||
|
|
||||||
// NetWM struts are not really powerful enought to handle
|
// Metacity wants to know what side of the monitor the
|
||||||
// a multi-monitor scenario, they only describe what happens
|
// strut is considered to be attached to. First, we find
|
||||||
// around the outer sides of the full display region. However
|
// the monitor that contains the strut. If the actor is
|
||||||
// it can describe a partial region along each side, so
|
|
||||||
// we can support having the struts only affect the
|
|
||||||
// primary monitor. This should be enough as we only have
|
|
||||||
// chrome affecting the struts on the primary monitor so
|
|
||||||
// far.
|
|
||||||
//
|
|
||||||
// Metacity wants to know what side of the screen the
|
|
||||||
// strut is considered to be attached to. If the actor is
|
|
||||||
// only touching one edge, or is touching the entire
|
// only touching one edge, or is touching the entire
|
||||||
// border of the primary monitor, then it's obvious which
|
// border of that monitor, then it's obvious which side
|
||||||
// side to call it. If it's in a corner, we pick a side
|
// to call it. If it's in a corner, we pick a side
|
||||||
// arbitrarily. If it doesn't touch any edges, or it spans
|
// arbitrarily. If it doesn't touch any edges, or it
|
||||||
// the width/height across the middle of the screen, then
|
// spans the width/height across the middle of the
|
||||||
// we don't create a strut for it at all.
|
// screen, then we don't create a strut for it at all.
|
||||||
|
|
||||||
|
let monitor = this.findMonitorForActor(actorData.actor);
|
||||||
let side;
|
let side;
|
||||||
let primary = this.primaryMonitor;
|
if (x1 <= monitor.x && x2 >= monitor.x + monitor.width) {
|
||||||
if (x1 <= primary.x && x2 >= primary.x + primary.width) {
|
if (y1 <= monitor.y)
|
||||||
if (y1 <= primary.y)
|
|
||||||
side = Meta.Side.TOP;
|
side = Meta.Side.TOP;
|
||||||
else if (y2 >= primary.y + primary.height)
|
else if (y2 >= monitor.y + monitor.height)
|
||||||
side = Meta.Side.BOTTOM;
|
side = Meta.Side.BOTTOM;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
} else if (y1 <= primary.y && y2 >= primary.y + primary.height) {
|
} else if (y1 <= monitor.y && y2 >= monitor.y + monitor.height) {
|
||||||
if (x1 <= 0)
|
if (x1 <= monitor.x)
|
||||||
side = Meta.Side.LEFT;
|
side = Meta.Side.LEFT;
|
||||||
else if (x2 >= primary.x + primary.width)
|
else if (x2 >= monitor.x + monitor.width)
|
||||||
side = Meta.Side.RIGHT;
|
side = Meta.Side.RIGHT;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
} else if (x1 <= 0)
|
} else if (x1 <= monitor.x)
|
||||||
side = Meta.Side.LEFT;
|
side = Meta.Side.LEFT;
|
||||||
else if (y1 <= 0)
|
else if (y1 <= monitor.y)
|
||||||
side = Meta.Side.TOP;
|
side = Meta.Side.TOP;
|
||||||
else if (x2 >= global.screen_width)
|
else if (x2 >= monitor.x + monitor.width)
|
||||||
side = Meta.Side.RIGHT;
|
side = Meta.Side.RIGHT;
|
||||||
else if (y2 >= global.screen_height)
|
else if (y2 >= monitor.y + monitor.height)
|
||||||
side = Meta.Side.BOTTOM;
|
side = Meta.Side.BOTTOM;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user