[gnome-shell-extensions] create actor at the right place, so there is no more clipping-out-of-screen problem



commit c5fd578214538d088ba904eaa7008af0b9188129
Author: Bastien Durel <bastien durel org>
Date:   Mon May 7 16:10:06 2012 +0200

    create actor at the right place, so there is no more clipping-out-of-screen problem
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664318

 extensions/dock/extension.js |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/extensions/dock/extension.js b/extensions/dock/extension.js
index bc4123e..345c201 100644
--- a/extensions/dock/extension.js
+++ b/extensions/dock/extension.js
@@ -384,7 +384,9 @@ const Dock = new Lang.Class({
         this._nicons = 0;
         this._selectEffectFunctions(this._settings.get_enum(DOCK_EFFECTHIDE_KEY));
 
-        this.actor = new St.BoxLayout({ name: 'dock', vertical: true, reactive: true });
+        let [_x, _y, _w, _h] = this.get_start_position();
+        this.actor = new St.BoxLayout({ name: 'dock', vertical: true, reactive: true,
+                                        x: _x, y: _y, width: _w, height: _h });
 
         this._grid = new Shell.GenericContainer();
         this.actor.add(this._grid, { expand: true, y_align: St.Align.START });
@@ -464,6 +466,27 @@ const Dock = new Lang.Class({
         this._hideDock();
     },
 
+    get_start_position: function() {
+        let item_size = this._settings.get_int(DOCK_SIZE_KEY);
+        let monitor = Main.layoutManager.primaryMonitor;
+        if (this._displayMonitor > -1 && this._displayMonitor < Main.layoutManager.monitors.length) {
+          monitor = Main.layoutManager.monitors[this._displayMonitor];
+        }
+        let position_x = monitor.x;
+        let width = item_size + 4 * this._spacing;
+
+        switch (this._settings.get_enum(DOCK_POSITION_KEY)) {
+        case PositionMode.LEFT:
+            position_x=monitor.x - 2 * this._spacing;
+            break;
+        case PositionMode.RIGHT:
+        default:
+            position_x=monitor.x + (monitor.width - item_size - 2 * this._spacing);
+        }
+
+        return [ position_x, monitor.y, width, monitor.height ];
+    },
+
     destroy: function() {
         if (this._installedChangedId) {
             this._appSystem.disconnect(this._installedChangedId);



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