mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 18:06:34 +06:00
This commit is contained in:
parent
2843e7f995
commit
f40b564683
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
unicode_config_t unicode_config;
|
unicode_config_t unicode_config;
|
||||||
uint8_t unicode_saved_mods;
|
uint8_t unicode_saved_mods;
|
||||||
|
bool unicode_saved_caps_lock;
|
||||||
|
|
||||||
#if UNICODE_SELECTED_MODES != -1
|
#if UNICODE_SELECTED_MODES != -1
|
||||||
static uint8_t selected[] = {UNICODE_SELECTED_MODES};
|
static uint8_t selected[] = {UNICODE_SELECTED_MODES};
|
||||||
|
@ -77,6 +78,16 @@ void cycle_unicode_input_mode(int8_t offset) {
|
||||||
void persist_unicode_input_mode(void) { eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode); }
|
void persist_unicode_input_mode(void) { eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode); }
|
||||||
|
|
||||||
__attribute__((weak)) void unicode_input_start(void) {
|
__attribute__((weak)) void unicode_input_start(void) {
|
||||||
|
unicode_saved_caps_lock = host_keyboard_led_state().caps_lock;
|
||||||
|
|
||||||
|
// Note the order matters here!
|
||||||
|
// Need to do this before we mess around with the mods, or else
|
||||||
|
// UNICODE_KEY_LNX (which is usually Ctrl-Shift-U) might not work
|
||||||
|
// correctly in the shifted case.
|
||||||
|
if (unicode_config.input_mode == UC_LNX && unicode_saved_caps_lock) {
|
||||||
|
tap_code(KC_CAPS);
|
||||||
|
}
|
||||||
|
|
||||||
unicode_saved_mods = get_mods(); // Save current mods
|
unicode_saved_mods = get_mods(); // Save current mods
|
||||||
clear_mods(); // Unregister mods to start from a clean state
|
clear_mods(); // Unregister mods to start from a clean state
|
||||||
|
|
||||||
|
@ -107,6 +118,9 @@ __attribute__((weak)) void unicode_input_finish(void) {
|
||||||
break;
|
break;
|
||||||
case UC_LNX:
|
case UC_LNX:
|
||||||
tap_code(KC_SPC);
|
tap_code(KC_SPC);
|
||||||
|
if (unicode_saved_caps_lock) {
|
||||||
|
tap_code(KC_CAPS);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case UC_WIN:
|
case UC_WIN:
|
||||||
unregister_code(KC_LALT);
|
unregister_code(KC_LALT);
|
||||||
|
@ -125,6 +139,11 @@ __attribute__((weak)) void unicode_input_cancel(void) {
|
||||||
unregister_code(UNICODE_KEY_MAC);
|
unregister_code(UNICODE_KEY_MAC);
|
||||||
break;
|
break;
|
||||||
case UC_LNX:
|
case UC_LNX:
|
||||||
|
tap_code(KC_ESC);
|
||||||
|
if (unicode_saved_caps_lock) {
|
||||||
|
tap_code(KC_CAPS);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case UC_WINC:
|
case UC_WINC:
|
||||||
tap_code(KC_ESC);
|
tap_code(KC_ESC);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user