aboutsummaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorKonstantin Đorđević <vomindoraan@gmail.com>2020-03-31 18:28:43 +0200
committerGitHub <noreply@github.com>2020-03-31 18:28:43 +0200
commitbdfdc506da7702960bf3f6167a3a95f1230b0397 (patch)
tree7ff6d48d076fd04e55cb54320cc504d393985d80 /quantum/process_keycode
parent51a81813b0191d95f3ed774cbc410579e606dc5c (diff)
downloadqmk_firmware-bdfdc506da7702960bf3f6167a3a95f1230b0397.tar.gz
qmk_firmware-bdfdc506da7702960bf3f6167a3a95f1230b0397.zip
Rename UC_OSX (and related constants) to UC_MAC (#8589)
* Rename UC_OSX (and related constants) to UC_MAC * Update UNICODE_SONG_OSX references to UNICODE_SONG_MAC * Update UC_M_OS references to UC_M_MA * Add UC_OSX alias for backwards compatibility * Add deprecation warning for UC_OSX to Unicode docs * Add UC_M_OS alias for backwards compatibility * Update newly found UC_M_OS and UNICODE_SONG_OSX references * Add legacy UNICODE_MODE_OSX alias, revert changes to user keymaps * Add legacy UNICODE_SONG_OSX alias, revert changes to user keymaps * Replace removed sounds in Unicode song doc examples
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_unicode_common.c22
-rw-r--r--quantum/process_keycode/process_unicode_common.h15
-rw-r--r--quantum/process_keycode/process_unicodemap.c2
3 files changed, 24 insertions, 15 deletions
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index fc392813a..48ce3961a 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -78,8 +78,8 @@ __attribute__((weak)) void unicode_input_start(void) {
78 clear_mods(); // Unregister mods to start from a clean state 78 clear_mods(); // Unregister mods to start from a clean state
79 79
80 switch (unicode_config.input_mode) { 80 switch (unicode_config.input_mode) {
81 case UC_OSX: 81 case UC_MAC:
82 register_code(UNICODE_KEY_OSX); 82 register_code(UNICODE_KEY_MAC);
83 break; 83 break;
84 case UC_LNX: 84 case UC_LNX:
85 tap_code16(UNICODE_KEY_LNX); 85 tap_code16(UNICODE_KEY_LNX);
@@ -99,8 +99,8 @@ __attribute__((weak)) void unicode_input_start(void) {
99 99
100__attribute__((weak)) void unicode_input_finish(void) { 100__attribute__((weak)) void unicode_input_finish(void) {
101 switch (unicode_config.input_mode) { 101 switch (unicode_config.input_mode) {
102 case UC_OSX: 102 case UC_MAC:
103 unregister_code(UNICODE_KEY_OSX); 103 unregister_code(UNICODE_KEY_MAC);
104 break; 104 break;
105 case UC_LNX: 105 case UC_LNX:
106 tap_code(KC_SPC); 106 tap_code(KC_SPC);
@@ -118,8 +118,8 @@ __attribute__((weak)) void unicode_input_finish(void) {
118 118
119__attribute__((weak)) void unicode_input_cancel(void) { 119__attribute__((weak)) void unicode_input_cancel(void) {
120 switch (unicode_config.input_mode) { 120 switch (unicode_config.input_mode) {
121 case UC_OSX: 121 case UC_MAC:
122 unregister_code(UNICODE_KEY_OSX); 122 unregister_code(UNICODE_KEY_MAC);
123 break; 123 break;
124 case UC_LNX: 124 case UC_LNX:
125 case UC_WINC: 125 case UC_WINC:
@@ -253,11 +253,11 @@ bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
253 cycle_unicode_input_mode(-1); 253 cycle_unicode_input_mode(-1);
254 break; 254 break;
255 255
256 case UNICODE_MODE_OSX: 256 case UNICODE_MODE_MAC:
257 set_unicode_input_mode(UC_OSX); 257 set_unicode_input_mode(UC_MAC);
258#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX) 258#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_MAC)
259 static float song_osx[][2] = UNICODE_SONG_OSX; 259 static float song_mac[][2] = UNICODE_SONG_MAC;
260 PLAY_SONG(song_osx); 260 PLAY_SONG(song_mac);
261#endif 261#endif
262 break; 262 break;
263 case UNICODE_MODE_LNX: 263 case UNICODE_MODE_LNX:
diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h
index 13b6431bf..5421c28c7 100644
--- a/quantum/process_keycode/process_unicode_common.h
+++ b/quantum/process_keycode/process_unicode_common.h
@@ -23,8 +23,8 @@
23#endif 23#endif
24 24
25// Keycodes used for starting Unicode input on different platforms 25// Keycodes used for starting Unicode input on different platforms
26#ifndef UNICODE_KEY_OSX 26#ifndef UNICODE_KEY_MAC
27# define UNICODE_KEY_OSX KC_LALT 27# define UNICODE_KEY_MAC KC_LALT
28#endif 28#endif
29#ifndef UNICODE_KEY_LNX 29#ifndef UNICODE_KEY_LNX
30# define UNICODE_KEY_LNX LCTL(LSFT(KC_U)) 30# define UNICODE_KEY_LNX LCTL(LSFT(KC_U))
@@ -49,8 +49,17 @@
49# define UNICODE_TYPE_DELAY 10 49# define UNICODE_TYPE_DELAY 10
50#endif 50#endif
51 51
52// Deprecated aliases
53#if !defined(UNICODE_KEY_MAC) && defined(UNICODE_KEY_OSX)
54# define UNICODE_KEY_MAC UNICODE_KEY_OSX
55#endif
56#if !defined(UNICODE_SONG_MAC) && defined(UNICODE_SONG_OSX)
57# define UNICODE_SONG_MAC UNICODE_SONG_OSX
58#endif
59#define UC_OSX UC_MAC
60
52enum unicode_input_modes { 61enum unicode_input_modes {
53 UC_OSX, // Mac OS X using Unicode Hex Input 62 UC_MAC, // macOS using Unicode Hex Input
54 UC_LNX, // Linux using IBus 63 UC_LNX, // Linux using IBus
55 UC_WIN, // Windows using EnableHexNumpad 64 UC_WIN, // Windows using EnableHexNumpad
56 UC_BSD, // BSD (not implemented) 65 UC_BSD, // BSD (not implemented)
diff --git a/quantum/process_keycode/process_unicodemap.c b/quantum/process_keycode/process_unicodemap.c
index 1be51a995..5445cde12 100644
--- a/quantum/process_keycode/process_unicodemap.c
+++ b/quantum/process_keycode/process_unicodemap.c
@@ -43,7 +43,7 @@ bool process_unicodemap(uint16_t keycode, keyrecord_t *record) {
43 if (code > 0x10FFFF || (code > 0xFFFF && input_mode == UC_WIN)) { 43 if (code > 0x10FFFF || (code > 0xFFFF && input_mode == UC_WIN)) {
44 // Character is out of range supported by the platform 44 // Character is out of range supported by the platform
45 unicode_input_cancel(); 45 unicode_input_cancel();
46 } else if (code > 0xFFFF && input_mode == UC_OSX) { 46 } else if (code > 0xFFFF && input_mode == UC_MAC) {
47 // Convert to UTF-16 surrogate pair on Mac 47 // Convert to UTF-16 surrogate pair on Mac
48 code -= 0x10000; 48 code -= 0x10000;
49 uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10; 49 uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10;