From bdfdc506da7702960bf3f6167a3a95f1230b0397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Tue, 31 Mar 2020 18:28:43 +0200 Subject: [PATCH] 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 --- docs/feature_unicode.md | 16 ++++++++------ docs/keycodes.md | 2 +- .../3_0/elitec/keymaps/default/layout.py | 2 +- .../process_keycode/process_unicode_common.c | 22 +++++++++---------- .../process_keycode/process_unicode_common.h | 15 ++++++++++--- quantum/process_keycode/process_unicodemap.c | 2 +- quantum/quantum_keycodes.h | 6 +++-- users/drashna/config.h | 2 +- users/kuchosauronad0/config.h | 2 +- 9 files changed, 41 insertions(+), 28 deletions(-) diff --git a/docs/feature_unicode.md b/docs/feature_unicode.md index 697541458..a6f2cb4d0 100644 --- a/docs/feature_unicode.md +++ b/docs/feature_unicode.md @@ -90,13 +90,15 @@ Unicode input in QMK works by inputting a sequence of characters to the OS, sort The following input modes are available: -* **`UC_OSX`**: macOS built-in Unicode hex input. Supports code points up to `0xFFFF` (`0x10FFFF` with Unicode Map). +* **`UC_MAC`**: macOS built-in Unicode hex input. Supports code points up to `0xFFFF` (`0x10FFFF` with Unicode Map). 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. - By default, this mode uses the left Option key (`KC_LALT`) for Unicode input, but this can be changed by defining [`UNICODE_KEY_OSX`](#input-key-configuration) with another keycode. + By default, this mode uses the left Option key (`KC_LALT`) for Unicode input, but this can be changed by defining [`UNICODE_KEY_MAC`](#input-key-configuration) with another keycode. !> Using the _Unicode Hex Input_ input source may disable some Option based shortcuts, such as Option + Left Arrow and Option + Right Arrow. + !> `UC_OSX` is a deprecated alias of `UC_MAC` that will be removed in a future version of QMK. + * **`UC_LNX`**: Linux built-in IBus Unicode input. Supports code points up to `0x10FFFF` (all possible code points). Enabled by default and works almost anywhere on IBus-enabled distros. Without IBus, this mode works under GTK apps, but rarely anywhere else. @@ -124,7 +126,7 @@ You can switch the input mode at any time by using one of the following keycodes |----------------------|---------|------------|--------------------------------------------------------------| |`UNICODE_MODE_FORWARD`|`UC_MOD` |Next in list|[Cycle](#input-mode-cycling) through selected modes | |`UNICODE_MODE_REVERSE`|`UC_RMOD`|Prev in list|[Cycle](#input-mode-cycling) through selected modes in reverse| -|`UNICODE_MODE_OSX` |`UC_M_OS`|`UC_OSX` |Switch to macOS input | +|`UNICODE_MODE_MAC` |`UC_M_MA`|`UC_MAC` |Switch to macOS input | |`UNICODE_MODE_LNX` |`UC_M_LN`|`UC_LNX` |Switch to Linux input | |`UNICODE_MODE_WIN` |`UC_M_WI`|`UC_WIN` |Switch to Windows input | |`UNICODE_MODE_BSD` |`UC_M_BS`|`UC_BSD` |Switch to BSD input (not implemented) | @@ -145,9 +147,9 @@ If you have the [Audio feature](feature_audio.md) enabled on the board, you can For instance, you can add these definitions to your `config.h` file: ```c -#define UNICODE_SONG_OSX COIN_SOUND +#define UNICODE_SONG_MAC AUDIO_ON_SOUND #define UNICODE_SONG_LNX UNICODE_LINUX -#define UNICODE_SONG_BSD MARIO_GAMEOVER +#define UNICODE_SONG_BSD TERMINAL_SOUND #define UNICODE_SONG_WIN UNICODE_WINDOWS #define UNICODE_SONG_WINC UNICODE_WINDOWS ``` @@ -171,7 +173,7 @@ You can customize the keys used to trigger Unicode input for macOS, Linux and Wi |Define |Type |Default |Example | |------------------|----------|------------------|-------------------------------------------| -|`UNICODE_KEY_OSX` |`uint8_t` |`KC_LALT` |`#define UNICODE_KEY_OSX KC_RALT` | +|`UNICODE_KEY_MAC` |`uint8_t` |`KC_LALT` |`#define UNICODE_KEY_MAC KC_RALT` | |`UNICODE_KEY_LNX` |`uint16_t`|`LCTL(LSFT(KC_U))`|`#define UNICODE_KEY_LNX LCTL(LSFT(KC_E))`| |`UNICODE_KEY_WINC`|`uint8_t` |`KC_RALT` |`#define UNICODE_KEY_WINC KC_RGUI` | @@ -180,7 +182,7 @@ You can customize the keys used to trigger Unicode input for macOS, Linux and Wi You can choose which input modes are available for cycling through. By default, this is disabled. If you want to enable it, limiting it to just the modes you use makes sense. Note that the values in the list are comma-delimited. ```c -#define UNICODE_SELECTED_MODES UC_OSX, UC_LNX, UC_WIN, UC_WINC +#define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WIN, UC_WINC ``` You can cycle through the selected modes by using the `UC_MOD`/`UC_RMOD` keycodes, or by calling `cycle_unicode_input_mode(offset)` in your code (`offset` is how many modes to move forward by, so +1 corresponds to `UC_MOD`). diff --git a/docs/keycodes.md b/docs/keycodes.md index 84da3d4c6..1a388f106 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md @@ -543,7 +543,7 @@ See also: [Unicode Support](feature_unicode.md) |`XP(i, j)` | |Send Unicode code point at index `i`, or `j` if Shift/Caps is on| |`UNICODE_MODE_FORWARD`|`UC_MOD` |Cycle through selected input modes | |`UNICODE_MODE_REVERSE`|`UC_RMOD`|Cycle through selected input modes in reverse | -|`UNICODE_MODE_OSX` |`UC_M_OS`|Switch to macOS input | +|`UNICODE_MODE_MAC` |`UC_M_MA`|Switch to macOS input | |`UNICODE_MODE_LNX` |`UC_M_LN`|Switch to Linux input | |`UNICODE_MODE_WIN` |`UC_M_WI`|Switch to Windows input | |`UNICODE_MODE_BSD` |`UC_M_BS`|Switch to BSD input (not implemented) | diff --git a/keyboards/signum/3_0/elitec/keymaps/default/layout.py b/keyboards/signum/3_0/elitec/keymaps/default/layout.py index ab9bce422..1e43e25c5 100644 --- a/keyboards/signum/3_0/elitec/keymaps/default/layout.py +++ b/keyboards/signum/3_0/elitec/keymaps/default/layout.py @@ -397,7 +397,7 @@ qmk_dict = { "_sp_swp": "SHT(KC_SPC)", # Unicode support (via X()) included implicitly # Switching Unicode Input Modes - "UC_win": "UC_M_WC", "UC_lnx": "UC_M_LN", "UC_osx": "UC_M_OS", + "UC_win": "UC_M_WC", "UC_lnx": "UC_M_LN", "UC_mac": "UC_M_MA", # custom keys "altF4": "LALT(KC_F4)", 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) { clear_mods(); // Unregister mods to start from a clean state switch (unicode_config.input_mode) { - case UC_OSX: - register_code(UNICODE_KEY_OSX); + case UC_MAC: + register_code(UNICODE_KEY_MAC); break; case UC_LNX: tap_code16(UNICODE_KEY_LNX); @@ -99,8 +99,8 @@ __attribute__((weak)) void unicode_input_start(void) { __attribute__((weak)) void unicode_input_finish(void) { switch (unicode_config.input_mode) { - case UC_OSX: - unregister_code(UNICODE_KEY_OSX); + case UC_MAC: + unregister_code(UNICODE_KEY_MAC); break; case UC_LNX: tap_code(KC_SPC); @@ -118,8 +118,8 @@ __attribute__((weak)) void unicode_input_finish(void) { __attribute__((weak)) void unicode_input_cancel(void) { switch (unicode_config.input_mode) { - case UC_OSX: - unregister_code(UNICODE_KEY_OSX); + case UC_MAC: + unregister_code(UNICODE_KEY_MAC); break; case UC_LNX: case UC_WINC: @@ -253,11 +253,11 @@ bool process_unicode_common(uint16_t keycode, keyrecord_t *record) { cycle_unicode_input_mode(-1); break; - case UNICODE_MODE_OSX: - set_unicode_input_mode(UC_OSX); -#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX) - static float song_osx[][2] = UNICODE_SONG_OSX; - PLAY_SONG(song_osx); + case UNICODE_MODE_MAC: + set_unicode_input_mode(UC_MAC); +#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_MAC) + static float song_mac[][2] = UNICODE_SONG_MAC; + PLAY_SONG(song_mac); #endif break; 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 @@ #endif // Keycodes used for starting Unicode input on different platforms -#ifndef UNICODE_KEY_OSX -# define UNICODE_KEY_OSX KC_LALT +#ifndef UNICODE_KEY_MAC +# define UNICODE_KEY_MAC KC_LALT #endif #ifndef UNICODE_KEY_LNX # define UNICODE_KEY_LNX LCTL(LSFT(KC_U)) @@ -49,8 +49,17 @@ # define UNICODE_TYPE_DELAY 10 #endif +// Deprecated aliases +#if !defined(UNICODE_KEY_MAC) && defined(UNICODE_KEY_OSX) +# define UNICODE_KEY_MAC UNICODE_KEY_OSX +#endif +#if !defined(UNICODE_SONG_MAC) && defined(UNICODE_SONG_OSX) +# define UNICODE_SONG_MAC UNICODE_SONG_OSX +#endif +#define UC_OSX UC_MAC + enum unicode_input_modes { - UC_OSX, // Mac OS X using Unicode Hex Input + UC_MAC, // macOS using Unicode Hex Input UC_LNX, // Linux using IBus UC_WIN, // Windows using EnableHexNumpad 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) { if (code > 0x10FFFF || (code > 0xFFFF && input_mode == UC_WIN)) { // Character is out of range supported by the platform unicode_input_cancel(); - } else if (code > 0xFFFF && input_mode == UC_OSX) { + } else if (code > 0xFFFF && input_mode == UC_MAC) { // Convert to UTF-16 surrogate pair on Mac code -= 0x10000; uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10; diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 54428fe1f..f6aac2234 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -459,7 +459,7 @@ enum quantum_keycodes { UNICODE_MODE_FORWARD, UNICODE_MODE_REVERSE, - UNICODE_MODE_OSX, + UNICODE_MODE_MAC, UNICODE_MODE_LNX, UNICODE_MODE_WIN, UNICODE_MODE_BSD, @@ -777,7 +777,9 @@ enum quantum_keycodes { #define UC_MOD UNICODE_MODE_FORWARD #define UC_RMOD UNICODE_MODE_REVERSE -#define UC_M_OS UNICODE_MODE_OSX +#define UC_M_MA UNICODE_MODE_MAC +#define UNICODE_MODE_OSX UNICODE_MODE_MAC // Deprecated alias +#define UC_M_OS UNICODE_MODE_MAC // Deprecated alias #define UC_M_LN UNICODE_MODE_LNX #define UC_M_WI UNICODE_MODE_WIN #define UC_M_BS UNICODE_MODE_BSD diff --git a/users/drashna/config.h b/users/drashna/config.h index 6fafff860..106ae19c1 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -21,7 +21,7 @@ # define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f -# define UNICODE_SONG_OSX SONG(RICK_ROLL) +# define UNICODE_SONG_MAC SONG(RICK_ROLL) # define UNICODE_SONG_LNX SONG(RICK_ROLL) # define UNICODE_SONG_WIN SONG(RICK_ROLL) # define UNICODE_SONG_BSD SONG(RICK_ROLL) diff --git a/users/kuchosauronad0/config.h b/users/kuchosauronad0/config.h index b06c9e2c5..58542dc18 100644 --- a/users/kuchosauronad0/config.h +++ b/users/kuchosauronad0/config.h @@ -11,7 +11,7 @@ # undef NOTE_REST # define NOTE_REST 1.00f # endif // !__arm__ -# define UNICODE_SONG_OSX SONG(RICK_ROLL) +# define UNICODE_SONG_MAC SONG(RICK_ROLL) # define UNICODE_SONG_LNX SONG(RICK_ROLL) # define UNICODE_SONG_WIN SONG(RICK_ROLL) # define UNICODE_SONG_BSD SONG(RICK_ROLL)