Improved Language Specific Keycodes for US International and Extended Layouts (#11307)
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
parent
8e68003b28
commit
e190872b82
7 changed files with 594 additions and 13 deletions
|
@ -391,6 +391,29 @@ __attribute__((weak)) const uint8_t ascii_to_altgr_lut[16] PROGMEM = {
|
|||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
};
|
||||
|
||||
/* Bit-Packed look-up table to convert an ASCII character to whether
|
||||
* [Space] needs to be sent after the keycode
|
||||
*/
|
||||
__attribute__((weak)) const uint8_t ascii_to_dead_lut[16] PROGMEM = {
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0),
|
||||
};
|
||||
|
||||
/* Look-up table to convert an ASCII character to a keycode.
|
||||
*/
|
||||
__attribute__((weak)) const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
|
@ -528,9 +551,10 @@ void send_char(char ascii_code) {
|
|||
}
|
||||
#endif
|
||||
|
||||
uint8_t keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]);
|
||||
bool is_shifted = PGM_LOADBIT(ascii_to_shift_lut, (uint8_t)ascii_code);
|
||||
bool is_altgred = PGM_LOADBIT(ascii_to_altgr_lut, (uint8_t)ascii_code);
|
||||
uint8_t keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]);
|
||||
bool is_shifted = PGM_LOADBIT(ascii_to_shift_lut, (uint8_t)ascii_code);
|
||||
bool is_altgred = PGM_LOADBIT(ascii_to_altgr_lut, (uint8_t)ascii_code);
|
||||
bool is_dead = PGM_LOADBIT(ascii_to_dead_lut, (uint8_t)ascii_code);
|
||||
|
||||
if (is_shifted) {
|
||||
register_code(KC_LSFT);
|
||||
|
@ -545,6 +569,9 @@ void send_char(char ascii_code) {
|
|||
if (is_shifted) {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
if (is_dead) {
|
||||
tap_code(KC_SPACE);
|
||||
}
|
||||
}
|
||||
|
||||
void set_single_persistent_default_layer(uint8_t default_layer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue