[gnome-shell] altTab: Factor out thumbnail creation



commit 525d3c26198142d21fee3c3a83c004242e471a7a
Author: Florian MÃllner <fmuellner gnome org>
Date:   Tue Dec 4 16:26:00 2012 +0100

    altTab: Factor out thumbnail creation
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688913

 js/ui/altTab.js |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index e605fd6..83b1d3c 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -20,6 +20,20 @@ const THUMBNAIL_FADE_TIME = 0.1; // seconds
 
 const iconSizes = [96, 64, 48, 32, 22];
 
+function _createWindowClone(window, size) {
+    let windowTexture = window.get_texture();
+    let [width, height] = windowTexture.get_size();
+    let scale = Math.min(1.0, size / width, size / height);
+    return new Clutter.Clone({ source: windowTexture,
+                               width: width * scale,
+                               height: height * scale,
+                               x_align: Clutter.ActorAlign.CENTER,
+                               y_align: Clutter.ActorAlign.CENTER,
+                               // usual hack for the usual bug in ClutterBinLayout...
+                               x_expand: true,
+                               y_expand: true });
+};
+
 const AppSwitcherPopup = new Lang.Class({
     Name: 'AppSwitcherPopup',
     Extends: SwitcherPopup.SwitcherPopup,
@@ -621,14 +635,7 @@ const ThumbnailList = new Lang.Class({
             if (!mutterWindow)
                 continue;
 
-            let windowTexture = mutterWindow.get_texture ();
-            let [width, height] = windowTexture.get_size();
-            let scale = Math.min(1.0, THUMBNAIL_DEFAULT_SIZE / width, availHeight / height);
-            let clone = new Clutter.Clone ({ source: windowTexture,
-                                                reactive: true,
-                                                width: width * scale,
-                                                height: height * scale });
-
+            let clone = _createWindowClone(mutterWindow, THUMBNAIL_DEFAULT_SIZE);
             this._thumbnailBins[i].set_height(binHeight);
             this._thumbnailBins[i].add_actor(clone);
             this._clones.push(clone);



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