🔧 Do not try to fix #49 on GS 3.36

This commit is contained in:
Simon Schneegans
2022-01-17 21:23:03 +01:00
parent 0c0547f4dd
commit c21313dd34
+20 -14
View File
@@ -13,17 +13,17 @@
'use strict';
const {Clutter, Gio, Meta} = imports.gi;
const Workspace = imports.ui.workspace.Workspace;
const WindowManager = imports.ui.windowManager.WindowManager;
const WindowPreview = imports.ui.windowPreview.WindowPreview;
const WINDOW_REPOSITIONING_DELAY = imports.ui.workspace.WINDOW_REPOSITIONING_DELAY;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const utils = Me.imports.src.utils;
const {Clutter, Gio, Meta} = imports.gi;
const Workspace = imports.ui.workspace.Workspace;
const WindowManager = imports.ui.windowManager.WindowManager;
const WindowPreview =
utils.shellVersionIsAtLeast(3, 38) ? imports.ui.windowPreview.WindowPreview : null;
// New effects must be registered here and in prefs.js.
const ALL_EFFECTS = [
Me.imports.src.EnergizeA.EnergizeA,
@@ -65,7 +65,6 @@ class Extension {
this._origDoRemoveWindow = Workspace.prototype._doRemoveWindow;
this._origAddWindowClone = Workspace.prototype._addWindowClone;
this._origShouldAnimateActor = WindowManager.prototype._shouldAnimateActor;
this._origDeleteAll = WindowPreview.prototype._deleteAll;
// We will use extensionThis to refer to the extension inside the patched methods of
// the WorkspacesView.
@@ -73,11 +72,15 @@ class Extension {
// Do not attempt to close windows twice. Due to the animation in the overview, the
// close button can be clicked twice which normally would lead to a crash.
WindowPreview.prototype._deleteAll = function() {
if (!this._closeRequested) {
extensionThis._origDeleteAll.apply(this);
}
};
if (WindowPreview) {
this._origDeleteAll = WindowPreview.prototype._deleteAll;
WindowPreview.prototype._deleteAll = function() {
if (!this._closeRequested) {
extensionThis._origDeleteAll.apply(this);
}
};
}
// On GNOME 3.36, the window clone's 'destroy' handler only calls _removeWindowClone
// but not _doRemoveWindow. The latter is required to trigger the repositioning of the
@@ -196,7 +199,10 @@ class Extension {
Workspace.prototype._doRemoveWindow = this._origDoRemoveWindow;
Workspace.prototype._addWindowClone = this._origAddWindowClone;
WindowManager.prototype._shouldAnimateActor = this._origShouldAnimateActor;
WindowPreview.prototype._deleteAll = this._origDeleteAll;
if (WindowPreview) {
WindowPreview.prototype._deleteAll = this._origDeleteAll;
}
this._settings = null;
}