forked from mirrors/qmk_userspace
Co-authored-by: Konstantin Đorđević <vomindoraan@gmail.com>
This commit is contained in:
parent
aae1814319
commit
f7eb030e91
6 changed files with 90 additions and 96 deletions
|
@ -36,25 +36,8 @@ __attribute__((weak)) uint16_t unicodemap_index(uint16_t keycode) {
|
|||
|
||||
bool process_unicodemap(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode >= QK_UNICODEMAP && keycode <= QK_UNICODEMAP_PAIR_MAX && record->event.pressed) {
|
||||
unicode_input_start();
|
||||
|
||||
uint32_t code = pgm_read_dword(unicode_map + unicodemap_index(keycode));
|
||||
uint8_t input_mode = get_unicode_input_mode();
|
||||
|
||||
if (code > 0x10FFFF || (code > 0xFFFF && input_mode == UC_WIN)) {
|
||||
// Character is out of range supported by the platform
|
||||
unicode_input_cancel();
|
||||
} else if (code > 0xFFFF && input_mode == UC_MAC) {
|
||||
// Convert to UTF-16 surrogate pair on Mac
|
||||
code -= 0x10000;
|
||||
uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10;
|
||||
register_hex32(hi + 0xD800);
|
||||
register_hex32(lo + 0xDC00);
|
||||
unicode_input_finish();
|
||||
} else {
|
||||
register_hex32(code);
|
||||
unicode_input_finish();
|
||||
}
|
||||
uint32_t code_point = pgm_read_dword(unicode_map + unicodemap_index(keycode));
|
||||
register_unicode(code_point);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue