From 076cbb655e082bdf4b5d79bfca8af47b9f1555fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Mon, 14 Oct 2019 16:48:30 +0200 Subject: [PATCH] Fix new window handling in gnome shell version 3.28 to 3.32 The opacity hack does not work in 3.32 and less. In fact setting opacity on `queue-redraw` can kill a windows visibility entirely for some reason. The windowactor property are fine, but the actor still doesn't show up. So lets just kludge this for compatibility :P fixes #184 --- tiling.js | 29 ++++++++++++++++++----------- utils.js | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/tiling.js b/tiling.js index db3f4d1..eb44b81 100644 --- a/tiling.js +++ b/tiling.js @@ -1758,18 +1758,22 @@ class Spaces extends Map { debug('window-created', metaWindow.title); let actor = metaWindow.get_compositor_private(); - /* HACK 3.34: Hidden actors aren't allocated if hidden, use opacity instead to fix - new window animations. + if (utils.version[1] < 34) { + animateWindow(metaWindow); + } else { + /* HACK 3.34: Hidden actors aren't allocated if hidden, use opacity + instead to fix new window animations. - The first draw will reset the opacity it seems (but not visible). So - even if we set it again in `first-frame` that is too late since that - happens _after_ mutter have drawn the frame. + The first draw will reset the opacity it seems (but not visible). + So even if we set it again in `first-frame` that is too late + since that happens _after_ mutter have drawn the frame. - So we kill visibily on the first the `queue-redraw`. - */ - signals.connectOneShot(actor, 'queue-redraw', () => { - actor.opacity = 0; - }); + So we kill visibily on the first the `queue-redraw`. + */ + signals.connectOneShot(actor, 'queue-redraw', () => { + actor.opacity = 0; + }); + } /* We need reliable `window_type`, `wm_class` et. all to handle window insertion correctly. @@ -2450,7 +2454,10 @@ function showHandler(actor) { // HACK: use opacity instead of hidden on new windows if (metaWindow.unmapped) { - actor.opacity = 0; + if (utils.version[1] < 34) + animateWindow(metaWindow); + else + actor.opacity = 0; return; } diff --git a/utils.js b/utils.js index 1235573..2178ec9 100644 --- a/utils.js +++ b/utils.js @@ -14,8 +14,8 @@ var display = global.display; var GObject = imports.gi.GObject; var registerClass; +var version = imports.misc.config.PACKAGE_VERSION.split('.').map(Number); { - let version = imports.misc.config.PACKAGE_VERSION.split('.'); if (version[0] >= 3 && version[1] > 30) { registerClass = GObject.registerClass; } else {