summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorJoshua Diamond <josh@windowoffire.com>2022-08-31 19:39:16 -0400
committerGitHub <noreply@github.com>2022-08-31 16:39:16 -0700
commite4bf8323688b56cd5fc0f4f27c531f3406d40f6d (patch)
tree7a94a4e85177d12b4f5561969214094943da111b /quantum
parentb9effc94db6011e226a7a1f410214eca9666734f (diff)
Add unicode mode change callbacks (#18235)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/process_keycode/process_unicode_common.c17
-rw-r--r--quantum/process_keycode/process_unicode_common.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index 1c1aab8f48..94809cf029 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -29,6 +29,20 @@ static int8_t selected_count = ARRAY_SIZE(selected);
static int8_t selected_index;
#endif
+/** \brief Uunicode input mode set at user level
+ *
+ * Run user code on unicode input mode change
+ */
+__attribute__((weak)) void unicode_input_mode_set_user(uint8_t input_mode) {}
+
+/** \brief unicode input mode set at keyboard level
+ *
+ * Run keyboard code on unicode input mode change
+ */
+__attribute__((weak)) void unicode_input_mode_set_kb(uint8_t input_mode) {
+ unicode_input_mode_set_user(input_mode);
+}
+
void unicode_input_mode_init(void) {
unicode_config.raw = eeprom_read_byte(EECONFIG_UNICODEMODE);
#if UNICODE_SELECTED_MODES != -1
@@ -50,6 +64,7 @@ void unicode_input_mode_init(void) {
unicode_config.input_mode = selected[selected_index = 0];
# endif
#endif
+ unicode_input_mode_set_kb(unicode_config.input_mode);
dprintf("Unicode input mode init to: %u\n", unicode_config.input_mode);
}
@@ -60,6 +75,7 @@ uint8_t get_unicode_input_mode(void) {
void set_unicode_input_mode(uint8_t mode) {
unicode_config.input_mode = mode;
persist_unicode_input_mode();
+ unicode_input_mode_set_kb(mode);
dprintf("Unicode input mode set to: %u\n", unicode_config.input_mode);
}
@@ -73,6 +89,7 @@ void cycle_unicode_input_mode(int8_t offset) {
# if UNICODE_CYCLE_PERSIST
persist_unicode_input_mode();
# endif
+ unicode_input_mode_set_kb(unicode_config.input_mode);
dprintf("Unicode input mode cycle to: %u\n", unicode_config.input_mode);
#endif
}
diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h
index 15e798dbb3..bdc7a1dedd 100644
--- a/quantum/process_keycode/process_unicode_common.h
+++ b/quantum/process_keycode/process_unicode_common.h
@@ -87,6 +87,9 @@ void unicode_input_start(void);
void unicode_input_finish(void);
void unicode_input_cancel(void);
+void unicode_input_mode_set_user(uint8_t input_mode);
+void unicode_input_mode_set_kb(uint8_t input_mode);
+
void register_hex(uint16_t hex);
void register_hex32(uint32_t hex);
void register_unicode(uint32_t code_point);