[gnome-shell] Correct position of window previews.
- From: Maxim Ermilov <mermilov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Correct position of window previews.
- Date: Wed, 17 Feb 2010 17:00:28 +0000 (UTC)
commit fd310bc7b9ce07f49dc1142c68ed4e4e5386b160
Author: Maxim Ermilov <zaspire rambler ru>
Date: Wed Feb 17 19:52:50 2010 +0300
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 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 198628f..f7668d4 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];
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]