Animate only peeked window workspace

This commit is contained in:
Charles Gagnon
2020-04-30 00:30:52 -04:00
parent 08947f97aa
commit 36e0600df5
2 changed files with 19 additions and 13 deletions

View File

@@ -426,12 +426,11 @@ var activateSiblingWindow = function(windows, direction, startWindow) {
};
var animateWindowOpacity = function(window, tweenOpts) {
//there is a mutter bug with the windowactor opacity, starting with 3.34 and ending with 3.36.1
//there currently is a mutter bug with the windowactor opacity, starting with 3.34
//https://gitlab.gnome.org/GNOME/mutter/issues/836
let shellVersion = Config.PACKAGE_VERSION;
if (shellVersion > '3.35' && shellVersion < '3.36.1') {
//on <= 3.36, a workaround is to use the windowactor's child for the fade animation
if (Config.PACKAGE_VERSION > '3.35') {
//on 3.36, a workaround is to use the windowactor's child for the fade animation
//this leaves a "shadow" on the desktop, so the windowactor needs to be hidden
//when the animation is complete
let visible = tweenOpts.opacity > 0;
@@ -443,7 +442,7 @@ var animateWindowOpacity = function(window, tweenOpts) {
window = windowActor.get_first_child() || windowActor;
tweenOpts.onComplete = () => windowActor.visible = visible;
} else if (shellVersion > '3.33' && shellVersion < '3.35') {
} else if (Config.PACKAGE_VERSION > '3.33') {
//the workaround only works on 3.35+, so on 3.34, let's just hide the
//window without animation
return window.visible = (tweenOpts.opacity == 255);

View File

@@ -611,9 +611,10 @@ var PreviewMenu = Utils.defineClass({
this._timeoutsHandler.remove(T3);
if (this._peekedWindow) {
this._restorePeekedWindowStack();
let immediate = !stayHere && this.peekInitialWorkspaceIndex != Utils.getCurrentWorkspace().index();
this._focusMetaWindow(255);
this._restorePeekedWindowStack();
this._focusMetaWindow(255, this._peekedWindow, immediate);
this._peekedWindow = null;
if (!stayHere) {
@@ -629,7 +630,7 @@ var PreviewMenu = Utils.defineClass({
let shouldAnimate = Main.wm._shouldAnimate;
if (!workspace || (!workspace.list_windows().length &&
workspaceIndex < Utils.getWorkspaceCount() -1)) {
workspaceIndex < Utils.getWorkspaceCount() - 1)) {
workspace = Utils.getCurrentWorkspace();
}
@@ -638,16 +639,16 @@ var PreviewMenu = Utils.defineClass({
Main.wm._shouldAnimate = shouldAnimate;
},
_focusMetaWindow: function(dimOpacity, window) {
_focusMetaWindow: function(dimOpacity, window, immediate) {
if (Main.overview.visibleTarget) {
return;
}
global.get_window_actors().forEach(wa => {
let mw = wa.meta_window;
window.get_workspace().list_windows().forEach(mw => {
let wa = mw.get_compositor_private();
let isFocused = mw == window;
if (mw) {
if (wa) {
if (isFocused) {
mw[PEEK_INDEX_PROP] = wa.get_parent().get_children().indexOf(wa);
wa.get_parent().set_child_above_sibling(wa, null);
@@ -658,7 +659,13 @@ var PreviewMenu = Utils.defineClass({
}
if (!mw.minimized) {
Utils.animateWindowOpacity(wa, getTweenOpts({ opacity: isFocused ? 255 : dimOpacity }));
let tweenOpts = getTweenOpts({ opacity: isFocused ? 255 : dimOpacity });
if (immediate && !mw.is_on_all_workspaces()) {
tweenOpts.time = 0;
}
Utils.animateWindowOpacity(wa, tweenOpts);
}
}
});