|
|
@ -109,6 +109,8 @@ static inline int release_sticky_key_behavior(struct active_sticky_key *sticky_k |
|
|
|
.position = sticky_key->position, |
|
|
|
.position = sticky_key->position, |
|
|
|
.timestamp = timestamp, |
|
|
|
.timestamp = timestamp, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clear_sticky_key(sticky_key); |
|
|
|
return behavior_keymap_binding_released(&binding, event); |
|
|
|
return behavior_keymap_binding_released(&binding, event); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -149,9 +151,7 @@ static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding, |
|
|
|
|
|
|
|
|
|
|
|
if (sticky_key->modified_key_usage_page != 0 && sticky_key->modified_key_keycode != 0) { |
|
|
|
if (sticky_key->modified_key_usage_page != 0 && sticky_key->modified_key_keycode != 0) { |
|
|
|
LOG_DBG("Another key was pressed while the sticky key was pressed. Act like a normal key."); |
|
|
|
LOG_DBG("Another key was pressed while the sticky key was pressed. Act like a normal key."); |
|
|
|
int retval = release_sticky_key_behavior(sticky_key, event.timestamp); |
|
|
|
return release_sticky_key_behavior(sticky_key, event.timestamp); |
|
|
|
clear_sticky_key(sticky_key); |
|
|
|
|
|
|
|
return retval; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// No other key was pressed. Start the timer.
|
|
|
|
// No other key was pressed. Start the timer.
|
|
|
@ -192,9 +192,8 @@ static int sticky_key_keycode_state_changed_listener(const struct zmk_event_head |
|
|
|
// If events were queued, the timer event may be queued late or not at all.
|
|
|
|
// If events were queued, the timer event may be queued late or not at all.
|
|
|
|
// Release the sticky key if the timer should've run out in the meantime.
|
|
|
|
// Release the sticky key if the timer should've run out in the meantime.
|
|
|
|
if (sticky_key->release_at != 0 && ev->timestamp > sticky_key->release_at) { |
|
|
|
if (sticky_key->release_at != 0 && ev->timestamp > sticky_key->release_at) { |
|
|
|
release_sticky_key_behavior(sticky_key, sticky_key->release_at); |
|
|
|
|
|
|
|
stop_timer(sticky_key); |
|
|
|
stop_timer(sticky_key); |
|
|
|
clear_sticky_key(sticky_key); |
|
|
|
release_sticky_key_behavior(sticky_key, sticky_key->release_at); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -213,9 +212,8 @@ static int sticky_key_keycode_state_changed_listener(const struct zmk_event_head |
|
|
|
if (sticky_key->timer_started && |
|
|
|
if (sticky_key->timer_started && |
|
|
|
sticky_key->modified_key_usage_page == ev->usage_page && |
|
|
|
sticky_key->modified_key_usage_page == ev->usage_page && |
|
|
|
sticky_key->modified_key_keycode == ev->keycode) { |
|
|
|
sticky_key->modified_key_keycode == ev->keycode) { |
|
|
|
release_sticky_key_behavior(sticky_key, ev->timestamp); |
|
|
|
|
|
|
|
stop_timer(sticky_key); |
|
|
|
stop_timer(sticky_key); |
|
|
|
clear_sticky_key(sticky_key); |
|
|
|
release_sticky_key_behavior(sticky_key, ev->timestamp); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -235,7 +233,6 @@ void behavior_sticky_key_timer_handler(struct k_work *item) { |
|
|
|
sticky_key->timer_is_cancelled = false; |
|
|
|
sticky_key->timer_is_cancelled = false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
release_sticky_key_behavior(sticky_key, sticky_key->release_at); |
|
|
|
release_sticky_key_behavior(sticky_key, sticky_key->release_at); |
|
|
|
clear_sticky_key(sticky_key); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|