Skip to content

Commit

Permalink
Fix window peek issue on 3.36.1
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesg99 committed Apr 29, 2020
1 parent f1db6e3 commit 468b535
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 5 additions & 4 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,12 @@ var activateSiblingWindow = function(windows, direction, startWindow) {
};

var animateWindowOpacity = function(window, tweenOpts) {
//there currently is a mutter bug with the windowactor opacity, starting with 3.34
//there is a mutter bug with the windowactor opacity, starting with 3.34 and ending with 3.36.1
//https://gitlab.gnome.org/GNOME/mutter/issues/836
let shellVersion = Config.PACKAGE_VERSION;

if (Config.PACKAGE_VERSION > '3.35') {
//on 3.36, a workaround is to use the windowactor's child for the fade animation
if (shellVersion > '3.35' && shellVersion < '3.36.1') {
//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;
Expand All @@ -442,7 +443,7 @@ var animateWindowOpacity = function(window, tweenOpts) {

window = windowActor.get_first_child() || windowActor;
tweenOpts.onComplete = () => windowActor.visible = visible;
} else if (Config.PACKAGE_VERSION > '3.33') {
} else if (shellVersion > '3.33' && shellVersion < '3.35') {
//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);
Expand Down
10 changes: 7 additions & 3 deletions windowPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,15 +626,16 @@ var PreviewMenu = Utils.defineClass({

_switchToWorkspaceImmediate: function(workspaceIndex) {
let workspace = Utils.getWorkspaceByIndex(workspaceIndex);
let shouldAnimate = Main.wm._shouldAnimate;

if (!workspace || (!workspace.list_windows().length &&
workspaceIndex < Utils.getWorkspaceCount() -1)) {
workspace = Utils.getCurrentWorkspace();
}

Main.wm._blockAnimations = true;
Main.wm._shouldAnimate = () => false;
workspace.activate(global.display.get_current_time_roundtrip());
Main.wm._blockAnimations = false;
Main.wm._shouldAnimate = shouldAnimate;
},

_focusMetaWindow: function(dimOpacity, window) {
Expand Down Expand Up @@ -801,7 +802,10 @@ var Preview = Utils.defineClass({
} else if (!this._waitWindowId) {
this._waitWindowId = Mainloop.idle_add(() => {
this._waitWindowId = 0;
_assignWindowClone();

if (this._previewMenu.opened) {
_assignWindowClone();
}
});
}
};
Expand Down

0 comments on commit 468b535

Please sign in to comment.