summaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode/process_unicode.h
diff options
context:
space:
mode:
authorGergely Nagy <algernon@madhouse-project.org>2016-08-13 10:46:38 +0200
committerGergely Nagy <algernon@madhouse-project.org>2016-08-15 10:08:53 +0200
commitfa06a163607e8c6c4bd0968c2de96a9a298b777c (patch)
tree47ddc21952c9319163bb74d4d89ac72d5c56a0fe /quantum/process_keycode/process_unicode.h
parent63e5782d2cdf0ee282ad434c773463d9da9db6b3 (diff)
downloadqmk_firmware-fa06a163607e8c6c4bd0968c2de96a9a298b777c.tar.gz
qmk_firmware-fa06a163607e8c6c4bd0968c2de96a9a298b777c.tar.xz
process_unicode: Add a way to enter unicode symbols by name
The purpose of this change is to allow keymaps to specify a dictionary of unicode symbol name to code mappings, and let the person at the keyboard enter unicode symbols by name. This is done by having a way to trigger unicode symbol input mode, when all keys are cached until Esc, Enter or Space are pressed. Once that happens, we try to look up the symbol from our lookup table. If found, we erase back, and type the unicode magic in to get that symbol. If not found, we still erase back, start unicode input mode, and replay what the user typed in. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Diffstat (limited to 'quantum/process_keycode/process_unicode.h')
-rw-r--r--quantum/process_keycode/process_unicode.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h
index f719a1226..372ea2f0d 100644
--- a/quantum/process_keycode/process_unicode.h
+++ b/quantum/process_keycode/process_unicode.h
@@ -15,6 +15,33 @@ void register_hex(uint16_t hex);
bool process_unicode(uint16_t keycode, keyrecord_t *record);
+#ifdef UCIS_ENABLE
+#ifndef UCIS_MAX_SYMBOL_LENGTH
+#define UCIS_MAX_SYMBOL_LENGTH 32
+#endif
+
+typedef struct {
+ char *symbol;
+ uint16_t codes[4];
+} qk_ucis_symbol_t;
+
+struct {
+ uint8_t count;
+ uint16_t codes[UCIS_MAX_SYMBOL_LENGTH];
+ bool in_progress:1;
+} qk_ucis_state;
+
+#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, {}}}
+#define UCIS_SYM(name, ...) {name, {__VA_ARGS__, 0}}
+
+extern const qk_ucis_symbol_t ucis_symbol_table[];
+
+void qk_ucis_start(void);
+void qk_ucis_symbol_fallback (void);
+bool process_record_ucis (uint16_t keycode, keyrecord_t *record);
+
+#endif
+
#define UC_BSPC UC(0x0008)
#define UC_SPC UC(0x0020)
@@ -122,4 +149,4 @@ bool process_unicode(uint16_t keycode, keyrecord_t *record);
#define UC_TILD UC(0x007E)
#define UC_DEL UC(0x007F)
-#endif \ No newline at end of file
+#endif