[gnome-shell] Workspace: miscellaneuous cleanups



commit d479c936b8ee4ac58a7a5e35d7c2c22636adeed7
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Oct 19 18:38:20 2012 +0200

    Workspace: miscellaneuous cleanups
    
    Use a single GSettings object for all layout changes of window overlays,
    and avoid quadratic behavior for window positioning.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=650843

 js/ui/workspace.js |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index ef7c9d6..7ae9200 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -445,6 +445,8 @@ const WindowOverlay = new Lang.Class({
         this._parentActor = parentActor;
         this._hidden = false;
 
+        this._settings = new Gio.Settings({ schema: BUTTON_LAYOUT_SCHEMA });
+
         this.borderSize = 0;
         this.border = new St.Bin({ style_class: 'window-clone-border' });
 
@@ -554,8 +556,7 @@ const WindowOverlay = new Lang.Class({
         let button = this.closeButton;
         let title = this.title;
 
-        let settings = new Gio.Settings({ schema: BUTTON_LAYOUT_SCHEMA });
-        let layout = settings.get_string(BUTTON_LAYOUT_KEY);
+        let layout = this._settings.get_string(BUTTON_LAYOUT_KEY);
         let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
 
         let split = layout.split(":");
@@ -1184,8 +1185,8 @@ const Workspace = new Lang.Class({
             let slot = slots[i];
             let clone = clones[i];
             let metaWindow = clone.metaWindow;
-            let mainIndex = this._lookupIndex(metaWindow);
-            let overlay = this._windowOverlays[mainIndex];
+            let overlay = clone.overlay;
+            clone.slotId = i;
 
             // Positioning a window currently being dragged must be avoided;
             // we'll just leave a blank spot in the layout for it.
@@ -1569,6 +1570,7 @@ const Workspace = new Lang.Class({
     _addWindowClone : function(win) {
         let clone = new WindowClone(win, this);
         let overlay = new WindowOverlay(clone, this._windowOverlaysGroup);
+        clone.overlay = overlay;
 
         clone.connect('selected',
                       Lang.bind(this, this._onCloneSelected));



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