[gnome-shell-extensions] native-window-placement: add WINDOW_AREA_TOP_GAP and place the windows bottom-center.



commit d355424f22047ffe1bd70ee45be44d6d46ad1372
Author: Wepmaschda <wepmaschda gmx de>
Date:   Wed Apr 18 16:21:40 2012 +0200

    native-window-placement: add WINDOW_AREA_TOP_GAP and place the windows bottom-center.
    
    This keeps window captions and close buttons always visible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674338

 extensions/native-window-placement/extension.js   |   15 +++++++++------
 extensions/native-window-placement/stylesheet.css |    2 +-
 2 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/extensions/native-window-placement/extension.js b/extensions/native-window-placement/extension.js
index b4b8137..316d2e3 100644
--- a/extensions/native-window-placement/extension.js
+++ b/extensions/native-window-placement/extension.js
@@ -33,6 +33,9 @@ const WINDOW_PLACEMENT_NATURAL_MAX_TRANSLATIONS = 5000;             // safety li
 
 const PLACE_WINDOW_CAPTIONS_ON_TOP = true;                          // place window titles in overview on top of windows with overlap parameter
 
+const WORKSPACE_BORDER_GAP = 10;                                    // minimum gap between the workspace area and the workspace selector
+const WINDOW_AREA_TOP_GAP = 20;                                     // minimum gap between the workspace area and the top border. This keeps window captions and close buttons visible. 13px (26/2) should currently be enough.
+
 const BUTTON_LAYOUT_SCHEMA = 'org.gnome.shell.overrides';
 const BUTTON_LAYOUT_KEY = 'button-layout';
 
@@ -46,7 +49,6 @@ function injectToFunction(parent, name, func) {
         return ret;
     }
 }
-const WORKSPACE_BORDER_GAP = 10;                                    // gap between the workspace area and the workspace selector
 
 const Rect = new Lang.Class({
     Name: 'NativeWindowPlacement.Rect',
@@ -143,9 +145,10 @@ function enable() {
         });
 
         // Put a gap on the right edge of the workspace to separe it from the workspace selector
-        let x_gap = WORKSPACE_BORDER_GAP;
-        let y_gap = WORKSPACE_BORDER_GAP * this._height / this._width
-        let area = new Rect(this._x, this._y, this._width - x_gap, this._height - y_gap);
+	let ratio = this._width / this._height;
+        let x_gap = Math.max(WORKSPACE_BORDER_GAP, WINDOW_AREA_TOP_GAP * ratio);
+        let y_gap = Math.max(WORKSPACE_BORDER_GAP / ratio, WINDOW_AREA_TOP_GAP);
+        let area = new Rect(this._x + x_gap/2, this._y + y_gap, this._width - x_gap, this._height - y_gap);
 
         let bounds = area.copy();
 
@@ -287,8 +290,8 @@ function enable() {
 
         let targets = [];
         for (let i = 0; i < rects.length; i++) {
-            rects[i].x = rects[i].x * scale + this._x;
-            rects[i].y = rects[i].y * scale + this._y;
+            rects[i].x = rects[i].x * scale + area.x;
+            rects[i].y = rects[i].y * scale + area.y;
 
             targets[i] = [rects[i].x, rects[i].y, scale];
         }
diff --git a/extensions/native-window-placement/stylesheet.css b/extensions/native-window-placement/stylesheet.css
index a1f194d..1977e2e 100644
--- a/extensions/native-window-placement/stylesheet.css
+++ b/extensions/native-window-placement/stylesheet.css
@@ -1,3 +1,3 @@
 .window-caption {
-    -shell-caption-overlap: 10px;
+    -shell-caption-overlap: 13px;		/* current caption height is 26px => set it to half of it. TODO: better solution needed */
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]