[gnome-shell] workspace: Use a better algorithm for computing individual thumbnail scale



commit ef69c228fd0312a99e99b6efda281d6dfe6ceb0d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Oct 26 11:43:38 2012 -0400

    workspace: Use a better algorithm for computing individual thumbnail scale
    
    The one we had before could make unmaximized windows appear to be bigger
    than maximized ones, for a few reasons. Ensure that this doesn't happen
    again, and add some comments to explain the whys and needs for twiddling
    the individual thumbnail size.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686944

 js/ui/workspace.js |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 3fd25bb..acffa26 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -777,16 +777,19 @@ const LayoutStrategy = new Lang.Class({
     // Computes and returns a fancy scale for @window using the
     // base scale, @scale.
     _computeWindowScale: function(window, scale) {
-        let width = window.actor.width;
-        let height = window.actor.height;
-        let ratio;
-
-        if (width > height)
-            ratio = width / this._monitor.width;
-        else
-            ratio = height / this._monitor.height;
-
-        let fancyScale = (2 / (1 + ratio)) * scale;
+        // Since we align windows next to each other, the height of the
+        // thumbnails is much more important to preserve than the width of
+        // them, so two windows with equal height, but maybe differering
+        // widths line up.
+        let ratio = window.actor.height / this._monitor.height;
+
+        // The purpose of this manipulation here is to prevent windows
+        // from getting too small. For something like a calculator window,
+        // we need to bump up the size just a bit to make sure it looks
+        // good. We'll use a multiplier of 1.5 for this.
+
+        // Map from [0, 1] to [1.5, 1]
+        let fancyScale = _interpolate(1.5, 1, ratio) * scale;
         return fancyScale;
     },
 



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