From 8bf10edbe929378a3019271bfd26346639692e0b 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 6d86c8f9..487e9b9a 100644 --- a/src/wm/win.c +++ b/src/wm/win.c @@ -1939,6 +1939,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