diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index 920f6f2b..fb2bfffb 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -40,9 +40,9 @@ struct active_sticky_key { const struct behavior_sticky_key_config *config; // timer data. bool timer_started; + bool timer_cancelled; int64_t release_at; struct k_delayed_work release_timer; - bool timer_is_cancelled; // usage page and keycode for the key that is being modified by this sticky key uint8_t modified_key_usage_page; uint32_t modified_key_keycode; @@ -55,7 +55,7 @@ static struct active_sticky_key *store_sticky_key(uint32_t position, uint32_t pa const struct behavior_sticky_key_config *config) { for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) { if (active_sticky_keys[i].position != ZMK_BHV_STICKY_KEY_POSITION_NOT_USED || - active_sticky_keys[i].timer_is_cancelled) { + active_sticky_keys[i].timer_cancelled) { continue; } active_sticky_keys[i].position = position; @@ -63,7 +63,7 @@ static struct active_sticky_key *store_sticky_key(uint32_t position, uint32_t pa active_sticky_keys[i].param2 = param2; active_sticky_keys[i].config = config; active_sticky_keys[i].release_at = 0; - active_sticky_keys[i].timer_is_cancelled = false; + active_sticky_keys[i].timer_cancelled = false; active_sticky_keys[i].timer_started = false; active_sticky_keys[i].modified_key_usage_page = 0; active_sticky_keys[i].modified_key_keycode = 0; @@ -78,8 +78,7 @@ static void clear_sticky_key(struct active_sticky_key *sticky_key) { static struct active_sticky_key *find_sticky_key(uint32_t position) { for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) { - if (active_sticky_keys[i].position == position && - !active_sticky_keys[i].timer_is_cancelled) { + if (active_sticky_keys[i].position == position && !active_sticky_keys[i].timer_cancelled) { return &active_sticky_keys[i]; } } @@ -120,7 +119,7 @@ static int stop_timer(struct active_sticky_key *sticky_key) { int timer_cancel_result = k_delayed_work_cancel(&sticky_key->release_timer); if (timer_cancel_result == -EINPROGRESS) { // too late to cancel, we'll let the timer handler clear up. - sticky_key->timer_is_cancelled = true; + sticky_key->timer_cancelled = true; } return timer_cancel_result; } @@ -235,8 +234,8 @@ void behavior_sticky_key_timer_handler(struct k_work *item) { if (sticky_key->position == ZMK_BHV_STICKY_KEY_POSITION_NOT_USED) { return; } - if (sticky_key->timer_is_cancelled) { - sticky_key->timer_is_cancelled = false; + if (sticky_key->timer_cancelled) { + sticky_key->timer_cancelled = false; } else { release_sticky_key_behavior(sticky_key, sticky_key->release_at); }