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
This commit is contained in:
Maxim Ermilov 2010-02-17 19:52:50 +03:00
parent 94d3e27c53
commit fd310bc7b9

View File

@ -429,9 +429,9 @@ WindowOverlay.prototype = {
return this.closeButton.width - this.closeButton._overlap; return this.closeButton.width - this.closeButton._overlap;
}, },
chromeHeight: function () { chromeHeights: function () {
return this.closeButton.height - this.closeButton._overlap + return [this.closeButton.height - this.closeButton._overlap,
this.title.height + this.title._spacing; this.title.height + this.title._spacing];
}, },
/** /**
@ -975,24 +975,26 @@ Workspace.prototype = {
*/ */
_computeWindowRelativeLayout: function(metaWindow, slot) { _computeWindowRelativeLayout: function(metaWindow, slot) {
let [xCenter, yCenter, fraction] = slot; let [xCenter, yCenter, fraction] = slot;
let [x, y, width, height] = this._getSlotRelativeGeometry(slot);
xCenter = xCenter * global.screen_width; xCenter = xCenter * global.screen_width;
yCenter = yCenter * global.screen_height;
let rect = new Meta.Rectangle(); let rect = new Meta.Rectangle();
metaWindow.get_outer_rect(rect); metaWindow.get_outer_rect(rect);
let chromeHeight = this._windowOverlays[1].chromeHeight() / this.scale; let [buttonOuterHeight, captionHeight] = this._windowOverlays[1].chromeHeights();
let chromeWidth = this._windowOverlays[1].chromeWidth() / this.scale; buttonOuterHeight /= this.scale;
captionHeight /= this.scale;
let buttonOuterWidth = this._windowOverlays[1].chromeWidth() / this.scale;
let desiredWidth = (global.screen_width - chromeWidth) * fraction; let desiredWidth = global.screen_width * fraction;
let desiredHeight = (global.screen_height - chromeHeight) * fraction; let desiredHeight = global.screen_height * fraction;
let scale = Math.min(desiredWidth / (rect.width + chromeWidth), let scale = Math.min((desiredWidth - buttonOuterWidth) / rect.width,
desiredHeight / (rect.height + chromeHeight), (desiredHeight - buttonOuterHeight - captionHeight) / rect.height,
1.0 / this.scale); 1.0 / this.scale);
let x = xCenter - 0.5 * scale * (rect.width + chromeWidth); x = xCenter - 0.5 * scale * rect.width;
let y = yCenter - 0.5 * scale * (rect.height + chromeHeight); y = y + height - rect.height * scale - captionHeight;
return [x, y, scale]; return [x, y, scale];
}, },