From 545040ed3f023b2d0432acfa4b650f50e7fc3a32 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 11 Aug 2024 12:02:32 +0100 Subject: [PATCH] animation: fix interrupting animation makes it stuck for one frame Signed-off-by: Yuxuan Shui --- src/wm/win.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wm/win.c b/src/wm/win.c index ae455b87f3..b14db0087e 100644 --- a/src/wm/win.c +++ b/src/wm/win.c @@ -1933,6 +1933,10 @@ bool win_process_animation_and_state_change(struct session *ps, struct win *w, d auto new_animation = script_instance_new(wopts.animations[trigger].script); if (w->running_animation_instance) { + // Interrupt the old animation and start the new animation from where the + // old has left off. Note we still need to advance the old animation for + // the last interval. + win_advance_animation(w, delta_t, &win_ctx); if (geometry_changed) { // If the window has moved, we need to adjust scripts // outputs so that the window will stay in the same position and