diff options
author | Pete Johanson <peter@peterjohanson.com> | 2021-01-19 14:21:00 -0500 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2021-01-20 07:06:11 -0500 |
commit | 3368a81057d4981aa259c5548050d95739d99d51 (patch) | |
tree | a2feaed6f49eb25949a64c9c3cafe574f43fe23d /app/src/behaviors/behavior_sticky_key.c | |
parent | 3fe2acc2d191006fa6309191ee99b2e4e249ed08 (diff) |
refactor(core): Combine `is_` and `cast_` event functions.
* Use a single `as_foo` generated function to conditionally
return a certain event type from a generic `zmk_event_t*`
pointer.
Diffstat (limited to 'app/src/behaviors/behavior_sticky_key.c')
-rw-r--r-- | app/src/behaviors/behavior_sticky_key.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index ee33d38..fe05e06 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -176,10 +176,10 @@ static const struct behavior_driver_api behavior_sticky_key_driver_api = { }; static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh) { - if (!is_zmk_keycode_state_changed(eh)) { + struct zmk_keycode_state_changed *ev = as_zmk_keycode_state_changed(eh); + if (ev == NULL) { return ZMK_EV_EVENT_BUBBLE; } - struct zmk_keycode_state_changed *ev = cast_zmk_keycode_state_changed(eh); for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) { struct active_sticky_key *sticky_key = &active_sticky_keys[i]; if (sticky_key->position == ZMK_BHV_STICKY_KEY_POSITION_FREE) { |