Add temporary workaround for window peek on 3.34

This commit is contained in:
Charles Gagnon
2019-11-16 09:06:45 -05:00
parent 660a71d239
commit d5951b583e
3 changed files with 27 additions and 24 deletions

View File

@@ -991,22 +991,13 @@ var dtpPanel = Utils.defineClass({
},
_toggleWorkspaceWindows: function(hide, workspace) {
let toggleFunc = w => {
Tweener.addTween(w.get_compositor_private(), {
opacity: hide ? 0 : 255,
time: Me.settings.get_int('show-showdesktop-time') * .001,
transition: 'easeOutQuad'
});
let tweenOpts = {
opacity: hide ? 0 : 255,
time: Me.settings.get_int('show-showdesktop-time') * .001,
transition: 'easeOutQuad'
};
//there currently is a mutter bug with the windows opacity on 3.34, so
//until it is fixed, immediately hide the windows instead of fading them
//https://gitlab.gnome.org/GNOME/mutter/issues/836
if (Config.PACKAGE_VERSION > '3.33') {
toggleFunc = w => w.get_compositor_private().visible = !hide;
}
workspace.list_windows().forEach(toggleFunc);
workspace.list_windows().forEach(w => Utils.animateWindowOpacity(w.get_compositor_private(), tweenOpts));
},
_onShowDesktopButtonPress: function() {

View File

@@ -22,6 +22,7 @@
*/
const Clutter = imports.gi.Clutter;
const Config = imports.misc.config;
const GdkPixbuf = imports.gi.GdkPixbuf
const Gi = imports._gi;
const Gio = imports.gi.Gio;
@@ -42,7 +43,7 @@ var SCROLL_TIME = Util.SCROLL_TIME / (Util.SCROLL_TIME > 1 ? 1000 : 1);
var defineClass = function (classDef) {
let parentProto = classDef.Extends ? classDef.Extends.prototype : null;
if (imports.misc.config.PACKAGE_VERSION < '3.31.9') {
if (Config.PACKAGE_VERSION < '3.31.9') {
if (parentProto && (classDef.Extends.name || classDef.Extends.toString()).indexOf('DashToPanel.') < 0) {
classDef.callParent = function() {
let args = Array.prototype.slice.call(arguments);
@@ -287,14 +288,6 @@ var getWorkspaceCount = function() {
return DisplayWrapper.getWorkspaceManager().n_workspaces;
};
var checkIfWindowHasTransient = function(window) {
let hasTransient;
window.foreach_transient(t => !(hasTransient = true));
return hasTransient;
};
var findIndex = function(array, predicate) {
if (Array.prototype.findIndex) {
return array.findIndex(predicate);
@@ -401,6 +394,14 @@ var getMouseScrollDirection = function(event) {
return direction;
};
var checkIfWindowHasTransient = function(window) {
let hasTransient;
window.foreach_transient(t => !(hasTransient = true));
return hasTransient;
};
var activateSiblingWindow = function(windows, direction, startWindow) {
let windowIndex = windows.indexOf(global.display.focus_window);
let nextWindowIndex = windowIndex < 0 ?
@@ -418,6 +419,17 @@ var activateSiblingWindow = function(windows, direction, startWindow) {
}
};
var animateWindowOpacity = function(window, tweenOpts) {
//there currently is a mutter bug with the windows opacity on 3.34, so
//until it is fixed, immediately hide the windows instead of fading them
//https://gitlab.gnome.org/GNOME/mutter/issues/836
if (Config.PACKAGE_VERSION > '3.33') {
window.visible = (tweenOpts.opacity == 255);
} else {
Tweener.addTween(window, tweenOpts);
}
};
var notify = function(text, iconName, action, isTransient) {
let source = new MessageTray.SystemNotificationSource();
let notification = new MessageTray.Notification(source, 'Dash to Panel', text);

View File

@@ -652,7 +652,7 @@ var PreviewMenu = Utils.defineClass({
wa.show();
}
Tweener.addTween(wa, getTweenOpts({ opacity: isFocused ? 255 : dimOpacity }));
Utils.animateWindowOpacity(wa, getTweenOpts({ opacity: isFocused ? 255 : dimOpacity }));
}
});
},