Refactor Unicode feature (#18333)
This commit is contained in:
parent
4087251da6
commit
3d667f0970
15 changed files with 591 additions and 506 deletions
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
|
||||
#include "process_ucis.h"
|
||||
#include "unicode.h"
|
||||
#include "keycode.h"
|
||||
#include "wait.h"
|
||||
|
||||
qk_ucis_state_t qk_ucis_state;
|
||||
|
||||
|
@ -26,9 +29,7 @@ void qk_ucis_start(void) {
|
|||
}
|
||||
|
||||
__attribute__((weak)) void qk_ucis_start_user(void) {
|
||||
unicode_input_start();
|
||||
register_hex(0x2328); // ⌨
|
||||
unicode_input_finish();
|
||||
register_unicode(0x2328); // ⌨
|
||||
}
|
||||
|
||||
__attribute__((weak)) void qk_ucis_success(uint8_t symbol_index) {}
|
||||
|
@ -51,10 +52,7 @@ static bool is_uni_seq(char *seq) {
|
|||
|
||||
__attribute__((weak)) void qk_ucis_symbol_fallback(void) {
|
||||
for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
|
||||
uint8_t keycode = qk_ucis_state.codes[i];
|
||||
register_code(keycode);
|
||||
unregister_code(keycode);
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
tap_code(qk_ucis_state.codes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +61,6 @@ __attribute__((weak)) void qk_ucis_cancel(void) {}
|
|||
void register_ucis(const uint32_t *code_points) {
|
||||
for (int i = 0; i < UCIS_MAX_CODE_POINTS && code_points[i]; i++) {
|
||||
register_unicode(code_points[i]);
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,9 +91,7 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) {
|
|||
case KC_ENTER:
|
||||
case KC_ESCAPE:
|
||||
for (uint8_t i = 0; i < qk_ucis_state.count; i++) {
|
||||
register_code(KC_BACKSPACE);
|
||||
unregister_code(KC_BACKSPACE);
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
tap_code(KC_BACKSPACE);
|
||||
}
|
||||
|
||||
if (keycode == KC_ESCAPE) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue