From 7bb92dbfa341e1950277a7f08ecac65d10ffa979 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Tue, 28 May 2019 17:59:14 -0400 Subject: [PATCH] Include appicon margin in preview centering --- windowPreview.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/windowPreview.js b/windowPreview.js index a355c6a..f0059ce 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -409,17 +409,18 @@ var PreviewMenu = Utils.defineClass({ let sourceContentBox = sourceNode.get_content_box(this.currentAppIcon.actor.get_allocation_box()); let sourceAllocation = Shell.util_get_transformed_allocation(this.currentAppIcon.actor); let [previewsWidth, previewsHeight] = this._getPreviewsSize(); + let appIconMargin = this._dtpSettings.get_int('appicon-margin') / scaleFactor; let x = 0, y = 0; previewsWidth = Math.min(previewsWidth, this._panelWrapper.monitor.width); previewsHeight = Math.min(previewsHeight, this._panelWrapper.monitor.height) + headerHeight; if (this._checkIfLeftOrRight()) { - y = sourceAllocation.y1 - this._panelWrapper.monitor.y + (sourceContentBox.y2 - sourceContentBox.y1 - previewsHeight) * .5; + y = sourceAllocation.y1 + appIconMargin - this._panelWrapper.monitor.y + (sourceContentBox.y2 - sourceContentBox.y1 - previewsHeight) * .5; y = Math.max(y, 0); y = Math.min(y, this._panelWrapper.monitor.height - previewsHeight); } else { - x = sourceAllocation.x1 - this._panelWrapper.monitor.x + (sourceContentBox.x2 - sourceContentBox.x1 - previewsWidth) * .5; + x = sourceAllocation.x1 + appIconMargin - this._panelWrapper.monitor.x + (sourceContentBox.x2 - sourceContentBox.x1 - previewsWidth) * .5; x = Math.max(x, 0); x = Math.min(x, this._panelWrapper.monitor.width - previewsWidth); }