From fd310bc7b9ce07f49dc1142c68ed4e4e5386b160 Mon Sep 17 00:00:00 2001 From: Maxim Ermilov Date: Wed, 17 Feb 2010 19:52:50 +0300 Subject: [PATCH] Correct position of window previews. align the bottoms of the window previews. window previews always fit in the slot. https://bugzilla.gnome.org/show_bug.cgi?id=610070 --- js/ui/workspace.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 198628fb2..f7668d458 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -429,9 +429,9 @@ WindowOverlay.prototype = { return this.closeButton.width - this.closeButton._overlap; }, - chromeHeight: function () { - return this.closeButton.height - this.closeButton._overlap + - this.title.height + this.title._spacing; + chromeHeights: function () { + return [this.closeButton.height - this.closeButton._overlap, + this.title.height + this.title._spacing]; }, /** @@ -975,24 +975,26 @@ Workspace.prototype = { */ _computeWindowRelativeLayout: function(metaWindow, slot) { let [xCenter, yCenter, fraction] = slot; + let [x, y, width, height] = this._getSlotRelativeGeometry(slot); xCenter = xCenter * global.screen_width; - yCenter = yCenter * global.screen_height; let rect = new Meta.Rectangle(); metaWindow.get_outer_rect(rect); - let chromeHeight = this._windowOverlays[1].chromeHeight() / this.scale; - let chromeWidth = this._windowOverlays[1].chromeWidth() / this.scale; + let [buttonOuterHeight, captionHeight] = this._windowOverlays[1].chromeHeights(); + buttonOuterHeight /= this.scale; + captionHeight /= this.scale; + let buttonOuterWidth = this._windowOverlays[1].chromeWidth() / this.scale; - let desiredWidth = (global.screen_width - chromeWidth) * fraction; - let desiredHeight = (global.screen_height - chromeHeight) * fraction; - let scale = Math.min(desiredWidth / (rect.width + chromeWidth), - desiredHeight / (rect.height + chromeHeight), + let desiredWidth = global.screen_width * fraction; + let desiredHeight = global.screen_height * fraction; + let scale = Math.min((desiredWidth - buttonOuterWidth) / rect.width, + (desiredHeight - buttonOuterHeight - captionHeight) / rect.height, 1.0 / this.scale); - let x = xCenter - 0.5 * scale * (rect.width + chromeWidth); - let y = yCenter - 0.5 * scale * (rect.height + chromeHeight); + x = xCenter - 0.5 * scale * rect.width; + y = y + height - rect.height * scale - captionHeight; return [x, y, scale]; },