aboutsummaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2020-06-22 11:21:48 +1000
committerGitHub <noreply@github.com>2020-06-22 11:21:48 +1000
commit3d6d89966614be1e80d9957fb83743934c5eb162 (patch)
treea1c467283575fa7a596c27c0794a34347662f371 /quantum/process_keycode
parentcb13dd0a33c153d8cb0a26596489804c012eaae4 (diff)
downloadqmk_firmware-3d6d89966614be1e80d9957fb83743934c5eb162.tar.gz
qmk_firmware-3d6d89966614be1e80d9957fb83743934c5eb162.zip
`qmk cformat` (#9500)
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_ucis.c79
-rw-r--r--quantum/process_keycode/process_unicode_common.c2
-rw-r--r--quantum/process_keycode/process_unicodemap.c2
3 files changed, 41 insertions, 42 deletions
diff --git a/quantum/process_keycode/process_ucis.c b/quantum/process_keycode/process_ucis.c
index 2541d6eb2..12b0aba9b 100644
--- a/quantum/process_keycode/process_ucis.c
+++ b/quantum/process_keycode/process_ucis.c
@@ -72,8 +72,7 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) {
72 return true; 72 return true;
73 } 73 }
74 74
75 bool special = keycode == KC_SPC || keycode == KC_ENT || 75 bool special = keycode == KC_SPC || keycode == KC_ENT || keycode == KC_ESC || keycode == KC_BSPC;
76 keycode == KC_ESC || keycode == KC_BSPC;
77 if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH && !special) { 76 if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH && !special) {
78 return false; 77 return false;
79 } 78 }
@@ -82,49 +81,49 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) {
82 qk_ucis_state.count++; 81 qk_ucis_state.count++;
83 82
84 switch (keycode) { 83 switch (keycode) {
85 case KC_BSPC: 84 case KC_BSPC:
86 if (qk_ucis_state.count >= 2) { 85 if (qk_ucis_state.count >= 2) {
87 qk_ucis_state.count -= 2; 86 qk_ucis_state.count -= 2;
88 return true; 87 return true;
89 } else { 88 } else {
90 qk_ucis_state.count--; 89 qk_ucis_state.count--;
91 return false; 90 return false;
92 } 91 }
93 92
94 case KC_SPC: 93 case KC_SPC:
95 case KC_ENT: 94 case KC_ENT:
96 case KC_ESC: 95 case KC_ESC:
97 for (uint8_t i = 0; i < qk_ucis_state.count; i++) { 96 for (uint8_t i = 0; i < qk_ucis_state.count; i++) {
98 register_code(KC_BSPC); 97 register_code(KC_BSPC);
99 unregister_code(KC_BSPC); 98 unregister_code(KC_BSPC);
100 wait_ms(UNICODE_TYPE_DELAY); 99 wait_ms(UNICODE_TYPE_DELAY);
101 } 100 }
102 101
103 if (keycode == KC_ESC) { 102 if (keycode == KC_ESC) {
104 qk_ucis_state.in_progress = false; 103 qk_ucis_state.in_progress = false;
105 qk_ucis_cancel(); 104 qk_ucis_cancel();
106 return false; 105 return false;
107 } 106 }
108 107
109 uint8_t i; 108 uint8_t i;
110 bool symbol_found = false; 109 bool symbol_found = false;
111 for (i = 0; ucis_symbol_table[i].symbol; i++) { 110 for (i = 0; ucis_symbol_table[i].symbol; i++) {
112 if (is_uni_seq(ucis_symbol_table[i].symbol)) { 111 if (is_uni_seq(ucis_symbol_table[i].symbol)) {
113 symbol_found = true; 112 symbol_found = true;
114 register_ucis(ucis_symbol_table[i].code_points); 113 register_ucis(ucis_symbol_table[i].code_points);
115 break; 114 break;
115 }
116 }
117 if (symbol_found) {
118 qk_ucis_success(i);
119 } else {
120 qk_ucis_symbol_fallback();
116 } 121 }
117 }
118 if (symbol_found) {
119 qk_ucis_success(i);
120 } else {
121 qk_ucis_symbol_fallback();
122 }
123 122
124 qk_ucis_state.in_progress = false; 123 qk_ucis_state.in_progress = false;
125 return false; 124 return false;
126 125
127 default: 126 default:
128 return true; 127 return true;
129 } 128 }
130} 129}
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index bea34c31e..84c44d987 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -257,7 +257,7 @@ void send_unicode_string(const char *str) {
257 257
258 while (*str) { 258 while (*str) {
259 int32_t code_point = 0; 259 int32_t code_point = 0;
260 str = decode_utf8(str, &code_point); 260 str = decode_utf8(str, &code_point);
261 261
262 if (code_point >= 0) { 262 if (code_point >= 0) {
263 register_unicode(code_point); 263 register_unicode(code_point);
diff --git a/quantum/process_keycode/process_unicodemap.c b/quantum/process_keycode/process_unicodemap.c
index 789a90445..fcf676c24 100644
--- a/quantum/process_keycode/process_unicodemap.c
+++ b/quantum/process_keycode/process_unicodemap.c
@@ -22,7 +22,7 @@ __attribute__((weak)) uint16_t unicodemap_index(uint16_t keycode) {
22 uint16_t index = keycode - QK_UNICODEMAP_PAIR; 22 uint16_t index = keycode - QK_UNICODEMAP_PAIR;
23 23
24 bool shift = unicode_saved_mods & MOD_MASK_SHIFT; 24 bool shift = unicode_saved_mods & MOD_MASK_SHIFT;
25 bool caps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK); 25 bool caps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK);
26 if (shift ^ caps) { 26 if (shift ^ caps) {
27 index >>= 7; 27 index >>= 7;
28 } 28 }