aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Đorđević <vomindoraan@gmail.com>2019-01-07 21:56:57 +0100
committerDrashna Jaelre <drashna@live.com>2019-01-07 12:56:57 -0800
commitcd9262d7b2dcde5d31aa34f066dd593a012d7049 (patch)
treebb9cda36efc39af997e019af4f6a91f451d12807
parent6e984a8b5e34ba181b0893a929af569a1faef2b6 (diff)
downloadqmk_firmware-cd9262d7b2dcde5d31aa34f066dd593a012d7049.tar.gz
qmk_firmware-cd9262d7b2dcde5d31aa34f066dd593a012d7049.zip
Improve consistency in UNICODEMAP code and docs, update docs/understanding_qmk (#4774)
* Remove unused UNICODE(n) macro, update docs * Add note about max length of unicode_map to docs * QK_UNICODE_MAP → QK_UNICODEMAP * Refactor process_unicode_map * process_unicode_map → process_unicodemap This is done for consistency: UNICODEMAP is the method (hence UNICODEMAP_ENABLE, process_unicodemap), whereas unicode_map is the mapping table itself. * Update references and ordering in docs/understanding_qmk * Add additional note to docs/understanding_qmk * &unicode_map[index] → unicode_map + index This avoids the issue of the compiler sometimes complaining about the array index being out of range * Update docs/getting_started_make_guide * Update method sections in docs/feature_unicode
-rw-r--r--docs/feature_unicode.md47
-rw-r--r--docs/getting_started_make_guide.md16
-rw-r--r--docs/keycodes.md8
-rw-r--r--docs/understanding_qmk.md58
-rw-r--r--quantum/process_keycode/process_unicode_common.c2
-rw-r--r--quantum/process_keycode/process_unicodemap.c33
-rw-r--r--quantum/process_keycode/process_unicodemap.h4
-rw-r--r--quantum/quantum_keycodes.h15
8 files changed, 89 insertions, 94 deletions
diff --git a/docs/feature_unicode.md b/docs/feature_unicode.md
index 9d57e2fb7..7dd85c5c2 100644
--- a/docs/feature_unicode.md
+++ b/docs/feature_unicode.md
@@ -2,15 +2,15 @@
2 2
3There are three Unicode keymap definition methods available in QMK: 3There are three Unicode keymap definition methods available in QMK:
4 4
5## UNICODE_ENABLE 5## `UNICODE_ENABLE`
6 6
7Supports Unicode up to `0xFFFF`. The keycode function is `UC(n)` in the keymap file, where _n_ is a 4 digit hexadecimal number. 7Supports Unicode up to `0x7FFF`. This covers characters for most modern languages, as well as symbols, but it doesn't cover emoji. The keycode function is `UC(c)` in the keymap file, where _c_ is the code point's number (preferably hexadecimal, up to 4 digits long). For example: `UC(0x45B)`, `UC(0x30C4)`.
8 8
9## UNICODEMAP_ENABLE 9## `UNICODEMAP_ENABLE`
10 10
11Supports Unicode up to `0x10FFFF` (all possible code points). You need to maintain a separate mapping table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. The keycode function is `X(n)`, where _n_ is an array index into the mapping table. 11Supports Unicode up to `0x10FFFF` (all possible code points). You need to maintain a separate mapping table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. The keycode function is `X(i)`, where _i_ is an array index into the mapping table. The table may contain at most 1024 entries.
12 12
13And you may want to have an enum to make reference easier. So you'd want to add something like this to your keymap: 13You may want to have an enum to make referencing easier. So, you could add something like this to your keymap file:
14 14
15```c 15```c
16enum unicode_names { 16enum unicode_names {
@@ -20,38 +20,37 @@ enum unicode_names {
20}; 20};
21 21
22const uint32_t PROGMEM unicode_map[] = { 22const uint32_t PROGMEM unicode_map[] = {
23 [BANG] = 0x203D, // ‽ 23 [BANG] = 0x203D, // ‽
24 [IRONY] = 0x2E2E, // ⸮ 24 [IRONY] = 0x2E2E, // ⸮
25 [SNEK] = 0x1F40D, // 🐍 25 [SNEK] = 0x1F40D, // 🐍
26}; 26};
27``` 27```
28 28
29Make sure that the order for both matches. 29Then you can use `X(BANG)` etc. in your keymap.
30 30
31## UCIS_ENABLE 31## `UCIS_ENABLE`
32 32
33Supports Unicode up to `0x10FFFF` (all possible code points). As with `UNICODEMAP`, you may want to maintain a mapping table in your keymap file. However, there are no built-in keycodes for this feature — you will have to add a keycode or function that calls `qk_ucis_start()`. Once it's been called, you can type the mnemonic for your character, then hit Space or Enter to complete it or Esc to cancel. If the mnemonic matches an entry in your table, the typed text will automatically be erased and the corresponding Unicode sequence inserted. 33Supports Unicode up to `0x10FFFF` (all possible code points). As with `UNICODEMAP`, you need to maintain a mapping table in your keymap file. However, there are no built-in keycodes for this feature — you will have to add a keycode or function that calls `qk_ucis_start()`. Once this function's been called, you can type the corresponding mnemonic for your character, then hit Space or Enter to complete it, or Esc to cancel. If the mnemonic matches an entry in your table, the typed text will automatically be erased and the corresponding Unicode character inserted.
34 34
35For instance, you would need to have a table like this in your keymap: 35For instance, you would define a table like this in your keymap file:
36 36
37```c 37```c
38const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE 38const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE(
39( 39 UCIS_SYM("poop", 0x1F4A9), // 💩
40 UCIS_SYM("poop", 0x1f4a9), 40 UCIS_SYM("rofl", 0x1F923), // 🤣
41 UCIS_SYM("rofl", 0x1f923), 41 UCIS_SYM("kiss", 0x1F619) // 😙
42 UCIS_SYM("kiss", 0x1f619)
43); 42);
44``` 43```
45 44
46You run the function, and then type "rofl" and hit enter, it should backspace remove "rofl" and input the `0x1f923` unicode. 45You call `qk_ucis_start()`, then type "rofl" and hit Enter. QMK should erase the "rofl" text and input the laughing emoji.
47 46
48### Customization 47### Customization
49 48
50There are several functions that you can add to your keymap to customize the functionality of this feature. 49There are several functions that you can define in your keymap to customize the functionality of this feature.
51 50
52* `void qk_ucis_start_user(void)` - This runs when you run the "start" function, and can be used to provide feedback. By default, it types out a keyboard emoji. 51* `void qk_ucis_start_user(void)` – This runs when you call the "start" function, and can be used to provide feedback. By default, it types out a keyboard emoji.
53* `void qk_ucis_success(uint8_t symbol_index)` - This runs when the unicode input has matched something, and has completed. Default doesn't do anything. 52* `void qk_ucis_success(uint8_t symbol_index)` – This runs when the input has matched something and has completed. By default, it doesn't do anything.
54* `void qk_ucis_symbol_fallback (void)` - This runs if the input text doesn't match anything. The default function falls back to trying that input as a unicode code. 53* `void qk_ucis_symbol_fallback (void)` – This runs when the input doesn't match anything. By default, it falls back to trying that input as a Unicode code.
55 54
56You can find the default implementations of these functions in [`process_ucis.c`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_ucis.c). 55You can find the default implementations of these functions in [`process_ucis.c`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_ucis.c).
57 56
@@ -66,7 +65,7 @@ The following input modes are available:
66 To enable, go to _System Preferences > Keyboard > Input Sources_, add _Unicode Hex Input_ to the list (it's under _Other_), then activate it from the input dropdown in the Menu Bar. 65 To enable, go to _System Preferences > Keyboard > Input Sources_, add _Unicode Hex Input_ to the list (it's under _Other_), then activate it from the input dropdown in the Menu Bar.
67 By default, this mode uses the left Option key (`KC_LALT`), but this can be changed by defining [`UNICODE_OSX_KEY`](#input-key-configuration) with another keycode. 66 By default, this mode uses the left Option key (`KC_LALT`), but this can be changed by defining [`UNICODE_OSX_KEY`](#input-key-configuration) with another keycode.
68 67
69* **`UC_LNX`**: Linux built-in IBus Unicode input. Supports all possible code points (`0x10FFFF`). 68* **`UC_LNX`**: Linux built-in IBus Unicode input. Supports code points up to `0x10FFFF` (all possible code points).
70 69
71 Enabled by default and works almost anywhere on IBus-enabled distros. Without IBus, this mode works under GTK apps, but rarely anywhere else. 70 Enabled by default and works almost anywhere on IBus-enabled distros. Without IBus, this mode works under GTK apps, but rarely anywhere else.
72 71
@@ -77,7 +76,7 @@ The following input modes are available:
77 76
78* **`UC_BSD`**: _(non implemented)_ Unicode input under BSD. Not implemented at this time. If you're a BSD user and want to help add support for it, please [open an issue on GitHub](https://github.com/qmk/qmk_firmware/issues). 77* **`UC_BSD`**: _(non implemented)_ Unicode input under BSD. Not implemented at this time. If you're a BSD user and want to help add support for it, please [open an issue on GitHub](https://github.com/qmk/qmk_firmware/issues).
79 78
80* **`UC_WINC`**: Windows Unicode input using [WinCompose](https://github.com/samhocevar/wincompose). As of v0.8.2, supports code points up to `0xFFFFF`. 79* **`UC_WINC`**: Windows Unicode input using [WinCompose](https://github.com/samhocevar/wincompose). As of v0.8.2, supports code points up to `0xFFFFF` (all currently assigned code points).
81 80
82 To enable, install the [latest release](https://github.com/samhocevar/wincompose/releases/latest). Once installed, WinCompose will automatically run on startup. Works reliably under all version of Windows supported by the app. 81 To enable, install the [latest release](https://github.com/samhocevar/wincompose/releases/latest). Once installed, WinCompose will automatically run on startup. Works reliably under all version of Windows supported by the app.
83 By default, this mode uses the right Alt key (`KC_RALT`), but this can be changed in the WinCompose settings and by defining [`UNICODE_WINC_KEY`](#input-key-configuration) with another keycode. 82 By default, this mode uses the right Alt key (`KC_RALT`), but this can be changed in the WinCompose settings and by defining [`UNICODE_WINC_KEY`](#input-key-configuration) with another keycode.
diff --git a/docs/getting_started_make_guide.md b/docs/getting_started_make_guide.md
index e51541190..adc1aed75 100644
--- a/docs/getting_started_make_guide.md
+++ b/docs/getting_started_make_guide.md
@@ -93,19 +93,17 @@ This enables MIDI sending and receiving with your keyboard. To enter MIDI send m
93 93
94`UNICODE_ENABLE` 94`UNICODE_ENABLE`
95 95
96This allows you to send unicode symbols via `UC(<unicode>)` in your keymap. Only codes up to 0x7FFF are currently supported. 96This allows you to send Unicode characters using `UC(<code point>)` in your keymap. Code points up to `0x7FFF` are supported. This covers characters for most modern languages, as well as symbols, but it doesn't cover emoji.
97 97
98`UNICODEMAP_ENABLE` 98`UNICODEMAP_ENABLE`
99 99
100This allows sending unicode symbols using `X(<unicode>)` in your keymap. Codes 100This allows you to send Unicode characters using `X(<map index>)` in your keymap. You will need to maintain a mapping table in your keymap file. All possible code points (up to `0x10FFFF`) are supported.
101up to 0xFFFFFFFF are supported, including emojis. You will need to maintain
102a separate mapping table in your keymap file.
103 101
104Known limitations: 102`UCIS_ENABLE`
105- Under Mac OS, only codes up to 0xFFFF are supported.
106- Under Linux ibus, only codes up to 0xFFFFF are supported (but anything important is still under this limit for now).
107 103
108Characters out of range supported by the OS will be ignored. 104This allows you to send Unicode characters by inputting a mnemonic corresponding to the character you want to send. You will need to maintain a mapping table in your keymap file. All possible code points (up to `0x10FFFF`) are supported.
105
106For further details, as well as limitations, see the [Unicode page](feature_unicode.md).
109 107
110`BLUETOOTH_ENABLE` 108`BLUETOOTH_ENABLE`
111 109
@@ -117,7 +115,7 @@ This allows you output audio on the C6 pin (needs abstracting). See the [audio p
117 115
118`FAUXCLICKY_ENABLE` 116`FAUXCLICKY_ENABLE`
119 117
120Uses buzzer to emulate clicky switches. A cheap imitation of the Cherry blue switches. By default, uses the C6 pin, same as AUDIO_ENABLE. 118Uses buzzer to emulate clicky switches. A cheap imitation of the Cherry blue switches. By default, uses the C6 pin, same as `AUDIO_ENABLE`.
121 119
122`VARIABLE_TRACE` 120`VARIABLE_TRACE`
123 121
diff --git a/docs/keycodes.md b/docs/keycodes.md
index 6d8525393..bd325b7fa 100644
--- a/docs/keycodes.md
+++ b/docs/keycodes.md
@@ -454,7 +454,7 @@ This is a reference only. Each group of keys links to the page documenting their
454 454
455## [Unicode Support](feature_unicode.md) 455## [Unicode Support](feature_unicode.md)
456 456
457|Key |Aliases| | 457|Key |Description |
458|------------|-------|-------------------------------------------------| 458|-------|---------------------------------------------------------------------------|
459|`UNICODE(n)`|`UC(n)`|Send Unicode character `n` | 459|`UC(c)`|Send Unicode code point `c` (`UNICODE_ENABLE`) |
460|`X(n)` | |Send Unicode character `n` via a different method| 460|`X(i)` |Send Unicode code point at index `i` in `unicode_map` (`UNICODEMAP_ENABLE`)|
diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md
index 35596cc69..20ead2b3f 100644
--- a/docs/understanding_qmk.md
+++ b/docs/understanding_qmk.md
@@ -12,7 +12,7 @@ You can think of QMK as no different from any other computer program. It is star
12 12
13The reason for this is the different platforms that QMK supports. The most common platform is `lufa`, which runs on AVR processors such at the atmega32u4. We also support `chibios` and `vusb`. 13The reason for this is the different platforms that QMK supports. The most common platform is `lufa`, which runs on AVR processors such at the atmega32u4. We also support `chibios` and `vusb`.
14 14
15We'll focus on AVR processors for the moment, which use the `lufa` platform. You can find the `main()` function in [tmk_core/protocol/lufa/lufa.c](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/tmk_core/protocol/lufa/lufa.c#L1019). If you browse through that function you'll find that it initializes any hardware that has been configured (including USB to the host) and then it starts the core part of the program with a [`while(1)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/tmk_core/protocol/lufa/lufa.c#L1060). This is [The Main Loop](#the-main-loop). 15We'll focus on AVR processors for the moment, which use the `lufa` platform. You can find the `main()` function in [tmk_core/protocol/lufa/lufa.c](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/tmk_core/protocol/lufa/lufa.c#L1028). If you browse through that function you'll find that it initializes any hardware that has been configured (including USB to the host) and then it starts the core part of the program with a [`while(1)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/tmk_core/protocol/lufa/lufa.c#L1069). This is [The Main Loop](#the-main-loop).
16 16
17## The Main Loop 17## The Main Loop
18 18
@@ -22,7 +22,7 @@ This section of code is called "The Main Loop" because it's responsible for loop
22 keyboard_task(); 22 keyboard_task();
23``` 23```
24 24
25This is where all the keyboard specific functionality is dispatched. The source code for `keyboard_task()` can be found in [tmk_core/common/keyboard.c](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/tmk_core/common/keyboard.c#L206), and it is responsible for detecting changes in the matrix and turning status LED's on and off. 25This is where all the keyboard specific functionality is dispatched. The source code for `keyboard_task()` can be found in [tmk_core/common/keyboard.c](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/tmk_core/common/keyboard.c#L216), and it is responsible for detecting changes in the matrix and turning status LED's on and off.
26 26
27Within `keyboard_task()` you'll find code to handle: 27Within `keyboard_task()` you'll find code to handle:
28 28
@@ -77,7 +77,7 @@ At the keyboard level we define a C macro (typically named `KEYMAP()`) which map
77 77
78Notice how the second block of our `KEYMAP()` macro matches the Matrix Scanning array above? This macro is what will map the matrix scanning array to keycodes. However, if you look at a 17 key numpad you'll notice that it has 3 places where the matrix could have a switch but doesn't, due to larger keys. We have populated those spaces with `KC_NO` so that our keymap definition doesn't have to. 78Notice how the second block of our `KEYMAP()` macro matches the Matrix Scanning array above? This macro is what will map the matrix scanning array to keycodes. However, if you look at a 17 key numpad you'll notice that it has 3 places where the matrix could have a switch but doesn't, due to larger keys. We have populated those spaces with `KC_NO` so that our keymap definition doesn't have to.
79 79
80You can also use this macro to handle unusual matrix layouts, for example the [Clueboard rev 2](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/keyboards/clueboard/66/rev2/rev2.h). Explaining that is outside the scope of this document. 80You can also use this macro to handle unusual matrix layouts, for example the [Clueboard rev 2](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/keyboards/clueboard/66/rev2/rev2.h). Explaining that is outside the scope of this document.
81 81
82##### Keycode Assignment 82##### Keycode Assignment
83 83
@@ -130,31 +130,33 @@ Comparing against our keymap we can see that the pressed key is KC_NLCK. From he
130 130
131##### Process Record 131##### Process Record
132 132
133The `process_record()` function itself is deceptively simple, but hidden within is a gateway to overriding functionality at various levels of QMK. The chain of events is listed below, using cluecard whenever we need to look at the keyboard/keymap level functions. Depending on options set in rule.mk or elsewhere, only a subset of the functions below will be included in final firmware. 133The `process_record()` function itself is deceptively simple, but hidden within is a gateway to overriding functionality at various levels of QMK. The chain of events is listed below, using cluecard whenever we need to look at the keyboard/keymap level functions. Depending on options set in `rules.mk` or elsewhere, only a subset of the functions below will be included in final firmware.
134 134
135* [`void process_record(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/tmk_core/common/action.c#L172) 135* [`void process_record(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/tmk_core/common/action.c#L172)
136 * [`bool process_record_quantum(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/quantum.c#L193) 136 * [`bool process_record_quantum(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/quantum.c#L206)
137 * [Map this record to a keycode](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/quantum.c#L213) 137 * [Map this record to a keycode](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/quantum.c#L226)
138 * [`void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/process_keycode/process_tap_dance.c#L115) 138 * [`void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_tap_dance.c#L119)
139 * [`bool process_key_lock(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/process_keycode/process_key_lock.c#L62) 139 * [`bool process_key_lock(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_key_lock.c#L62)
140 * [`bool process_clicky(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/quantum/process_keycode/process_clicky.c#L44) 140 * [`bool process_clicky(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_clicky.c#L79)
141 * [`bool process_record_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/keyboards/clueboard/card/card.c#L20) 141 * [`bool process_record_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/keyboards/clueboard/card/card.c#L20)
142 * [`bool process_record_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/08c682c193f43e5d54df990680ae93fc2e06150a/keyboards/clueboard/card/keymaps/default/keymap.c#L58) 142 * [`bool process_record_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/keyboards/clueboard/card/keymaps/default/keymap.c#L58)
143 * [`bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/fdd0f915271f79b104aa5d216566bcc3fd134e85/quantum/rgb_matrix.c#L139) 143 * [`bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/rgb_matrix.c#L139)
144 * [`bool process_midi(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_midi.c#L81) 144 * [`bool process_midi(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_midi.c#L81)
145 * [`bool process_audio(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_audio.c#L19) 145 * [`bool process_audio(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_audio.c#L19)
146 * [`bool process_steno(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_steno.c#L160) 146 * [`bool process_steno(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_steno.c#L160)
147 * [`bool process_music(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_music.c#L114) 147 * [`bool process_music(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_music.c#L114)
148 * [`bool process_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_tap_dance.c#L136) 148 * [`bool process_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_tap_dance.c#L141)
149 * [`bool process_leader(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_leader.c#L38) 149 * [`bool process_unicode_common(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_unicode_common.c#L169)
150 * [`bool process_combo(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_combo.c#L115) 150 calls one of:
151 * [`bool process_unicode(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_unicode.c#L22) 151 * [`bool process_unicode(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_unicode.c#L20)
152 * [`bool process_ucis(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_ucis.c#L91) 152 * [`bool process_unicodemap(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_unicodemap.c#L46)
153 * [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_printer.c#L77) 153 * [`bool process_ucis(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_ucis.c#L95)
154 * [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_auto_shift.c#L94) 154 * [`bool process_leader(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_leader.c#L51)
155 * [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_unicodemap.c#L47) 155 * [`bool process_combo(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_combo.c#L115)
156 * [`bool process_terminal(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/process_keycode/process_terminal.c#L264) 156 * [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_printer.c#L77)
157 * [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/661ca4440cc42f3b60697e98985c44b0571ccfc1/quantum/quantum.c#L287) 157 * [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_auto_shift.c#L94)
158 * [`bool process_terminal(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/process_keycode/process_terminal.c#L264)
159 * [Identify and process Quantum-specific keycodes](https://github.com/qmk/qmk_firmware/blob/e1203a222bb12ab9733916164a000ef3ac48da93/quantum/quantum.c#L291)
158 160
159At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing. 161At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing.
160 162
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index 3286f45b5..b64feb700 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -216,7 +216,7 @@ bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
216#if defined(UNICODE_ENABLE) 216#if defined(UNICODE_ENABLE)
217 return process_unicode(keycode, record); 217 return process_unicode(keycode, record);
218#elif defined(UNICODEMAP_ENABLE) 218#elif defined(UNICODEMAP_ENABLE)
219 return process_unicode_map(keycode, record); 219 return process_unicodemap(keycode, record);
220#elif defined(UCIS_ENABLE) 220#elif defined(UCIS_ENABLE)
221 return process_ucis(keycode, record); 221 return process_ucis(keycode, record);
222#else 222#else
diff --git a/quantum/process_keycode/process_unicodemap.c b/quantum/process_keycode/process_unicodemap.c
index 75f35112b..cee9acb5f 100644
--- a/quantum/process_keycode/process_unicodemap.c
+++ b/quantum/process_keycode/process_unicodemap.c
@@ -18,8 +18,7 @@
18#include "process_unicode_common.h" 18#include "process_unicode_common.h"
19 19
20__attribute__((weak)) 20__attribute__((weak))
21const uint32_t PROGMEM unicode_map[] = { 21const uint32_t PROGMEM unicode_map[] = {};
22};
23 22
24void register_hex32(uint32_t hex) { 23void register_hex32(uint32_t hex) {
25 bool onzerostart = true; 24 bool onzerostart = true;
@@ -42,26 +41,26 @@ void register_hex32(uint32_t hex) {
42} 41}
43 42
44__attribute__((weak)) 43__attribute__((weak))
45void unicode_map_input_error() {} 44void unicodemap_input_error() {}
46 45
47bool process_unicode_map(uint16_t keycode, keyrecord_t *record) { 46bool process_unicodemap(uint16_t keycode, keyrecord_t *record) {
48 uint8_t input_mode = get_unicode_input_mode(); 47 if ((keycode & QK_UNICODEMAP) == QK_UNICODEMAP && record->event.pressed) {
49 if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) { 48 uint16_t index = keycode - QK_UNICODEMAP;
50 const uint32_t* map = unicode_map; 49 uint32_t code = pgm_read_dword(unicode_map + index);
51 uint16_t index = keycode - QK_UNICODE_MAP; 50 uint8_t input_mode = get_unicode_input_mode();
52 uint32_t code = pgm_read_dword(&map[index]); 51
53 if (code > 0xFFFF && code <= 0x10ffff && input_mode == UC_OSX) { 52 if (code > 0xFFFF && code <= 0x10FFFF && input_mode == UC_OSX) {
54 // Convert to UTF-16 surrogate pair 53 // Convert to UTF-16 surrogate pair
55 code -= 0x10000; 54 code -= 0x10000;
56 uint32_t lo = code & 0x3ff; 55 uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10;
57 uint32_t hi = (code & 0xffc00) >> 10; 56
58 unicode_input_start(); 57 unicode_input_start();
59 register_hex32(hi + 0xd800); 58 register_hex32(hi + 0xD800);
60 register_hex32(lo + 0xdc00); 59 register_hex32(lo + 0xDC00);
61 unicode_input_finish(); 60 unicode_input_finish();
62 } else if ((code > 0x10ffff && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) { 61 } else if ((code > 0x10FFFF && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) {
63 // when character is out of range supported by the OS 62 // Character is out of range supported by the OS
64 unicode_map_input_error(); 63 unicodemap_input_error();
65 } else { 64 } else {
66 unicode_input_start(); 65 unicode_input_start();
67 register_hex32(code); 66 register_hex32(code);
diff --git a/quantum/process_keycode/process_unicodemap.h b/quantum/process_keycode/process_unicodemap.h
index f6d64bb86..5764697f8 100644
--- a/quantum/process_keycode/process_unicodemap.h
+++ b/quantum/process_keycode/process_unicodemap.h
@@ -19,5 +19,5 @@
19#include "quantum.h" 19#include "quantum.h"
20#include "process_unicode_common.h" 20#include "process_unicode_common.h"
21 21
22void unicode_map_input_error(void); 22void unicodemap_input_error(void);
23bool process_unicode_map(uint16_t keycode, keyrecord_t *record); 23bool process_unicodemap(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 2b309f4d5..ccf5371f0 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -86,8 +86,8 @@ enum quantum_keycodes {
86 QK_UNICODE_MAX = 0xFFFF, 86 QK_UNICODE_MAX = 0xFFFF,
87#endif 87#endif
88#ifdef UNICODEMAP_ENABLE 88#ifdef UNICODEMAP_ENABLE
89 QK_UNICODE_MAP = 0x8000, 89 QK_UNICODEMAP = 0x8000,
90 QK_UNICODE_MAP_MAX = 0x83FF, 90 QK_UNICODEMAP_MAX = 0x83FF,
91#endif 91#endif
92 92
93 // Loose keycodes - to be used directly 93 // Loose keycodes - to be used directly
@@ -679,15 +679,12 @@ enum quantum_keycodes {
679#define KC_MEH MEH(KC_NO) 679#define KC_MEH MEH(KC_NO)
680 680
681#ifdef UNICODE_ENABLE 681#ifdef UNICODE_ENABLE
682 // For sending unicode codes. 682 // Allows Unicode input up to 0x7FFF
683 // You may not send codes over 7FFF -- this supports most of UTF8. 683 #define UC(c) (QK_UNICODE | (c))
684 // To have a key that sends out Œ, go UC(0x0152)
685 #define UNICODE(n) (QK_UNICODE | (n))
686 #define UC(n) UNICODE(n)
687#endif 684#endif
688
689#ifdef UNICODEMAP_ENABLE 685#ifdef UNICODEMAP_ENABLE
690 #define X(n) (QK_UNICODE_MAP | (n)) 686 // Allows Unicode input up to 0x10FFFF, requires unicode_map
687 #define X(i) (QK_UNICODEMAP | (i))
691#endif 688#endif
692 689
693#define UC_MOD UNICODE_MODE_FORWARD 690#define UC_MOD UNICODE_MODE_FORWARD