[gnome-shell] [Overview] Base minimum motion on actors



commit 499c5737da0856126078b01b94dcc490861fd80d
Author: Florian Müllner <fmuellner src gnome org>
Date:   Fri Feb 26 16:45:05 2010 +0100

    [Overview] Base minimum motion on actors
    
    When figuring out where to position window previews, use the clone's
    position instead of the the original meta window. There shouldn't be
    a difference when entering the overview, but it makes the motion when
    opening/closing new windows in the overview tinier and more predictable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=611167

 js/ui/workspace.js |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 20da931..c54adf6 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -855,7 +855,7 @@ Workspace.prototype = {
 
     /**
      * _computeWindowMotion:
-     * @metaWindow: A #MetaWindow
+     * @actor: A #WindowClone's #ClutterActor
      * @slot: An element of #POSITIONS
      * @slotGeometry: Layout of @slot
      *
@@ -864,15 +864,15 @@ Workspace.prototype = {
      * Currently this is the square of the distance between the
      * centers.
      */
-    _computeWindowMotion: function (metaWindow, slot) {
-        let rect = new Meta.Rectangle();
-        metaWindow.get_outer_rect(rect);
-
+    _computeWindowMotion: function (actor, slot) {
         let [xCenter, yCenter, fraction] = slot;
         let xDelta, yDelta, distanceSquared;
+        let actorWidth, actorHeight;
 
-        xDelta = rect.x + rect.width / 2.0 - xCenter * global.screen_width;
-        yDelta = rect.y + rect.height / 2.0 - yCenter * global.screen_height;
+        actorWidth = actor.width * actor.scale_x;
+        actorHeight = actor.height * actor.scale_y;
+        xDelta = actor.x + actorWidth / 2.0 - xCenter * global.screen_width;
+        yDelta = actor.y + actorHeight / 2.0 - yCenter * global.screen_height;
         distanceSquared = xDelta * xDelta + yDelta * yDelta;
 
         return distanceSquared;
@@ -891,10 +891,10 @@ Workspace.prototype = {
         this._forEachPermutations(clones, Lang.bind(this, function (permutation) {
             let motion = 0;
             for (let i = 0; i < permutation.length; i++) {
-                let metaWindow = permutation[i].metaWindow;
+                let cloneActor = permutation[i].actor;
                 let slot = slots[i];
 
-                let delta = this._computeWindowMotion(metaWindow, slot);
+                let delta = this._computeWindowMotion(cloneActor, slot);
 
                 motion += delta;
             }
@@ -924,8 +924,8 @@ Workspace.prototype = {
             let minimumMotionIndex = -1;
             let minimumMotion = -1;
             for (let j = 0; j < clonesCopy.length; j++) {
-                let metaWindow = clonesCopy[j].metaWindow;
-                let delta = this._computeWindowMotion(metaWindow, slot);
+                let cloneActor = clonesCopy[j].actor;
+                let delta = this._computeWindowMotion(cloneActor, slot);
                 if (minimumMotionIndex == -1 || delta < minimumMotion) {
                     minimumMotionIndex = j;
                     minimumMotion = delta;



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