summaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_audio.c4
-rw-r--r--quantum/process_keycode/process_auto_shift.c45
-rw-r--r--quantum/process_keycode/process_auto_shift.h5
-rw-r--r--quantum/process_keycode/process_leader.c42
-rw-r--r--quantum/process_keycode/process_leader.h4
-rw-r--r--quantum/process_keycode/process_music.c6
-rw-r--r--quantum/process_keycode/process_steno.c2
-rw-r--r--quantum/process_keycode/process_tap_dance.c46
-rw-r--r--quantum/process_keycode/process_tap_dance.h42
-rw-r--r--quantum/process_keycode/process_ucis.c52
-rw-r--r--quantum/process_keycode/process_ucis.h16
-rw-r--r--quantum/process_keycode/process_unicodemap.h2
12 files changed, 128 insertions, 138 deletions
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c
index 03b0af9277..c189dd02b7 100644
--- a/quantum/process_keycode/process_audio.c
+++ b/quantum/process_keycode/process_audio.c
@@ -62,5 +62,5 @@ void process_audio_all_notes_off(void) {
stop_all_notes();
}
-__attribute__((weak)) void audio_on_user() {}
-__attribute__((weak)) void audio_off_user() {}
+__attribute__((weak)) void audio_on_user(void) {}
+__attribute__((weak)) void audio_off_user(void) {}
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c
index 35d4851ee5..aad1a164ae 100644
--- a/quantum/process_keycode/process_auto_shift.c
+++ b/quantum/process_keycode/process_auto_shift.c
@@ -344,7 +344,7 @@ bool get_autoshift_state(void) {
return autoshift_flags.enabled;
}
-uint16_t get_generic_autoshift_timeout() {
+uint16_t get_generic_autoshift_timeout(void) {
return autoshift_timeout;
}
__attribute__((weak)) uint16_t get_autoshift_timeout(uint16_t keycode, keyrecord_t *record) {
@@ -397,8 +397,17 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
break;
# endif
}
- // If Retro Shift is disabled, possible custom actions shouldn't happen.
- // clang-format off
+ // If Retro Shift is disabled, possible custom actions shouldn't happen.
+ // clang-format off
+# if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
+# if defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
+ const bool is_hold_on_interrupt = get_hold_on_other_key_press(keycode, record);
+# elif defined(IGNORE_MOD_TAP_INTERRUPT)
+ const bool is_hold_on_interrupt = false;
+# else
+ const bool is_hold_on_interrupt = IS_QK_MOD_TAP(keycode);
+# endif
+# endif
if (IS_RETRO(keycode)
# if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
// Not tapped or #defines mean that rolls should use hold action.
@@ -407,27 +416,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
# ifdef RETRO_TAPPING_PER_KEY
|| !get_retro_tapping(keycode, record)
# endif
- || (record->tap.interrupted && (IS_LT(keycode)
-# if defined(HOLD_ON_OTHER_KEY_PRESS) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
-# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
- ? get_hold_on_other_key_press(keycode, record)
-# else
- ? true
-# endif
-# else
- ? false
-# endif
-# if defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY)
-# ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
- : !get_ignore_mod_tap_interrupt(keycode, record)
-# else
- : false
-# endif
-# else
- : true
-# endif
- ))
- )
+ || (record->tap.interrupted && is_hold_on_interrupt))
# endif
) {
// clang-format on
@@ -454,10 +443,10 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
# endif
) {
// Fixes modifiers not being applied to rolls with AUTO_SHIFT_MODIFIERS set.
-# if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(IGNORE_MOD_TAP_INTERRUPT_PER_KEY)
+# if !defined(IGNORE_MOD_TAP_INTERRUPT) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
if (autoshift_flags.in_progress
-# ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
- && !get_ignore_mod_tap_interrupt(keycode, record)
+# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
+ && get_hold_on_other_key_press(keycode, record)
# endif
) {
autoshift_end(KC_NO, now, false, &autoshift_lastrecord);
@@ -495,7 +484,7 @@ void retroshift_poll_time(keyevent_t *event) {
retroshift_time = timer_read();
}
// Used to swap the times of Retro Shifted key and Auto Shift key that interrupted it.
-void retroshift_swap_times() {
+void retroshift_swap_times(void) {
if (last_retroshift_time != 0 && autoshift_flags.in_progress) {
uint16_t temp = retroshift_time;
retroshift_time = last_retroshift_time;
diff --git a/quantum/process_keycode/process_auto_shift.h b/quantum/process_keycode/process_auto_shift.h
index 86adb04985..66a4b3138a 100644
--- a/quantum/process_keycode/process_auto_shift.h
+++ b/quantum/process_keycode/process_auto_shift.h
@@ -22,9 +22,8 @@
# define AUTO_SHIFT_TIMEOUT 175
#endif
-#define IS_LT(kc) ((kc) >= QK_LAYER_TAP && (kc) <= QK_LAYER_TAP_MAX)
-#define IS_MT(kc) ((kc) >= QK_MOD_TAP && (kc) <= QK_MOD_TAP_MAX)
-#define IS_RETRO(kc) (IS_MT(kc) || IS_LT(kc))
+#define IS_RETRO(kc) (IS_QK_MOD_TAP(kc) || IS_QK_LAYER_TAP(kc))
+
#define DO_GET_AUTOSHIFT_TIMEOUT(keycode, record, ...) record
// clang-format off
#define AUTO_SHIFT_ALPHA KC_A ... KC_Z
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index b74b4927a8..80bc96e65f 100644
--- a/quantum/process_keycode/process_leader.c
+++ b/quantum/process_keycode/process_leader.c
@@ -14,18 +14,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef LEADER_ENABLE
+#include "process_leader.h"
+#include <string.h>
-# include "process_leader.h"
-# include <string.h>
-
-# ifndef LEADER_TIMEOUT
-# define LEADER_TIMEOUT 300
-# endif
+#ifndef LEADER_TIMEOUT
+# define LEADER_TIMEOUT 300
+#endif
-__attribute__((weak)) void leader_start(void) {}
+__attribute__((weak)) void leader_start_user(void) {}
-__attribute__((weak)) void leader_end(void) {}
+__attribute__((weak)) void leader_end_user(void) {}
// Leader key stuff
bool leading = false;
@@ -34,52 +32,54 @@ uint16_t leader_time = 0;
uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
uint8_t leader_sequence_size = 0;
-void qk_leader_start(void) {
+void leader_start(void) {
if (leading) {
return;
}
- leader_start();
+ leader_start_user();
leading = true;
leader_time = timer_read();
leader_sequence_size = 0;
memset(leader_sequence, 0, sizeof(leader_sequence));
}
+void leader_end(void) {
+ leader_end_user();
+}
+
bool process_leader(uint16_t keycode, keyrecord_t *record) {
// Leader key set-up
if (record->event.pressed) {
if (leading) {
-# ifndef LEADER_NO_TIMEOUT
+#ifndef LEADER_NO_TIMEOUT
if (timer_elapsed(leader_time) < LEADER_TIMEOUT)
-# endif // LEADER_NO_TIMEOUT
+#endif // LEADER_NO_TIMEOUT
{
-# ifndef LEADER_KEY_STRICT_KEY_PROCESSING
+#ifndef LEADER_KEY_STRICT_KEY_PROCESSING
if (IS_QK_MOD_TAP(keycode)) {
keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
} else if (IS_QK_LAYER_TAP(keycode)) {
keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
}
-# endif // LEADER_KEY_STRICT_KEY_PROCESSING
+#endif // LEADER_KEY_STRICT_KEY_PROCESSING
if (leader_sequence_size < ARRAY_SIZE(leader_sequence)) {
leader_sequence[leader_sequence_size] = keycode;
leader_sequence_size++;
} else {
leading = false;
- leader_end();
+ leader_end_user();
return true;
}
-# ifdef LEADER_PER_KEY_TIMING
+#ifdef LEADER_PER_KEY_TIMING
leader_time = timer_read();
-# endif
+#endif
return false;
}
} else {
if (keycode == QK_LEADER) {
- qk_leader_start();
+ leader_start();
}
}
}
return true;
}
-
-#endif
diff --git a/quantum/process_keycode/process_leader.h b/quantum/process_keycode/process_leader.h
index f3fe14a432..82b4a3ed7b 100644
--- a/quantum/process_keycode/process_leader.h
+++ b/quantum/process_keycode/process_leader.h
@@ -20,9 +20,11 @@
bool process_leader(uint16_t keycode, keyrecord_t *record);
+void leader_start_user(void);
+void leader_end_user(void);
+
void leader_start(void);
void leader_end(void);
-void qk_leader_start(void);
#define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
#define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index ee697a0cc6..7c572079a7 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -317,10 +317,10 @@ void music_task(void) {
}
}
-__attribute__((weak)) void music_on_user() {}
+__attribute__((weak)) void music_on_user(void) {}
-__attribute__((weak)) void midi_on_user() {}
+__attribute__((weak)) void midi_on_user(void) {}
-__attribute__((weak)) void music_scale_user() {}
+__attribute__((weak)) void music_scale_user(void) {}
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
diff --git a/quantum/process_keycode/process_steno.c b/quantum/process_keycode/process_steno.c
index 30a0d4056f..8ba98bd4bb 100644
--- a/quantum/process_keycode/process_steno.c
+++ b/quantum/process_keycode/process_steno.c
@@ -127,7 +127,7 @@ static const uint16_t combinedmap_second[] PROGMEM = {STN_S2, STN_KL, STN_WL, ST
#endif
#ifdef STENO_ENABLE_ALL
-void steno_init() {
+void steno_init(void) {
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index 6e8e596673..706f5cddbb 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -18,8 +18,8 @@
static uint16_t active_td;
static uint16_t last_tap_time;
-void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data) {
- qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
+void tap_dance_pair_on_each_tap(tap_dance_state_t *state, void *user_data) {
+ tap_dance_pair_t *pair = (tap_dance_pair_t *)user_data;
if (state->count == 2) {
register_code16(pair->kc2);
@@ -27,14 +27,14 @@ void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data)
}
}
-void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data) {
- qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
+void tap_dance_pair_finished(tap_dance_state_t *state, void *user_data) {
+ tap_dance_pair_t *pair = (tap_dance_pair_t *)user_data;
register_code16(pair->kc1);
}
-void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) {
- qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
+void tap_dance_pair_reset(tap_dance_state_t *state, void *user_data) {
+ tap_dance_pair_t *pair = (tap_dance_pair_t *)user_data;
if (state->count == 1) {
wait_ms(TAP_CODE_DELAY);
@@ -44,8 +44,8 @@ void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) {
}
}
-void qk_tap_dance_dual_role_on_each_tap(qk_tap_dance_state_t *state, void *user_data) {
- qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
+void tap_dance_dual_role_on_each_tap(tap_dance_state_t *state, void *user_data) {
+ tap_dance_dual_role_t *pair = (tap_dance_dual_role_t *)user_data;
if (state->count == 2) {
layer_move(pair->layer);
@@ -53,8 +53,8 @@ void qk_tap_dance_dual_role_on_each_tap(qk_tap_dance_state_t *state, void *user_
}
}
-void qk_tap_dance_dual_role_finished(qk_tap_dance_state_t *state, void *user_data) {
- qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
+void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data) {
+ tap_dance_dual_role_t *pair = (tap_dance_dual_role_t *)user_data;
if (state->count == 1) {
register_code16(pair->kc);
@@ -63,8 +63,8 @@ void qk_tap_dance_dual_role_finished(qk_tap_dance_state_t *state, void *user_dat
}
}
-void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data) {
- qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
+void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data) {
+ tap_dance_dual_role_t *pair = (tap_dance_dual_role_t *)user_data;
if (state->count == 1) {
wait_ms(TAP_CODE_DELAY);
@@ -72,13 +72,13 @@ void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data)
}
}
-static inline void _process_tap_dance_action_fn(qk_tap_dance_state_t *state, void *user_data, qk_tap_dance_user_fn_t fn) {
+static inline void _process_tap_dance_action_fn(tap_dance_state_t *state, void *user_data, tap_dance_user_fn_t fn) {
if (fn) {
fn(state, user_data);
}
}
-static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) {
+static inline void process_tap_dance_action_on_each_tap(tap_dance_action_t *action) {
action->state.count++;
action->state.weak_mods = get_mods();
action->state.weak_mods |= get_weak_mods();
@@ -88,17 +88,17 @@ static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *a
_process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap);
}
-static inline void process_tap_dance_action_on_reset(qk_tap_dance_action_t *action) {
+static inline void process_tap_dance_action_on_reset(tap_dance_action_t *action) {
_process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_reset);
del_weak_mods(action->state.weak_mods);
#ifndef NO_ACTION_ONESHOT
del_mods(action->state.oneshot_mods);
#endif
send_keyboard_report();
- action->state = (const qk_tap_dance_state_t){0};
+ action->state = (const tap_dance_state_t){0};
}
-static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) {
+static inline void process_tap_dance_action_on_dance_finished(tap_dance_action_t *action) {
if (!action->state.finished) {
action->state.finished = true;
add_weak_mods(action->state.weak_mods);
@@ -116,7 +116,7 @@ static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_actio
}
bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
- qk_tap_dance_action_t *action;
+ tap_dance_action_t *action;
if (!record->event.pressed) return false;
@@ -139,7 +139,7 @@ bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
}
bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
- qk_tap_dance_action_t *action;
+ tap_dance_action_t *action;
switch (keycode) {
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX:
@@ -162,8 +162,8 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
return true;
}
-void tap_dance_task() {
- qk_tap_dance_action_t *action;
+void tap_dance_task(void) {
+ tap_dance_action_t *action;
if (!active_td || timer_elapsed(last_tap_time) <= GET_TAPPING_TERM(active_td, &(keyrecord_t){})) return;
@@ -173,7 +173,7 @@ void tap_dance_task() {
}
}
-void reset_tap_dance(qk_tap_dance_state_t *state) {
+void reset_tap_dance(tap_dance_state_t *state) {
active_td = 0;
- process_tap_dance_action_on_reset((qk_tap_dance_action_t *)state);
+ process_tap_dance_action_on_reset((tap_dance_action_t *)state);
}
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h
index d6d6c136dc..5cb6d9202c 100644
--- a/quantum/process_keycode/process_tap_dance.h
+++ b/quantum/process_keycode/process_tap_dance.h
@@ -31,39 +31,39 @@ typedef struct {
bool pressed : 1;
bool finished : 1;
bool interrupted : 1;
-} qk_tap_dance_state_t;
+} tap_dance_state_t;
-typedef void (*qk_tap_dance_user_fn_t)(qk_tap_dance_state_t *state, void *user_data);
+typedef void (*tap_dance_user_fn_t)(tap_dance_state_t *state, void *user_data);
typedef struct {
- qk_tap_dance_state_t state;
+ tap_dance_state_t state;
struct {
- qk_tap_dance_user_fn_t on_each_tap;
- qk_tap_dance_user_fn_t on_dance_finished;
- qk_tap_dance_user_fn_t on_reset;
+ tap_dance_user_fn_t on_each_tap;
+ tap_dance_user_fn_t on_dance_finished;
+ tap_dance_user_fn_t on_reset;
} fn;
void *user_data;
-} qk_tap_dance_action_t;
+} tap_dance_action_t;
typedef struct {
uint16_t kc1;
uint16_t kc2;
-} qk_tap_dance_pair_t;
+} tap_dance_pair_t;
typedef struct {
uint16_t kc;
uint8_t layer;
void (*layer_function)(uint8_t);
-} qk_tap_dance_dual_role_t;
+} tap_dance_dual_role_t;
# define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \
- { .fn = {qk_tap_dance_pair_on_each_tap, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset}, .user_data = (void *)&((qk_tap_dance_pair_t){kc1, kc2}), }
+ { .fn = {tap_dance_pair_on_each_tap, tap_dance_pair_finished, tap_dance_pair_reset}, .user_data = (void *)&((tap_dance_pair_t){kc1, kc2}), }
# define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \
- { .fn = {qk_tap_dance_dual_role_on_each_tap, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset}, .user_data = (void *)&((qk_tap_dance_dual_role_t){kc, layer, layer_move}), }
+ { .fn = {tap_dance_dual_role_on_each_tap, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_move}), }
# define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \
- { .fn = {NULL, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset}, .user_data = (void *)&((qk_tap_dance_dual_role_t){kc, layer, layer_invert}), }
+ { .fn = {NULL, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_invert}), }
# define ACTION_TAP_DANCE_FN(user_fn) \
{ .fn = {NULL, user_fn, NULL}, .user_data = NULL, }
@@ -73,11 +73,11 @@ typedef struct {
# define TD(n) (QK_TAP_DANCE | TD_INDEX(n))
# define TD_INDEX(code) ((code)&0xFF)
-# define TAP_DANCE_KEYCODE(state) TD(((qk_tap_dance_action_t *)state) - tap_dance_actions)
+# define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions)
-extern qk_tap_dance_action_t tap_dance_actions[];
+extern tap_dance_action_t tap_dance_actions[];
-void reset_tap_dance(qk_tap_dance_state_t *state);
+void reset_tap_dance(tap_dance_state_t *state);
/* To be used internally */
@@ -85,13 +85,13 @@ bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record);
bool process_tap_dance(uint16_t keycode, keyrecord_t *record);
void tap_dance_task(void);
-void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data);
-void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data);
-void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data);
+void tap_dance_pair_on_each_tap(tap_dance_state_t *state, void *user_data);
+void tap_dance_pair_finished(tap_dance_state_t *state, void *user_data);
+void tap_dance_pair_reset(tap_dance_state_t *state, void *user_data);
-void qk_tap_dance_dual_role_on_each_tap(qk_tap_dance_state_t *state, void *user_data);
-void qk_tap_dance_dual_role_finished(qk_tap_dance_state_t *state, void *user_data);
-void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data);
+void tap_dance_dual_role_on_each_tap(tap_dance_state_t *state, void *user_data);
+void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data);
+void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data);
#else
diff --git a/quantum/process_keycode/process_ucis.c b/quantum/process_keycode/process_ucis.c
index 646471bc4d..3aa09d5948 100644
--- a/quantum/process_keycode/process_ucis.c
+++ b/quantum/process_keycode/process_ucis.c
@@ -19,20 +19,20 @@
#include "keycode.h"
#include "wait.h"
-qk_ucis_state_t qk_ucis_state;
+ucis_state_t ucis_state;
-void qk_ucis_start(void) {
- qk_ucis_state.count = 0;
- qk_ucis_state.in_progress = true;
+void ucis_start(void) {
+ ucis_state.count = 0;
+ ucis_state.in_progress = true;
- qk_ucis_start_user();
+ ucis_start_user();
}
-__attribute__((weak)) void qk_ucis_start_user(void) {
+__attribute__((weak)) void ucis_start_user(void) {
register_unicode(0x2328); // ⌨
}
-__attribute__((weak)) void qk_ucis_success(uint8_t symbol_index) {}
+__attribute__((weak)) void ucis_success(uint8_t symbol_index) {}
static bool is_uni_seq(char *seq) {
uint8_t i;
@@ -43,20 +43,20 @@ static bool is_uni_seq(char *seq) {
} else {
keycode = seq[i] - 'a' + KC_A;
}
- if (i > qk_ucis_state.count || qk_ucis_state.codes[i] != keycode) {
+ if (i > ucis_state.count || ucis_state.codes[i] != keycode) {
return false;
}
}
- return qk_ucis_state.codes[i] == KC_ENTER || qk_ucis_state.codes[i] == KC_SPACE;
+ return ucis_state.codes[i] == KC_ENTER || ucis_state.codes[i] == KC_SPACE;
}
-__attribute__((weak)) void qk_ucis_symbol_fallback(void) {
- for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
- tap_code(qk_ucis_state.codes[i]);
+__attribute__((weak)) void ucis_symbol_fallback(void) {
+ for (uint8_t i = 0; i < ucis_state.count - 1; i++) {
+ tap_code(ucis_state.codes[i]);
}
}
-__attribute__((weak)) void qk_ucis_cancel(void) {}
+__attribute__((weak)) void ucis_cancel(void) {}
void register_ucis(const uint32_t *code_points) {
for (int i = 0; i < UCIS_MAX_CODE_POINTS && code_points[i]; i++) {
@@ -65,38 +65,38 @@ void register_ucis(const uint32_t *code_points) {
}
bool process_ucis(uint16_t keycode, keyrecord_t *record) {
- if (!qk_ucis_state.in_progress || !record->event.pressed) {
+ if (!ucis_state.in_progress || !record->event.pressed) {
return true;
}
bool special = keycode == KC_SPACE || keycode == KC_ENTER || keycode == KC_ESCAPE || keycode == KC_BACKSPACE;
- if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH && !special) {
+ if (ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH && !special) {
return false;
}
- qk_ucis_state.codes[qk_ucis_state.count] = keycode;
- qk_ucis_state.count++;
+ ucis_state.codes[ucis_state.count] = keycode;
+ ucis_state.count++;
switch (keycode) {
case KC_BACKSPACE:
- if (qk_ucis_state.count >= 2) {
- qk_ucis_state.count -= 2;
+ if (ucis_state.count >= 2) {
+ ucis_state.count -= 2;
return true;
} else {
- qk_ucis_state.count--;
+ ucis_state.count--;
return false;
}
case KC_SPACE:
case KC_ENTER:
case KC_ESCAPE:
- for (uint8_t i = 0; i < qk_ucis_state.count; i++) {
+ for (uint8_t i = 0; i < ucis_state.count; i++) {
tap_code(KC_BACKSPACE);
}
if (keycode == KC_ESCAPE) {
- qk_ucis_state.in_progress = false;
- qk_ucis_cancel();
+ ucis_state.in_progress = false;
+ ucis_cancel();
return false;
}
@@ -110,12 +110,12 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) {
}
}
if (symbol_found) {
- qk_ucis_success(i);
+ ucis_success(i);
} else {
- qk_ucis_symbol_fallback();
+ ucis_symbol_fallback();
}
- qk_ucis_state.in_progress = false;
+ ucis_state.in_progress = false;
return false;
default:
diff --git a/quantum/process_keycode/process_ucis.h b/quantum/process_keycode/process_ucis.h
index 3de0707762..54eb9413d4 100644
--- a/quantum/process_keycode/process_ucis.h
+++ b/quantum/process_keycode/process_ucis.h
@@ -31,15 +31,15 @@
typedef struct {
char * symbol;
uint32_t code_points[UCIS_MAX_CODE_POINTS];
-} qk_ucis_symbol_t;
+} ucis_symbol_t;
typedef struct {
uint8_t count;
uint16_t codes[UCIS_MAX_SYMBOL_LENGTH];
bool in_progress : 1;
-} qk_ucis_state_t;
+} ucis_state_t;
-extern qk_ucis_state_t qk_ucis_state;
+extern ucis_state_t ucis_state;
// clang-format off
@@ -53,12 +53,12 @@ extern qk_ucis_state_t qk_ucis_state;
// clang-format on
-extern const qk_ucis_symbol_t ucis_symbol_table[];
+extern const ucis_symbol_t ucis_symbol_table[];
-void qk_ucis_start(void);
-void qk_ucis_start_user(void);
-void qk_ucis_symbol_fallback(void);
-void qk_ucis_success(uint8_t symbol_index);
+void ucis_start(void);
+void ucis_start_user(void);
+void ucis_symbol_fallback(void);
+void ucis_success(uint8_t symbol_index);
void register_ucis(const uint32_t *code_points);
diff --git a/quantum/process_keycode/process_unicodemap.h b/quantum/process_keycode/process_unicodemap.h
index 73f5449864..5a3aeb0000 100644
--- a/quantum/process_keycode/process_unicodemap.h
+++ b/quantum/process_keycode/process_unicodemap.h
@@ -22,7 +22,7 @@
#include "action.h"
#include "progmem.h"
-extern const uint32_t PROGMEM unicode_map[];
+extern const uint32_t unicode_map[] PROGMEM;
uint16_t unicodemap_index(uint16_t keycode);
bool process_unicodemap(uint16_t keycode, keyrecord_t *record);