X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=quantum%2Fprocess_keycode%2Fprocess_ucis.c;h=380199771db623062f1827e2289855cec0b667b6;hb=4665e4ffffcdfc6fe6f498928963adc64f6fefd7;hp=4ad2533b089ffbe640dfd2e43f77e231a42d9904;hpb=cbabb4d417ef58f5d484dc256b637f61619efaa8;p=qmk_firmware.git diff --git a/quantum/process_keycode/process_ucis.c b/quantum/process_keycode/process_ucis.c index 4ad2533b0..380199771 100644 --- a/quantum/process_keycode/process_ucis.c +++ b/quantum/process_keycode/process_ucis.c @@ -1,3 +1,19 @@ +/* Copyright 2017 Jack Humbert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "process_ucis.h" qk_ucis_state_t qk_ucis_state; @@ -16,6 +32,10 @@ void qk_ucis_start_user(void) { unicode_input_finish(); } +__attribute__((weak)) +void qk_ucis_success(uint8_t symbol_index) { +} + static bool is_uni_seq(char *seq) { uint8_t i; @@ -73,7 +93,7 @@ void register_ucis(const char *hex) { } bool process_ucis (uint16_t keycode, keyrecord_t *record) { - uint8_t i; + unicode_input_mode_init(); if (!qk_ucis_state.in_progress) return true; @@ -102,7 +122,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) { if (keycode == KC_ENT || keycode == KC_SPC || keycode == KC_ESC) { bool symbol_found = false; - for (i = qk_ucis_state.count; i > 0; i--) { + for (uint8_t i = qk_ucis_state.count; i > 0; i--) { register_code (KC_BSPC); unregister_code (KC_BSPC); wait_ms(UNICODE_TYPE_DELAY); @@ -114,7 +134,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) { } unicode_input_start(); - for (i = 0; ucis_symbol_table[i].symbol; i++) { + for (uint8_t i = 0; ucis_symbol_table[i].symbol; i++) { if (is_uni_seq (ucis_symbol_table[i].symbol)) { symbol_found = true; register_ucis(ucis_symbol_table[i].code + 2); @@ -126,8 +146,12 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) { } unicode_input_finish(); + if (symbol_found) { + qk_ucis_success(i); + } + qk_ucis_state.in_progress = false; return false; } return true; -} \ No newline at end of file +}