aboutsummaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 63ffe2074..b83ae433e 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -33,14 +33,42 @@ static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
33 f(KC_RGUI); 33 f(KC_RGUI);
34} 34}
35 35
36static inline void qk_register_weak_mods(uint8_t kc) {
37 add_weak_mods(MOD_BIT(kc));
38 send_keyboard_report();
39}
40
41static inline void qk_unregister_weak_mods(uint8_t kc) {
42 del_weak_mods(MOD_BIT(kc));
43 send_keyboard_report();
44}
45
46static inline void qk_register_mods(uint8_t kc) {
47 add_weak_mods(MOD_BIT(kc));
48 send_keyboard_report();
49}
50
51static inline void qk_unregister_mods(uint8_t kc) {
52 del_weak_mods(MOD_BIT(kc));
53 send_keyboard_report();
54}
55
36void register_code16 (uint16_t code) { 56void register_code16 (uint16_t code) {
37 do_code16 (code, register_code); 57 if (IS_MOD(code) || code == KC_NO) {
58 do_code16 (code, qk_register_mods);
59 } else {
60 do_code16 (code, qk_register_weak_mods);
61 }
38 register_code (code); 62 register_code (code);
39} 63}
40 64
41void unregister_code16 (uint16_t code) { 65void unregister_code16 (uint16_t code) {
42 unregister_code (code); 66 unregister_code (code);
43 do_code16 (code, unregister_code); 67 if (IS_MOD(code) || code == KC_NO) {
68 do_code16 (code, qk_unregister_mods);
69 } else {
70 do_code16 (code, qk_unregister_weak_mods);
71 }
44} 72}
45 73
46__attribute__ ((weak)) 74__attribute__ ((weak))
@@ -130,6 +158,9 @@ bool process_record_quantum(keyrecord_t *record) {
130 #ifndef DISABLE_CHORDING 158 #ifndef DISABLE_CHORDING
131 process_chording(keycode, record) && 159 process_chording(keycode, record) &&
132 #endif 160 #endif
161 #ifdef COMBO_ENABLE
162 process_combo(keycode, record) &&
163 #endif
133 #ifdef UNICODE_ENABLE 164 #ifdef UNICODE_ENABLE
134 process_unicode(keycode, record) && 165 process_unicode(keycode, record) &&
135 #endif 166 #endif
@@ -508,6 +539,11 @@ void matrix_scan_quantum() {
508 #ifdef TAP_DANCE_ENABLE 539 #ifdef TAP_DANCE_ENABLE
509 matrix_scan_tap_dance(); 540 matrix_scan_tap_dance();
510 #endif 541 #endif
542
543 #ifdef COMBO_ENABLE
544 matrix_scan_combo();
545 #endif
546
511 matrix_scan_kb(); 547 matrix_scan_kb();
512} 548}
513 549