diff options
| author | Federico Angelilli <code@fedang.net> | 2024-03-16 16:03:21 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-03-16 16:03:21 +0100 |
| commit | 115a2b5d2fb0b8b4950c6daa897fbe012b9204b2 (patch) | |
| tree | 2d9c7bb94dd006b750805fe742365e20a271016b /src/state.c | |
| parent | 40ca9598d269c9b6f162e80b5293f83ec37bb75d (diff) | |
Split animation paint_func
Diffstat (limited to 'src/state.c')
| -rw-r--r-- | src/state.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/state.c b/src/state.c index 880c8ff..7748e58 100644 --- a/src/state.c +++ b/src/state.c @@ -72,16 +72,16 @@ static bool anim_check_more(State *state, GList *btns) Button *btn = it->data; if (btn->anim != NULL) { - bool draw = btn->anim->paint_func != NULL; bool layout = btn->anim->layout_func != NULL; + bool before = btn->anim->before_func != NULL; + bool after = btn->anim->after_func != NULL; - // Remove animation if both paint_func and layout_func finished - if (!draw && !layout) { + // Remove animation if all functions finished + if (!layout && !before && !after) { log_debug("Removing animation [type=%d, end=%ld, button=%p]", btn->anim->type, btn->anim->start + btn->anim->duration, btn); - animation_destroy(btn->anim); - btn->anim = NULL; + g_clear_pointer(&btn->anim, animation_destroy); } else { more = true; state->relayout |= layout; @@ -110,6 +110,9 @@ static gboolean anim_handler(State *state) return more; } +// FIXME: When spamming animations there seem to be occasional +// race condition that block animations from playing +// (the animation timeout eagerly quits) void state_request_animation(State *state) { if (state->idle_id != 0) { |
