diff options
| author | Federico Angelilli <code@fedang.net> | 2023-11-26 20:18:08 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2023-11-26 20:18:08 +0100 |
| commit | 00bd74159e2f7d209a10d11e8cbecb894c3d0ef0 (patch) | |
| tree | 01ea73f9635c282ec8b0fcb4c5e775448dda9502 /src/connect.c | |
| parent | f9ec9bb88ae2b1423d30da21c76a7e131cb383cc (diff) | |
Generalize button struct
Diffstat (limited to 'src/connect.c')
| -rw-r--r-- | src/connect.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/connect.c b/src/connect.c index 12038a4..24f6463 100644 --- a/src/connect.c +++ b/src/connect.c @@ -88,15 +88,19 @@ static void button_action(State *state, const char *event, int x, int y) if (layout->x + layout->width < x) continue; if (layout->x > x) break; - log_debug("Button layout [x=%d, y=%d, w=%d, h=%d]", - 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"); - if (layout->btn->action != NULL) { - layout->btn->action(layout->btn); + if (layout->btn->simple) { + log_debug("Button layout [x=%d, y=%d, w=%d, h=%d]", + 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); + if (action != NULL) action(layout->btn); + return; } - return; + } else { + log_debug("Button group layout [x=%d, y=%d, w=%d, h=%d]", + layout->x, layout->y, layout->width, layout->height); } } |
