aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/state.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/state.c b/src/state.c
index d9ecaeb..d0e2e12 100644
--- a/src/state.c
+++ b/src/state.c
@@ -65,10 +65,10 @@ void state_request_redraw(State *state, bool relayout)
state->idle_id = g_idle_add(G_SOURCE_FUNC(redraw_handler), state);
}
-static gboolean anim_handler(State *state)
+static bool anim_check_more(State *state, GList *btns)
{
- bool done = true;
- for (GList *it = state->btns; it != NULL; it = it->next) {
+ bool more = false;
+ for (GList *it = btns; it; it = it->next) {
Button *btn = it->data;
if (btn->anim != NULL) {
@@ -78,18 +78,26 @@ static gboolean anim_handler(State *state)
// Remove animation if both paint_func and layout_func finished
if (!draw && !layout) {
log_debug("Removing animation [type=%d, end=%ld, button=%p]",
- btn->anim->type, btn->anim->start + btn->anim->duration, btn);
+ btn->anim->type, btn->anim->start + btn->anim->duration, btn);
animation_destroy(btn->anim);
btn->anim = NULL;
} else {
- done = false;
+ more = true;
state->relayout |= layout;
}
}
+
+ if (!btn->simple && anim_check_more(state, CAST(btn, ButtonGroup)->children))
+ more = true;
}
+ return more;
+}
- log_debug("Redrawing animation [relayout=%d, done=%d]", state->relayout, done);
+static gboolean anim_handler(State *state)
+{
+ bool more = anim_check_more(state, state->btns);
+ log_debug("Redrawing animation [relayout=%d, more=%d]", state->relayout, more);
if (state->relayout) {
draw_compute_layout(state->draw, state->win, state->btns);
@@ -98,8 +106,8 @@ static gboolean anim_handler(State *state)
draw_paint(state->draw, state->win);
- if (done) state->anim_id = 0;
- return !done;
+ if (!more) state->anim_id = 0;
+ return more;
}
void state_request_animation(State *state)