aboutsummaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorJoshua Diamond <josh@windowoffire.com>2020-12-22 12:51:47 -0500
committerGitHub <noreply@github.com>2020-12-23 04:51:47 +1100
commitf40b56468366212ffa23de5dd424f24e42bb88bb (patch)
tree3b712b43779dc12a3215b4db82d75a34ddddb876 /quantum/process_keycode
parent2843e7f995fd1c8a011f541802aaad254278d6d4 (diff)
downloadqmk_firmware-f40b56468366212ffa23de5dd424f24e42bb88bb.tar.gz
qmk_firmware-f40b56468366212ffa23de5dd424f24e42bb88bb.zip
Partial fix for Issue #9405 - Caps Lock not working with Unicode Map's XP on Linux (#11232)
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_unicode_common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index 80be31623..bac9fbcc0 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -21,6 +21,7 @@
21 21
22unicode_config_t unicode_config; 22unicode_config_t unicode_config;
23uint8_t unicode_saved_mods; 23uint8_t unicode_saved_mods;
24bool unicode_saved_caps_lock;
24 25
25#if UNICODE_SELECTED_MODES != -1 26#if UNICODE_SELECTED_MODES != -1
26static uint8_t selected[] = {UNICODE_SELECTED_MODES}; 27static uint8_t selected[] = {UNICODE_SELECTED_MODES};
@@ -77,6 +78,16 @@ void cycle_unicode_input_mode(int8_t offset) {
77void persist_unicode_input_mode(void) { eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode); } 78void persist_unicode_input_mode(void) { eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode); }
78 79
79__attribute__((weak)) void unicode_input_start(void) { 80__attribute__((weak)) void unicode_input_start(void) {
81 unicode_saved_caps_lock = host_keyboard_led_state().caps_lock;
82
83 // Note the order matters here!
84 // Need to do this before we mess around with the mods, or else
85 // UNICODE_KEY_LNX (which is usually Ctrl-Shift-U) might not work
86 // correctly in the shifted case.
87 if (unicode_config.input_mode == UC_LNX && unicode_saved_caps_lock) {
88 tap_code(KC_CAPS);
89 }
90
80 unicode_saved_mods = get_mods(); // Save current mods 91 unicode_saved_mods = get_mods(); // Save current mods
81 clear_mods(); // Unregister mods to start from a clean state 92 clear_mods(); // Unregister mods to start from a clean state
82 93
@@ -107,6 +118,9 @@ __attribute__((weak)) void unicode_input_finish(void) {
107 break; 118 break;
108 case UC_LNX: 119 case UC_LNX:
109 tap_code(KC_SPC); 120 tap_code(KC_SPC);
121 if (unicode_saved_caps_lock) {
122 tap_code(KC_CAPS);
123 }
110 break; 124 break;
111 case UC_WIN: 125 case UC_WIN:
112 unregister_code(KC_LALT); 126 unregister_code(KC_LALT);
@@ -125,6 +139,11 @@ __attribute__((weak)) void unicode_input_cancel(void) {
125 unregister_code(UNICODE_KEY_MAC); 139 unregister_code(UNICODE_KEY_MAC);
126 break; 140 break;
127 case UC_LNX: 141 case UC_LNX:
142 tap_code(KC_ESC);
143 if (unicode_saved_caps_lock) {
144 tap_code(KC_CAPS);
145 }
146 break;
128 case UC_WINC: 147 case UC_WINC:
129 tap_code(KC_ESC); 148 tap_code(KC_ESC);
130 break; 149 break;