diff options
| author | Federico Angelilli <code@fedang.net> | 2024-03-15 00:21:01 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-03-15 00:21:18 +0100 |
| commit | 430def6e39315b6cee807aba3e4126134b93b164 (patch) | |
| tree | e400668cb1890c1f338655bd57994dbdbc8ab7cc /src/state.c | |
| parent | 5765bea99e1d497063ab312d879390b0dd3d2efd (diff) | |
Fix layout animation and animation handler
Diffstat (limited to 'src/state.c')
| -rw-r--r-- | src/state.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/state.c b/src/state.c index 0f17695..f35faa2 100644 --- a/src/state.c +++ b/src/state.c @@ -67,7 +67,16 @@ void state_request_redraw(State *state, bool relayout) static gboolean anim_handler(State *state) { - //log_debug("Animating [relayout=%d]", state->relayout); + bool anim = false; + for (GList *it = state->btns; it != NULL; it = it->next) { + Button *btn = it->data; + if (btn->anim != NULL) { + anim = true; + state->relayout |= btn->anim->layout_func != NULL; + } + } + + log_debug("Animating [relayout=%d]", state->relayout); if (state->relayout) { draw_compute_layout(state->draw, state->win, state->btns); @@ -75,12 +84,7 @@ static gboolean anim_handler(State *state) } draw_paint(state->draw, state->win); - - for (GList *it = state->btns; it != NULL; it = it->next) { - Button *btn = it->data; - if (btn->anim != NULL) - return G_SOURCE_CONTINUE; - } + if (anim) return G_SOURCE_CONTINUE; state->anim_id = 0; return G_SOURCE_REMOVE; |
