compositor: Handle skipped transition in visual bell

Implicit transitions may be skipped, for example when the actor
isn't currently mapped.

Failing to check for that case not only results in a couple of
warnings, it also means that the "flash" actor is never destroyed,
and the window remains darkened.

Close: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7760
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3872>
This commit is contained in:
Florian Müllner 2024-07-05 00:20:23 +02:00 committed by Marge Bot
parent b56332cb24
commit 906920cb33

View File

@ -1382,15 +1382,21 @@ meta_compositor_flash_window (MetaCompositor *compositor,
clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD); clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD);
clutter_actor_set_easing_duration (flash, FLASH_TIME_MS); clutter_actor_set_easing_duration (flash, FLASH_TIME_MS);
clutter_actor_set_opacity (flash, 192); clutter_actor_set_opacity (flash, 192);
clutter_actor_restore_easing_state (flash);
transition = clutter_actor_get_transition (flash, "opacity"); transition = clutter_actor_get_transition (flash, "opacity");
clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE); if (transition)
clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2); {
clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE);
clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2);
g_signal_connect (transition, "stopped", g_signal_connect (transition, "stopped",
G_CALLBACK (window_flash_out_completed), flash); G_CALLBACK (window_flash_out_completed), flash);
}
clutter_actor_restore_easing_state (flash); else /* implicit transition was skipped, likely because the window is hidden */
{
clutter_actor_destroy (flash);
}
} }
/** /**