From 430def6e39315b6cee807aba3e4126134b93b164 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Fri, 15 Mar 2024 00:21:01 +0100 Subject: Fix layout animation and animation handler --- src/connect.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/connect.c') diff --git a/src/connect.c b/src/connect.c index 71552da..f6c439b 100644 --- a/src/connect.c +++ b/src/connect.c @@ -93,20 +93,24 @@ static void button_action(State *state, const char *event, int x, int y) layout->x, layout->y, layout->width, layout->height); if (in_capsule(x, y, layout->x, layout->y, layout->width, layout->height)) { - log_debug("Triggering action for button"); - ButtonAction action = button_simple_get_action(layout->btn); + Button *btn = layout->btn; + ButtonAction action = button_simple_get_action(btn); + + // TODO: Button labels + log_debug("Triggering action for button [button=%p]", btn); if (action != NULL) { - Animation *shine = animation_shine_create(300 * G_TIME_SPAN_MILLISECOND); + // NOTE: Animations may change layout! + //Animation *anim = animation_shine_create(300 * G_TIME_SPAN_MILLISECOND); + Animation *anim = animation_pulse_create(1000 * G_TIME_SPAN_MILLISECOND); - if (button_set_animation(layout->btn, shine)) + if (button_set_animation(btn, anim)) state_request_animation(state); else - animation_destroy(shine); + animation_destroy(anim); - action(layout->btn); + action(btn); } - return; } } else { -- cgit v1.2.3