diff options
author | Drashna Jaelre <drashna@live.com> | 2018-12-19 08:39:24 -0800 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2018-12-19 08:39:24 -0800 |
commit | fdeec296369c0995bad1117e50946b2df84f35e4 (patch) | |
tree | c20ca5d0e302b189298d37b3abb97c4f37f5b606 /quantum/process_keycode/process_unicode_common.h | |
parent | 40bf3a2ce9ec781cc2ff7218f909ffdbece44e97 (diff) | |
download | qmk_firmware-fdeec296369c0995bad1117e50946b2df84f35e4.tar.gz qmk_firmware-fdeec296369c0995bad1117e50946b2df84f35e4.zip |
Overhaul Unicode Common functionality (#4325)
* Standardize the Unicode EEPROM code
* Remove unicode init from process_record_* functions
* Add unicode init to where it belongs: matrix_init_quantum
* Move Unicode proccessing to unicode common
* Add audio feedback to input mode keys to drive konstantin up a wall
* Tap_code cleanup
* Update keycodes
* Update unicode documentation
* Update unicode keycodes for consistency/easier merge
* Add Audio Feedback section
* Remove Functions from feature page
And link to the file instead. Link to specific lines later on.
* Fix spacing
Co-Authored-By: drashna <drashna@live.com>
* Because I missed it!
Co-Authored-By: drashna <drashna@live.com>
* Fix spacing
Co-Authored-By: drashna <drashna@live.com>
* SPAAAAAAAAAACing
Co-Authored-By: drashna <drashna@live.com>
* Add BSD for future compatibility
* Thought I fixed that!
Co-Authored-By: drashna <drashna@live.com>
* non-breaking
Co-Authored-By: drashna <drashna@live.com>
* Considered that
Co-Authored-By: drashna <drashna@live.com>
* Yuuup
Co-Authored-By: drashna <drashna@live.com>
* consistency
Co-Authored-By: drashna <drashna@live.com>
* white spaces .... copied from elsewhere
Co-Authored-By: drashna <drashna@live.com>
* white spaces
Co-Authored-By: drashna <drashna@live.com>
* white spaces
Co-Authored-By: drashna <drashna@live.com>
* Update keycode defines
* Fix Linux Song
* Update all of the songs
* Cleanup
* Move and update check to ensure only one unicode method is enabled
* Update quantum/quantum_keycodes.h
* Update documentation
* Wordsmithing and cleanup
* Format unicode_common (#13)
* case alignment
* process_record_unicode_common → process_unicode_common
* Move song arrays into function where they're used, align preprocessor directives
* Swap the order of UC_WIN and UC_BSD
* Update Unicode docs
* Reorder Unicode mode stuff to match the order of input mode constants
* Fix capitalization in doc subtitle
* Readd BSD and OSX_RALT songs
* Reword BSD note in docs
* Readd BSD keycode description
* Reword explanation of input on different platforms
* Steal vomindoraan's input mode documentation
Co-Authored-By: vomindoraan (vomindoraan@gmail.com)
* Willingly give Drashna the rest of my Unicode doc improvements
* Wordsmithing
Co-Authored-By: drashna <drashna@live.com>
* remove merge artifacts
* Unicode common cleanup (#17)
* Standardize the Unicode EEPROM code
* Remove unicode init from process_record_* functions
* Add unicode init to where it belongs: matrix_init_quantum
* Move Unicode proccessing to unicode common
* Add audio feedback to input mode keys to drive konstantin up a wall
* Tap_code cleanup
* Update keycodes
* Update unicode documentation
* Update unicode keycodes for consistency/easier merge
* Add Audio Feedback section
* Remove Functions from feature page
And link to the file instead. Link to specific lines later on.
* Fix white spaces
Co-Authored-By: drashna <drashna@live.com>
* Fix spacing
Co-Authored-By: drashna <drashna@live.com>
* Because I missed it!
Co-Authored-By: drashna <drashna@live.com>
* Fix spacing
Co-Authored-By: drashna <drashna@live.com>
* SPAAAAAAAAAACing
Co-Authored-By: drashna <drashna@live.com>
* white spaces
Co-Authored-By: drashna <drashna@live.com>
* Add BSD for future compatibility
* Thought I fixed that!
Co-Authored-By: drashna <drashna@live.com>
* non-breaking
Co-Authored-By: drashna <drashna@live.com>
* Considered that
Co-Authored-By: drashna <drashna@live.com>
* Yuuup
Co-Authored-By: drashna <drashna@live.com>
* consistency
Co-Authored-By: drashna <drashna@live.com>
* white spaces .... copied from elsewhere
Co-Authored-By: drashna <drashna@live.com>
* white spaces
Co-Authored-By: drashna <drashna@live.com>
* white spaces
Co-Authored-By: drashna <drashna@live.com>
* Update keycode defines
* Fix Linux Song
* Update all of the songs
* Cleanup
* Move and update check to ensure only one unicode method is enabled
* Update quantum/quantum_keycodes.h
* Update documentation
* Wordsmithing and cleanup
* Format unicode_common (#13)
* case alignment
* process_record_unicode_common → process_unicode_common
* Move song arrays into function where they're used, align preprocessor directives
* Swap the order of UC_WIN and UC_BSD
* Update Unicode docs
* Reorder Unicode mode stuff to match the order of input mode constants
* Fix capitalization in doc subtitle
* Readd BSD and OSX_RALT songs
* Reword BSD note in docs
* Readd BSD keycode description
* Reword explanation of input on different platforms
* Steal vomindoraan's input mode documentation
Co-Authored-By: vomindoraan (vomindoraan@gmail.com)
* Willingly give Drashna the rest of my Unicode doc improvements
* Wordsmithing
Co-Authored-By: drashna <drashna@live.com>
* Rearrange process_unicode_common functions
* Make Unicode input mode constants (UC_*) an enum
* Simplify unicode_input_start/finish code
* Make the key used for WinCompose configurable
* Remove UC_OSX_RALT in favor of setting the key with UNICODE_OSX_KEY
* Update Unicode input mode doc
* Add descriptions and rearrange definitions in process_unicode_common.h
* Add registry command to Unicode docs + misc updates
* Reword an explanation in Unicode docs
* Add TODO comment
* Remove trailing whitespace
* Improve Cycling documentation
* Add Unicode Input method Cycling support (#19)
* Standardize the Unicode EEPROM code
* Remove unicode init from process_record_* functions
* Add unicode init to where it belongs: matrix_init_quantum
* Move Unicode proccessing to unicode common
* Add audio feedback to input mode keys to drive konstantin up a wall
* Tap_code cleanup
* Update keycodes
* Update unicode documentation
* Update unicode keycodes for consistency/easier merge
* Add Audio Feedback section
* Remove Functions from feature page
And link to the file instead. Link to specific lines later on.
* Fix white spaces
Co-Authored-By: drashna <drashna@live.com>
* Fix spacing
Co-Authored-By: drashna <drashna@live.com>
* Because I missed it!
Co-Authored-By: drashna <drashna@live.com>
* Fix spacing
Co-Authored-By: drashna <drashna@live.com>
* SPAAAAAAAAAACing
Co-Authored-By: drashna <drashna@live.com>
* white spaces
Co-Authored-By: drashna <drashna@live.com>
* Add BSD for future compatibility
* Thought I fixed that!
Co-Authored-By: drashna <drashna@live.com>
* non-breaking
Co-Authored-By: drashna <drashna@live.com>
* Considered that
Co-Authored-By: drashna <drashna@live.com>
* Yuuup
Co-Authored-By: drashna <drashna@live.com>
* consistency
Co-Authored-By: drashna <drashna@live.com>
* white spaces .... copied from elsewhere
Co-Authored-By: drashna <drashna@live.com>
* white spaces
Co-Authored-By: drashna <drashna@live.com>
* white spaces
Co-Authored-By: drashna <drashna@live.com>
* Update keycode defines
* Fix Linux Song
* Update all of the songs
* Cleanup
* Move and update check to ensure only one unicode method is enabled
* Update quantum/quantum_keycodes.h
* Update documentation
* Wordsmithing and cleanup
* Format unicode_common (#13)
* case alignment
* process_record_unicode_common → process_unicode_common
* Move song arrays into function where they're used, align preprocessor directives
* Swap the order of UC_WIN and UC_BSD
* Update Unicode docs
* Reorder Unicode mode stuff to match the order of input mode constants
* Fix capitalization in doc subtitle
* Readd BSD and OSX_RALT songs
* Reword BSD note in docs
* Readd BSD keycode description
* Reword explanation of input on different platforms
* Steal vomindoraan's input mode documentation
Co-Authored-By: vomindoraan (vomindoraan@gmail.com)
* Willingly give Drashna the rest of my Unicode doc improvements
* Wordsmithing
Co-Authored-By: drashna <drashna@live.com>
* Rearrange process_unicode_common functions
* Make Unicode input mode constants (UC_*) an enum
* Simplify unicode_input_start/finish code
* Make the key used for WinCompose configurable
* Remove UC_OSX_RALT in favor of setting the key with UNICODE_OSX_KEY
* Update Unicode input mode doc
* Add descriptions and rearrange definitions in process_unicode_common.h
* Add registry command to Unicode docs + misc updates
* Reword an explanation in Unicode docs
* Add TODO comment
* Add cycle_unicode_input_mode and UNICODE_SELECTED_MODES macro
* Add an option for making cycle changes persistent
* Add debug prints to functions that change input_mode
* Use cycle_unicode_input_mode in whitefox/konstantin
* Add persist_unicode_input_mode function
* Add offset to cycle to allow stepping in reverse
* Add keycodes: UNICODE_MODE_FORWARD, UNICODE_MODE_REVERSE
Aliases: UC_MOD, UC_RMOD (respectively)
* REVERT ME: Undo changes to whitefox/konstantin to avoid conflicts
* Fix wrong constant name
* Revert "REVERT ME: Undo changes to whitefox/konstantin to avoid conflicts"
This reverts commit 42676bf251fc8e3823f5e614dad6e510ba47a2f3.
* Change dprintf text
* Give selected modes priority over EEPROM when !UNICODE_CYCLE_PERSIST
* Remove trailing whitespace
* Cleanup of RALT code and unicode compilation stuff
* Remove else for unicode handling
Diffstat (limited to 'quantum/process_keycode/process_unicode_common.h')
-rw-r--r-- | quantum/process_keycode/process_unicode_common.h | 66 |
1 files changed, 50 insertions, 16 deletions
diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h index e78e1cec6..e608ab76b 100644 --- a/quantum/process_keycode/process_unicode_common.h +++ b/quantum/process_keycode/process_unicode_common.h | |||
@@ -14,35 +14,71 @@ | |||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef PROCESS_UNICODE_COMMON_H | 17 | #pragma once |
18 | #define PROCESS_UNICODE_COMMON_H | ||
19 | 18 | ||
20 | #include "quantum.h" | 19 | #include "quantum.h" |
21 | 20 | ||
21 | #if defined(UNICODE_ENABLE) + defined(UNICODEMAP_ENABLE) + defined(UCIS_ENABLE) > 1 | ||
22 | #error "Cannot enable more than one Unicode method (UNICODE, UNICODEMAP, UCIS) at the same time" | ||
23 | #endif | ||
24 | |||
25 | // Keycodes used for starting Unicode input on different platforms | ||
26 | #ifndef UNICODE_OSX_KEY | ||
27 | #define UNICODE_OSX_KEY KC_LALT | ||
28 | #endif | ||
29 | #ifndef UNICODE_WINC_KEY | ||
30 | #define UNICODE_WINC_KEY KC_RALT | ||
31 | #endif | ||
32 | |||
33 | // Comma-delimited, ordered list of input modes selected for use (e.g. in cycle) | ||
34 | // Example: #define UNICODE_SELECTED_MODES UC_WINC, UC_LNX | ||
35 | #ifndef UNICODE_SELECTED_MODES | ||
36 | #define UNICODE_SELECTED_MODES -1 | ||
37 | #endif | ||
38 | |||
39 | // Whether input mode changes in cycle should be written to EEPROM | ||
40 | #ifndef UNICODE_CYCLE_PERSIST | ||
41 | #define UNICODE_CYCLE_PERSIST true | ||
42 | #endif | ||
43 | |||
44 | // Delay between starting Unicode input and sending a sequence, in ms | ||
22 | #ifndef UNICODE_TYPE_DELAY | 45 | #ifndef UNICODE_TYPE_DELAY |
23 | #define UNICODE_TYPE_DELAY 10 | 46 | #define UNICODE_TYPE_DELAY 10 |
24 | #endif | 47 | #endif |
25 | 48 | ||
26 | __attribute__ ((unused)) | 49 | enum unicode_input_modes { |
27 | static uint8_t input_mode; | 50 | UC_OSX, // Mac OS X using Unicode Hex Input |
51 | UC_LNX, // Linux using IBus | ||
52 | UC_WIN, // Windows using EnableHexNumpad | ||
53 | UC_BSD, // BSD (not implemented) | ||
54 | UC_WINC, // Windows using WinCompose (https://github.com/samhocevar/wincompose) | ||
55 | UC__COUNT // Number of available input modes (always leave at the end) | ||
56 | }; | ||
57 | |||
58 | typedef union { | ||
59 | uint32_t raw; | ||
60 | struct { | ||
61 | uint8_t input_mode : 8; | ||
62 | }; | ||
63 | } unicode_config_t; | ||
64 | |||
65 | extern unicode_config_t unicode_config; | ||
28 | 66 | ||
29 | void set_unicode_input_mode(uint8_t os_target); | ||
30 | uint8_t get_unicode_input_mode(void); | ||
31 | void unicode_input_mode_init(void); | 67 | void unicode_input_mode_init(void); |
68 | uint8_t get_unicode_input_mode(void); | ||
69 | void set_unicode_input_mode(uint8_t mode); | ||
70 | void cycle_unicode_input_mode(uint8_t offset); | ||
71 | void persist_unicode_input_mode(void); | ||
72 | |||
32 | void unicode_input_start(void); | 73 | void unicode_input_start(void); |
33 | void unicode_input_finish(void); | 74 | void unicode_input_finish(void); |
75 | |||
34 | void register_hex(uint16_t hex); | 76 | void register_hex(uint16_t hex); |
35 | void send_unicode_hex_string(const char *str); | 77 | void send_unicode_hex_string(const char *str); |
36 | 78 | ||
37 | #define UC_OSX 0 // Mac OS X | 79 | bool process_unicode_common(uint16_t keycode, keyrecord_t *record); |
38 | #define UC_LNX 1 // Linux | ||
39 | #define UC_WIN 2 // Windows 'HexNumpad' | ||
40 | #define UC_BSD 3 // BSD (not implemented) | ||
41 | #define UC_WINC 4 // WinCompose https://github.com/samhocevar/wincompose | ||
42 | #define UC_OSX_RALT 5 // Mac OS X using Right Alt key for Unicode Compose | ||
43 | 80 | ||
44 | #define UC_BSPC UC(0x0008) | 81 | #define UC_BSPC UC(0x0008) |
45 | |||
46 | #define UC_SPC UC(0x0020) | 82 | #define UC_SPC UC(0x0020) |
47 | 83 | ||
48 | #define UC_EXLM UC(0x0021) | 84 | #define UC_EXLM UC(0x0021) |
@@ -147,5 +183,3 @@ void send_unicode_hex_string(const char *str); | |||
147 | #define UC_RCBR UC(0x007D) | 183 | #define UC_RCBR UC(0x007D) |
148 | #define UC_TILD UC(0x007E) | 184 | #define UC_TILD UC(0x007E) |
149 | #define UC_DEL UC(0x007F) | 185 | #define UC_DEL UC(0x007F) |
150 | |||
151 | #endif | ||