diff options
| author | Nick Brassel <nick@tzarc.org> | 2024-07-16 09:22:17 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-16 09:22:17 +1000 |
| commit | 8abaa3bc2df4fda13a96d0c5c4ce74b70c974fb7 (patch) | |
| tree | 3075091c9032beb60388dee536ecf0452f79035c /quantum/process_keycode/process_key_override.c | |
| parent | fef8e7195b09158a9b43ffd05df60128f3cd3ac3 (diff) | |
Add support for key override introspection. (#24120)
Diffstat (limited to 'quantum/process_keycode/process_key_override.c')
| -rw-r--r-- | quantum/process_keycode/process_key_override.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/quantum/process_keycode/process_key_override.c b/quantum/process_keycode/process_key_override.c index 264e2562b8..ce30477ee8 100644 --- a/quantum/process_keycode/process_key_override.c +++ b/quantum/process_keycode/process_key_override.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include "action_util.h" | 23 | #include "action_util.h" |
| 24 | #include "quantum.h" | 24 | #include "quantum.h" |
| 25 | #include "quantum_keycodes.h" | 25 | #include "quantum_keycodes.h" |
| 26 | #include "keymap_introspection.h" | ||
| 26 | 27 | ||
| 27 | #ifndef KEY_OVERRIDE_REPEAT_DELAY | 28 | #ifndef KEY_OVERRIDE_REPEAT_DELAY |
| 28 | # define KEY_OVERRIDE_REPEAT_DELAY 500 | 29 | # define KEY_OVERRIDE_REPEAT_DELAY 500 |
| @@ -83,9 +84,6 @@ static uint16_t deferred_register = 0; | |||
| 83 | // TODO: in future maybe save in EEPROM? | 84 | // TODO: in future maybe save in EEPROM? |
| 84 | static bool enabled = true; | 85 | static bool enabled = true; |
| 85 | 86 | ||
| 86 | // Public variables | ||
| 87 | __attribute__((weak)) const key_override_t **key_overrides = NULL; | ||
| 88 | |||
| 89 | // Forward decls | 87 | // Forward decls |
| 90 | static const key_override_t *clear_active_override(const bool allow_reregister); | 88 | static const key_override_t *clear_active_override(const bool allow_reregister); |
| 91 | 89 | ||
| @@ -247,12 +245,12 @@ static bool check_activation_event(const key_override_t *override, const bool ke | |||
| 247 | 245 | ||
| 248 | /** Iterates through the list of key overrides and tries activating each, until it finds one that activates or reaches the end of overrides. Returns true if the key action for `keycode` should be sent */ | 246 | /** Iterates through the list of key overrides and tries activating each, until it finds one that activates or reaches the end of overrides. Returns true if the key action for `keycode` should be sent */ |
| 249 | static bool try_activating_override(const uint16_t keycode, const uint8_t layer, const bool key_down, const bool is_mod, const uint8_t active_mods, bool *activated) { | 247 | static bool try_activating_override(const uint16_t keycode, const uint8_t layer, const bool key_down, const bool is_mod, const uint8_t active_mods, bool *activated) { |
| 250 | if (key_overrides == NULL) { | 248 | if (key_override_count() == 0) { |
| 251 | return true; | 249 | return true; |
| 252 | } | 250 | } |
| 253 | 251 | ||
| 254 | for (uint8_t i = 0;; i++) { | 252 | for (uint8_t i = 0; i < key_override_count(); i++) { |
| 255 | const key_override_t *const override = key_overrides[i]; | 253 | const key_override_t *const override = key_override_get(i); |
| 256 | 254 | ||
| 257 | // End of array | 255 | // End of array |
| 258 | if (override == NULL) { | 256 | if (override == NULL) { |
