diff options
| author | Drashna Jaelre <drashna@live.com> | 2021-04-19 20:34:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-19 20:34:14 -0700 |
| commit | c02137a0d245a7be8ca44cf46f05a632cc8fc702 (patch) | |
| tree | 6576acdd6f248631b0dd9f3f0c313fcd41f6be16 /quantum | |
| parent | 49efd6abb0cf4c35a0d8f7ce2d9d112fe83d35e2 (diff) | |
| download | qmk_firmware-c02137a0d245a7be8ca44cf46f05a632cc8fc702.tar.gz qmk_firmware-c02137a0d245a7be8ca44cf46f05a632cc8fc702.zip | |
Add Per Key functionality for AutoShift (#11536)
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/process_keycode/process_auto_shift.c | 20 | ||||
| -rw-r--r-- | quantum/process_keycode/process_auto_shift.h | 1 |
2 files changed, 14 insertions, 7 deletions
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c index bf359e994..51b0efdb4 100644 --- a/quantum/process_keycode/process_auto_shift.c +++ b/quantum/process_keycode/process_auto_shift.c | |||
| @@ -216,7 +216,18 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { | |||
| 216 | # endif | 216 | # endif |
| 217 | } | 217 | } |
| 218 | } | 218 | } |
| 219 | if (get_auto_shifted_key(keycode, record)) { | ||
| 220 | if (record->event.pressed) { | ||
| 221 | return autoshift_press(keycode, now, record); | ||
| 222 | } else { | ||
| 223 | autoshift_end(keycode, now, false); | ||
| 224 | return false; | ||
| 225 | } | ||
| 226 | } | ||
| 227 | return true; | ||
| 228 | } | ||
| 219 | 229 | ||
| 230 | __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { | ||
| 220 | switch (keycode) { | 231 | switch (keycode) { |
| 221 | # ifndef NO_AUTO_SHIFT_ALPHA | 232 | # ifndef NO_AUTO_SHIFT_ALPHA |
| 222 | case KC_A ... KC_Z: | 233 | case KC_A ... KC_Z: |
| @@ -229,14 +240,9 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { | |||
| 229 | case KC_MINUS ... KC_SLASH: | 240 | case KC_MINUS ... KC_SLASH: |
| 230 | case KC_NONUS_BSLASH: | 241 | case KC_NONUS_BSLASH: |
| 231 | # endif | 242 | # endif |
| 232 | if (record->event.pressed) { | 243 | return true; |
| 233 | return autoshift_press(keycode, now, record); | ||
| 234 | } else { | ||
| 235 | autoshift_end(keycode, now, false); | ||
| 236 | return false; | ||
| 237 | } | ||
| 238 | } | 244 | } |
| 239 | return true; | 245 | return false; |
| 240 | } | 246 | } |
| 241 | 247 | ||
| 242 | #endif | 248 | #endif |
diff --git a/quantum/process_keycode/process_auto_shift.h b/quantum/process_keycode/process_auto_shift.h index 5b2718f11..00a9ab036 100644 --- a/quantum/process_keycode/process_auto_shift.h +++ b/quantum/process_keycode/process_auto_shift.h | |||
| @@ -31,3 +31,4 @@ bool get_autoshift_state(void); | |||
| 31 | uint16_t get_autoshift_timeout(void); | 31 | uint16_t get_autoshift_timeout(void); |
| 32 | void set_autoshift_timeout(uint16_t timeout); | 32 | void set_autoshift_timeout(uint16_t timeout); |
| 33 | void autoshift_matrix_scan(void); | 33 | void autoshift_matrix_scan(void); |
| 34 | bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record); | ||
