diff options
author | Jonas Gessner <JonasGessner@users.noreply.github.com> | 2021-07-13 19:13:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 10:13:51 -0700 |
commit | 52cfc9259b58a3a11a244fbe35c49c7dd1a9cae0 (patch) | |
tree | 71cbd4b8e2c622a33cbb4d080a08e035901f30c8 /quantum/quantum.c | |
parent | 1ae4d52013c9f38bdc5c208ff8bbfdf173e1dddd (diff) | |
download | qmk_firmware-52cfc9259b58a3a11a244fbe35c49c7dd1a9cae0.tar.gz qmk_firmware-52cfc9259b58a3a11a244fbe35c49c7dd1a9cae0.zip |
[Feature] Key Overrides (#11422)
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r-- | quantum/quantum.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index b4cfa28d7d..9cfffd9317 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -58,12 +58,16 @@ float bell_song[][2] = SONG(TERMINAL_SOUND); # include "process_auto_shift.h" #endif -static void do_code16(uint16_t code, void (*f)(uint8_t)) { +#ifdef KEY_OVERRIDE_ENABLE +# include "process_key_override_private.h" +#endif + +uint8_t extract_mod_bits(uint16_t code) { switch (code) { case QK_MODS ... QK_MODS_MAX: break; default: - return; + return 0; } uint8_t mods_to_send = 0; @@ -80,9 +84,11 @@ static void do_code16(uint16_t code, void (*f)(uint8_t)) { if (code & QK_LGUI) mods_to_send |= MOD_BIT(KC_LGUI); } - f(mods_to_send); + return mods_to_send; } +static void do_code16(uint16_t code, void (*f)(uint8_t)) { f(extract_mod_bits(code)); } + void register_code16(uint16_t code) { if (IS_MOD(code) || code == KC_NO) { do_code16(code, register_mods); @@ -243,6 +249,9 @@ bool process_record_quantum(keyrecord_t *record) { #if (defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))) && !defined(NO_MUSIC_MODE) process_music(keycode, record) && #endif +#ifdef KEY_OVERRIDE_ENABLE + process_key_override(keycode, record) && +#endif #ifdef TAP_DANCE_ENABLE process_tap_dance(keycode, record) && #endif @@ -408,6 +417,10 @@ void matrix_scan_quantum() { matrix_scan_music(); #endif +#ifdef KEY_OVERRIDE_ENABLE + matrix_scan_key_override(); +#endif + #ifdef SEQUENCER_ENABLE matrix_scan_sequencer(); #endif |