🪲 Fix dialog handling

This commit is contained in:
Simon Schneegans
2022-01-23 13:44:19 +01:00
parent 0f9103d1f0
commit 3c046bd2ef
+16 -4
View File
@@ -81,6 +81,14 @@ class Extension {
this._origWindowTime = imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME; this._origWindowTime = imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME;
this._origDialogTime = imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME; this._origDialogTime = imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME;
// Reset the dialog destroy time if the corresponding setting gets disabled.
this._settings.connect('changed::destroy-dialogs', () => {
if (!this._settings.get_boolean('destroy-dialogs')) {
imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME =
this._origDialogTime;
}
});
// We will use extensionThis to refer to the extension inside the patched methods of // We will use extensionThis to refer to the extension inside the patched methods of
// the WorkspacesView. // the WorkspacesView.
const extensionThis = this; const extensionThis = this;
@@ -207,19 +215,23 @@ class Extension {
} }
// We do nothing if a dialog got closed and we should not burn them. // We do nothing if a dialog got closed and we should not burn them.
const shouldDestroyDialogs = this._settings.get_boolean('destroy-dialogs');
const isDialogWindow = const isDialogWindow =
actor.meta_window.window_type == Meta.WindowType.MODAL_DIALOG || actor.meta_window.window_type == Meta.WindowType.MODAL_DIALOG ||
actor.meta_window.window_type == Meta.WindowType.DIALOG; actor.meta_window.window_type == Meta.WindowType.DIALOG;
if (!this._settings.get_boolean('destroy-dialogs') && isDialogWindow) { // If an effect is to be previewed, we have to affect dialogs es well. This is
// because the preview window is a dialog window...
const previewNick = this._settings.get_string('close-preview-effect');
if (isDialogWindow && !shouldDestroyDialogs && previewNick == '') {
return; return;
} }
// Now we have to choose an effect. // Now we have to choose an effect.
this._effect = null; this._effect = null;
// First we check if an effect is to be previewd. // First we check if an effect is to be previewed.
const previewNick = this._settings.get_string('close-preview-effect');
if (previewNick != '') { if (previewNick != '') {
this._effect = ALL_EFFECTS.find(Effect => { this._effect = ALL_EFFECTS.find(Effect => {
return Effect.getNick() == previewNick; return Effect.getNick() == previewNick;
@@ -274,7 +286,7 @@ class Extension {
// We set the currently used time here, so that others can get an idea how long this // We set the currently used time here, so that others can get an idea how long this
// will take... // will take...
const duration = transition.get_duration(); const duration = transition.get_duration();
if (isDialogWindow) { if (isDialogWindow && shouldDestroyDialogs) {
imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME = duration; imports.ui.windowManager.DIALOG_DESTROY_WINDOW_ANIMATION_TIME = duration;
} else { } else {
imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = duration; imports.ui.windowManager.DESTROY_WINDOW_ANIMATION_TIME = duration;