diff --git a/sway/desktop/output.c b/sway/desktop/output.c index ff9a6ed6..8c42ccca 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -522,10 +522,6 @@ static bool scan_out_fullscreen_view(struct sway_output *output, } static void containers_tick_alpha(list_t *containers, struct sway_output *output) { - if (config->animation_duration == 0) { - return; - } - float alpha_step; struct sway_container *con = NULL; for (int i = 0; i < containers->length; ++i) { @@ -536,8 +532,13 @@ static void containers_tick_alpha(list_t *containers, struct sway_output *output if (con->alpha == con->target_alpha) { continue; } + if (config->animation_duration == 0) { + con->alpha = con->target_alpha; + continue; + } alpha_step = (con->max_alpha * output->refresh_sec) / config->animation_duration; - con->alpha = con->alpha < con->target_alpha ? MIN(con->alpha + alpha_step, con->target_alpha) : MAX(con->alpha - alpha_step, con->target_alpha); + con->alpha = con->alpha < con->target_alpha ? MIN(con->alpha + alpha_step, con->target_alpha) + : MAX(con->alpha - alpha_step, con->target_alpha); output_damage_whole_container(output, con); } }