altTab: Switch to MetaWindowContent

This commit is contained in:
Georges Basile Stavracas Neto 2019-10-17 08:42:37 +02:00
parent 628b34e96f
commit d6345a5c8b

View File

@ -28,14 +28,20 @@ var AppIconMode = {
function _createWindowClone(window, size) { function _createWindowClone(window, size) {
let [width, height] = window.get_size(); let [width, height] = window.get_size();
let scale = Math.min(1.0, size / width, size / height); let scale = Math.min(1.0, size / width, size / height);
return new Clutter.Clone({ source: window,
width: width * scale, let cloneWidth = size;
height: height * scale, let cloneHeight = size;
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.CENTER, if (width > height)
// usual hack for the usual bug in ClutterBinLayout... cloneHeight = size * (height / width);
x_expand: true, else
y_expand: true }); cloneWidth = size * (width / height);
return new Clutter.Actor({
content: window.content,
width: cloneWidth,
height: cloneHeight,
});
} }
function getWindows(workspace) { function getWindows(workspace) {
@ -411,7 +417,7 @@ class CyclerHighlight extends St.Widget {
super._init({ layout_manager: new Clutter.BinLayout() }); super._init({ layout_manager: new Clutter.BinLayout() });
this._window = null; this._window = null;
this._clone = new Clutter.Clone(); this._clone = new Clutter.Actor();
this.add_actor(this._clone); this.add_actor(this._clone);
this._highlight = new St.Widget({ style_class: 'cycler-highlight' }); this._highlight = new St.Widget({ style_class: 'cycler-highlight' });
@ -433,8 +439,8 @@ class CyclerHighlight extends St.Widget {
this._window = w; this._window = w;
if (this._clone.source) if (this._clone.content)
this._clone.source.sync_visibility(); this._clone.content.window_actor.sync_visibility();
let windowActor = this._window let windowActor = this._window
? this._window.get_compositor_private() : null; ? this._window.get_compositor_private() : null;
@ -442,7 +448,7 @@ class CyclerHighlight extends St.Widget {
if (windowActor) if (windowActor)
windowActor.hide(); windowActor.hide();
this._clone.source = windowActor; this._clone.content = windowActor.content;
} }
_onAllocationChanged() { _onAllocationChanged() {