summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Dreßler <verdre@v0yd.nl>2022-06-30 09:40:51 +0200
committerFlorian Müllner <fmuellner@gnome.org>2022-07-02 03:00:35 +0200
commitcaa99d52c64e81a8abde039de312d6915efddc87 (patch)
tree85ee680da76a24c6e3a26316f0d4bfeb4084ba40
parentb4b9b96b95f1ce0973948fa0a80008e21d331787 (diff)
downloadgnome-shell-caa99d52c64e81a8abde039de312d6915efddc87.tar.gz
windowManager: Handle window dimming animation getting cancelled
When a window with a modal dialog gets minimized and at the same time the dialog is closed, the WindowDimmer undim animation starts and gets cancelled when the minimize animation is done, because that unmaps the window actor. In this case we want ensure the dimming effect still goes into a proper state instead of being stuck mid-animation, so listen to onStopped instead of onComplete for syncing state of the window dimmer. While at it, clean things up a little and move the check for the attach-modal-dialogs pref inside the _syncEnabled() function. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5581 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2349> (cherry picked from commit 4fd2719dc53ba77a0d85fe1ed569634f8bcd88fe)
-rw-r--r--js/ui/windowManager.js19
1 files changed, 5 insertions, 14 deletions
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 625cbafdc..b97ebc9cd 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -130,19 +130,13 @@ class WindowDimmer extends Clutter.BrightnessContrastEffect {
name: WINDOW_DIMMER_EFFECT_NAME,
enabled: false,
});
- this._enabled = true;
}
- _syncEnabled() {
+ _syncEnabled(dimmed) {
let transitionName = '@effects.%s.brightness'.format(this.name);
let animating = this.actor.get_transition(transitionName) != null;
- let dimmed = this.brightness.red != 127;
- this.enabled = this._enabled && (animating || dimmed);
- }
- setEnabled(enabled) {
- this._enabled = enabled;
- this._syncEnabled();
+ this.enabled = Meta.prefs_get_attach_modal_dialogs() && (animating || dimmed);
}
setDimmed(dimmed, animate) {
@@ -153,20 +147,17 @@ class WindowDimmer extends Clutter.BrightnessContrastEffect {
this.actor.ease_property(transitionName, color, {
mode: Clutter.AnimationMode.LINEAR,
duration: (dimmed ? DIM_TIME : UNDIM_TIME) * (animate ? 1 : 0),
- onComplete: () => this._syncEnabled(),
+ onStopped: () => this._syncEnabled(dimmed),
});
- this._syncEnabled();
+ this._syncEnabled(dimmed);
}
});
function getWindowDimmer(actor) {
- let enabled = Meta.prefs_get_attach_modal_dialogs();
let effect = actor.get_effect(WINDOW_DIMMER_EFFECT_NAME);
- if (effect) {
- effect.setEnabled(enabled);
- } else if (enabled) {
+ if (!effect) {
effect = new WindowDimmer();
actor.add_effect(effect);
}