🔀 Merge pull request #51 from Schneegans/feature/fryfix_49

This commit is contained in:
Simon Schneegans
2022-01-17 21:34:00 +01:00
committed by GitHub
+26 -3
View File
@@ -15,9 +15,16 @@
const {Clutter, Gio, Meta} = imports.gi;
const Workspace = imports.ui.workspace.Workspace;
const WindowManager = imports.ui.windowManager.WindowManager;
const WINDOW_REPOSITIONING_DELAY = imports.ui.workspace.WINDOW_REPOSITIONING_DELAY;
const Workspace = imports.ui.workspace.Workspace;
const WindowManager = imports.ui.windowManager.WindowManager;
// The WindowPreview class is only available on GNOME Shell 3.38+;
let WindowPreview = null;
try {
WindowPreview = imports.ui.windowPreview.WindowPreview;
} catch (error) {
// Nothing to be done, we are on GNOME Shell 3.36.
}
const ExtensionUtils = imports.misc.extensionUtils;
const Me = imports.misc.extensionUtils.getCurrentExtension();
@@ -69,6 +76,18 @@ class Extension {
// the WorkspacesView.
const extensionThis = this;
// 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.
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
// overview window layout. Therefore we call this method in addition.
@@ -187,6 +206,10 @@ class Extension {
Workspace.prototype._addWindowClone = this._origAddWindowClone;
WindowManager.prototype._shouldAnimateActor = this._origShouldAnimateActor;
if (WindowPreview) {
WindowPreview.prototype._deleteAll = this._origDeleteAll;
}
this._settings = null;
}