[gnome-shell/gbsneto/content-part2: 3/3] altTab: Switch to MetaWindowContent



commit d6345a5c8b21e6e15409e32aead47524aae14d67
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Oct 17 08:42:37 2019 +0200

    altTab: Switch to MetaWindowContent

 js/ui/altTab.js | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 2500a45d00..06ffff742a 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -28,14 +28,20 @@ var AppIconMode = {
 function _createWindowClone(window, size) {
     let [width, height] = window.get_size();
     let scale = Math.min(1.0, size / width, size / height);
-    return new Clutter.Clone({ source: window,
-                               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 });
+
+    let cloneWidth = size;
+    let cloneHeight = size;
+
+    if (width > height)
+        cloneHeight = size * (height / width);
+    else
+        cloneWidth = size * (width / height);
+
+    return new Clutter.Actor({
+        content: window.content,
+        width: cloneWidth,
+        height: cloneHeight,
+    });
 }
 
 function getWindows(workspace) {
@@ -411,7 +417,7 @@ class CyclerHighlight extends St.Widget {
         super._init({ layout_manager: new Clutter.BinLayout() });
         this._window = null;
 
-        this._clone = new Clutter.Clone();
+        this._clone = new Clutter.Actor();
         this.add_actor(this._clone);
 
         this._highlight = new St.Widget({ style_class: 'cycler-highlight' });
@@ -433,8 +439,8 @@ class CyclerHighlight extends St.Widget {
 
         this._window = w;
 
-        if (this._clone.source)
-            this._clone.source.sync_visibility();
+        if (this._clone.content)
+            this._clone.content.window_actor.sync_visibility();
 
         let windowActor = this._window
             ? this._window.get_compositor_private() : null;
@@ -442,7 +448,7 @@ class CyclerHighlight extends St.Widget {
         if (windowActor)
             windowActor.hide();
 
-        this._clone.source = windowActor;
+        this._clone.content = windowActor.content;
     }
 
     _onAllocationChanged() {


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