[gnome-shell-extensions] native-window-placement: Cut down on copy-pasted code



commit 1634af39dc6e1c57d4099538454817c4d2b5fe80
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Dec 4 10:53:33 2015 +0100

    native-window-placement: Cut down on copy-pasted code
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758976

 extensions/native-window-placement/extension.js |   33 +----------------------
 1 files changed, 1 insertions(+), 32 deletions(-)
---
diff --git a/extensions/native-window-placement/extension.js b/extensions/native-window-placement/extension.js
index 165e866..fa61b01 100644
--- a/extensions/native-window-placement/extension.js
+++ b/extensions/native-window-placement/extension.js
@@ -407,31 +407,13 @@ function enable() {
         /// This is almost a direct copy of the original relayout function. Differences are marked.
         winInjections['relayout'] = Workspace.WindowOverlay.prototype.relayout;
         Workspace.WindowOverlay.prototype.relayout = function(animate) {
-            let button = this.closeButton;
+            winInjections['relayout'].call(this, animate);
             let title = this.title;
-            let border = this.border;
 
-            Tweener.removeTweens(button);
             Tweener.removeTweens(title);
-            Tweener.removeTweens(border);
 
             let [cloneX, cloneY, cloneWidth, cloneHeight] = this._windowClone.slot;
 
-            let layout = Meta.prefs_get_button_layout();
-            let side = layout.left_buttons.indexOf(Meta.ButtonFunction.CLOSE) > -1 ? St.Side.LEFT : 
St.Side.RIGHT;
-
-            let buttonX;
-            let buttonY = cloneY - (button.height - button._overlap);
-            if (side == St.Side.LEFT)
-                buttonX = cloneX - (button.width - button._overlap);
-            else
-                buttonX = cloneX + (cloneWidth - button._overlap);
-
-            if (animate)
-                this._animateOverlayActor(button, Math.floor(buttonX), Math.floor(buttonY), button.width);
-            else
-                button.set_position(Math.floor(buttonX), Math.floor(buttonY));
-
             // Clutter.Actor.get_preferred_width() will return the fixed width if one
             // is set, so we need to reset the width by calling set_width(-1), to forward
             // the call down to StLabel.
@@ -455,19 +437,6 @@ function enable() {
                 title.width = titleWidth;
                 title.set_position(Math.floor(titleX), Math.floor(titleY));
             }
-
-            let borderX = cloneX - this.borderSize;
-            let borderY = cloneY - this.borderSize;
-            let borderWidth = cloneWidth + 2 * this.borderSize;
-            let borderHeight = cloneHeight + 2 * this.borderSize;
-
-            if (animate) {
-                this._animateOverlayActor(this.border, borderX, borderY,
-                                          borderWidth, borderHeight);
-            } else {
-                this.border.set_position(borderX, borderY);
-                this.border.set_size(borderWidth, borderHeight);
-            }
         };
     }
 }


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