Basic keycode overhaul (#14726)
This commit is contained in:
parent
b06d9d822c
commit
f529580860
52 changed files with 1135 additions and 1081 deletions
|
@ -67,7 +67,7 @@ static bool autoshift_press(uint16_t keycode, uint16_t now, keyrecord_t *record)
|
|||
register_code(autoshift_lastkey);
|
||||
} else {
|
||||
// Simulate pressing the shift key.
|
||||
add_weak_mods(MOD_BIT(KC_LSFT));
|
||||
add_weak_mods(MOD_BIT(KC_LEFT_SHIFT));
|
||||
register_code(autoshift_lastkey);
|
||||
}
|
||||
return false;
|
||||
|
@ -108,7 +108,7 @@ static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger) {
|
|||
autoshift_flags.lastshifted = false;
|
||||
} else {
|
||||
// Simulate pressing the shift key.
|
||||
add_weak_mods(MOD_BIT(KC_LSFT));
|
||||
add_weak_mods(MOD_BIT(KC_LEFT_SHIFT));
|
||||
register_code(autoshift_lastkey);
|
||||
autoshift_flags.lastshifted = true;
|
||||
# if defined(AUTO_SHIFT_REPEAT) && !defined(AUTO_SHIFT_NO_AUTO_REPEAT)
|
||||
|
@ -123,7 +123,7 @@ static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger) {
|
|||
wait_ms(TAP_CODE_DELAY);
|
||||
# endif
|
||||
unregister_code(autoshift_lastkey);
|
||||
del_weak_mods(MOD_BIT(KC_LSFT));
|
||||
del_weak_mods(MOD_BIT(KC_LEFT_SHIFT));
|
||||
} else {
|
||||
// Release after keyrepeat.
|
||||
unregister_code(keycode);
|
||||
|
@ -131,7 +131,7 @@ static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger) {
|
|||
// This will only fire when the key was the last auto-shiftable
|
||||
// pressed. That prevents aaaaBBBB then releasing a from unshifting
|
||||
// later Bs (if B wasn't auto-shiftable).
|
||||
del_weak_mods(MOD_BIT(KC_LSFT));
|
||||
del_weak_mods(MOD_BIT(KC_LEFT_SHIFT));
|
||||
}
|
||||
}
|
||||
send_keyboard_report(); // del_weak_mods doesn't send one.
|
||||
|
@ -157,14 +157,14 @@ void autoshift_matrix_scan(void) {
|
|||
|
||||
void autoshift_toggle(void) {
|
||||
autoshift_flags.enabled = !autoshift_flags.enabled;
|
||||
del_weak_mods(MOD_BIT(KC_LSFT));
|
||||
del_weak_mods(MOD_BIT(KC_LEFT_SHIFT));
|
||||
}
|
||||
|
||||
void autoshift_enable(void) { autoshift_flags.enabled = true; }
|
||||
|
||||
void autoshift_disable(void) {
|
||||
autoshift_flags.enabled = false;
|
||||
del_weak_mods(MOD_BIT(KC_LSFT));
|
||||
del_weak_mods(MOD_BIT(KC_LEFT_SHIFT));
|
||||
}
|
||||
|
||||
# ifndef AUTO_SHIFT_NO_SETUP
|
||||
|
@ -195,7 +195,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
|
|||
autoshift_end(KC_NO, now, false);
|
||||
}
|
||||
// For pressing another key while keyrepeating shifted autoshift.
|
||||
del_weak_mods(MOD_BIT(KC_LSFT));
|
||||
del_weak_mods(MOD_BIT(KC_LEFT_SHIFT));
|
||||
|
||||
switch (keycode) {
|
||||
case KC_ASTG:
|
||||
|
@ -244,7 +244,7 @@ __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *r
|
|||
# ifndef NO_AUTO_SHIFT_SPECIAL
|
||||
case KC_TAB:
|
||||
case KC_MINUS ... KC_SLASH:
|
||||
case KC_NONUS_BSLASH:
|
||||
case KC_NONUS_BACKSLASH:
|
||||
# endif
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue