stackoverlay: 0 is falsy so can't use ||

If destinationX is `0` it will incorrectly be regarded as false.
This commit is contained in:
Tor Hedin Brønner
2018-02-01 12:26:53 +01:00
parent 78449a9f28
commit 4e04bf0902
+11 -6
View File
@@ -133,18 +133,21 @@ var StackOverlay = new Lang.Class({
let resizeBorderWidth = 5; // approx.
let space = Tiling.spaces.spaceOfWindow(metaWindow);
// Note: Atm. this can be called when the windows are moving. Therefore
// we must use destinationX and we might occationally get wrong y
// positions (icon) (since we don't track the y destination)
// We also assume window widths are are unchanging.
if (metaWindow.destinationX < Tiling.stack_margin) {
let destX = metaWindow.destinationX;
if (destX === undefined)
destX = frame.x;
if (destX < Tiling.stack_margin) {
let neighbour = space[space.indexOf(metaWindow) + 1]
if (!neighbour)
return bail(); // Should normally have a neighbour. Bail!
let neighbourX = neighbour.destinationX ||
neighbour.get_frame_rect().x;
let neighbourX = neighbour.destinationX;
if (neighbourX === undefined)
neighbourX = neighbour.get_frame_rect().x;
overlay.x = 0;
overlay.width = Math.min(
@@ -157,8 +160,10 @@ var StackOverlay = new Lang.Class({
return bail(); // Should normally have a neighbour. Bail!
let neighbourFrame = neighbour.get_frame_rect();
let neighbourX = neighbour.destinationX || neighbourFrame.x;
let neighbourX = neighbour.destinationX;
if (neighbourX === undefined)
neighbourX = neighbourFrame.x;
overlay.x = Math.max(
this.monitor.width - Tiling.stack_margin,
neighbourX + neighbourFrame.width + resizeBorderWidth