diff options
| author | Ryan <fauxpark@gmail.com> | 2022-09-13 01:49:04 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-12 08:49:04 -0700 |
| commit | 3d667f09705fa780bd5881cfa3b3cb10fa41b1fe (patch) | |
| tree | b05d0a4cd413947c1ae09fc08c33f2411029d29e /quantum/process_keycode/process_ucis.c | |
| parent | 4087251da6ffcbfd16a9b655b7816803a565f0a6 (diff) | |
Refactor Unicode feature (#18333)
Diffstat (limited to 'quantum/process_keycode/process_ucis.c')
| -rw-r--r-- | quantum/process_keycode/process_ucis.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/quantum/process_keycode/process_ucis.c b/quantum/process_keycode/process_ucis.c index 6a8d8f0ff6..646471bc4d 100644 --- a/quantum/process_keycode/process_ucis.c +++ b/quantum/process_keycode/process_ucis.c | |||
| @@ -15,6 +15,9 @@ | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include "process_ucis.h" | 17 | #include "process_ucis.h" |
| 18 | #include "unicode.h" | ||
| 19 | #include "keycode.h" | ||
| 20 | #include "wait.h" | ||
| 18 | 21 | ||
| 19 | qk_ucis_state_t qk_ucis_state; | 22 | qk_ucis_state_t qk_ucis_state; |
| 20 | 23 | ||
| @@ -26,9 +29,7 @@ void qk_ucis_start(void) { | |||
| 26 | } | 29 | } |
| 27 | 30 | ||
| 28 | __attribute__((weak)) void qk_ucis_start_user(void) { | 31 | __attribute__((weak)) void qk_ucis_start_user(void) { |
| 29 | unicode_input_start(); | 32 | register_unicode(0x2328); // ⌨ |
| 30 | register_hex(0x2328); // ⌨ | ||
| 31 | unicode_input_finish(); | ||
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | __attribute__((weak)) void qk_ucis_success(uint8_t symbol_index) {} | 35 | __attribute__((weak)) void qk_ucis_success(uint8_t symbol_index) {} |
| @@ -51,10 +52,7 @@ static bool is_uni_seq(char *seq) { | |||
| 51 | 52 | ||
| 52 | __attribute__((weak)) void qk_ucis_symbol_fallback(void) { | 53 | __attribute__((weak)) void qk_ucis_symbol_fallback(void) { |
| 53 | for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) { | 54 | for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) { |
| 54 | uint8_t keycode = qk_ucis_state.codes[i]; | 55 | tap_code(qk_ucis_state.codes[i]); |
| 55 | register_code(keycode); | ||
| 56 | unregister_code(keycode); | ||
| 57 | wait_ms(UNICODE_TYPE_DELAY); | ||
| 58 | } | 56 | } |
| 59 | } | 57 | } |
| 60 | 58 | ||
| @@ -63,7 +61,6 @@ __attribute__((weak)) void qk_ucis_cancel(void) {} | |||
| 63 | void register_ucis(const uint32_t *code_points) { | 61 | void register_ucis(const uint32_t *code_points) { |
| 64 | for (int i = 0; i < UCIS_MAX_CODE_POINTS && code_points[i]; i++) { | 62 | for (int i = 0; i < UCIS_MAX_CODE_POINTS && code_points[i]; i++) { |
| 65 | register_unicode(code_points[i]); | 63 | register_unicode(code_points[i]); |
| 66 | wait_ms(UNICODE_TYPE_DELAY); | ||
| 67 | } | 64 | } |
| 68 | } | 65 | } |
| 69 | 66 | ||
| @@ -94,9 +91,7 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) { | |||
| 94 | case KC_ENTER: | 91 | case KC_ENTER: |
| 95 | case KC_ESCAPE: | 92 | case KC_ESCAPE: |
| 96 | for (uint8_t i = 0; i < qk_ucis_state.count; i++) { | 93 | for (uint8_t i = 0; i < qk_ucis_state.count; i++) { |
| 97 | register_code(KC_BACKSPACE); | 94 | tap_code(KC_BACKSPACE); |
| 98 | unregister_code(KC_BACKSPACE); | ||
| 99 | wait_ms(UNICODE_TYPE_DELAY); | ||
| 100 | } | 95 | } |
| 101 | 96 | ||
| 102 | if (keycode == KC_ESCAPE) { | 97 | if (keycode == KC_ESCAPE) { |
