aboutsummaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-03-15 00:21:01 +0100
committerFederico Angelilli <code@fedang.net>2024-03-15 00:21:18 +0100
commit430def6e39315b6cee807aba3e4126134b93b164 (patch)
treee400668cb1890c1f338655bd57994dbdbc8ab7cc /src/state.c
parent5765bea99e1d497063ab312d879390b0dd3d2efd (diff)
Fix layout animation and animation handler
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c18
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;