1
0
Fork 0

process_ucis: Add a callback for success (#4067)

There is `qk_ucis_symbol_fallback` for the case where symbol lookup
fails, but there wasn't one for the success case. This adds
`qk_ucis_success`, called after successfully finishing the UCIS symbol
input.

Thanks to @drashna for the idea!

Signed-off-by: Csilla Nagyné Martinák <csilla@csillger.hu>
This commit is contained in:
martinakcsilla 2018-10-03 23:38:02 +02:00 committed by Drashna Jaelre
parent ac27b62fa1
commit 0d61e612f0
2 changed files with 9 additions and 0 deletions

View file

@ -32,6 +32,10 @@ void qk_ucis_start_user(void) {
unicode_input_finish(); unicode_input_finish();
} }
__attribute__((weak))
void qk_ucis_success(uint8_t symbol_index) {
}
static bool is_uni_seq(char *seq) { static bool is_uni_seq(char *seq) {
uint8_t i; uint8_t i;
@ -142,6 +146,10 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) {
} }
unicode_input_finish(); unicode_input_finish();
if (symbol_found) {
qk_ucis_success(i);
}
qk_ucis_state.in_progress = false; qk_ucis_state.in_progress = false;
return false; return false;
} }

View file

@ -45,6 +45,7 @@ extern const qk_ucis_symbol_t ucis_symbol_table[];
void qk_ucis_start(void); void qk_ucis_start(void);
void qk_ucis_start_user(void); void qk_ucis_start_user(void);
void qk_ucis_symbol_fallback (void); void qk_ucis_symbol_fallback (void);
void qk_ucis_success(uint8_t symbol_index);
void register_ucis(const char *hex); void register_ucis(const char *hex);
bool process_ucis (uint16_t keycode, keyrecord_t *record); bool process_ucis (uint16_t keycode, keyrecord_t *record);