From 4e04bf0902304a0cd4d67c0394458448b68d1db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Thu, 1 Feb 2018 12:25:03 +0100 Subject: [PATCH] stackoverlay: `0` is falsy so can't use `||` If destinationX is `0` it will incorrectly be regarded as false. --- stackoverlay.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/stackoverlay.js b/stackoverlay.js index fae6db4..e363bed 100644 --- a/stackoverlay.js +++ b/stackoverlay.js @@ -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