1
0
Fork 0

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
This commit is contained in:
Konstantin Đorđević 2020-03-31 18:28:43 +02:00 committed by GitHub
parent 51a81813b0
commit bdfdc506da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 41 additions and 28 deletions

View file

@ -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: 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. 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. !> 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). * **`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. 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_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_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_LNX` |`UC_M_LN`|`UC_LNX` |Switch to Linux input |
|`UNICODE_MODE_WIN` |`UC_M_WI`|`UC_WIN` |Switch to Windows 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) | |`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: For instance, you can add these definitions to your `config.h` file:
```c ```c
#define UNICODE_SONG_OSX COIN_SOUND #define UNICODE_SONG_MAC AUDIO_ON_SOUND
#define UNICODE_SONG_LNX UNICODE_LINUX #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_WIN UNICODE_WINDOWS
#define UNICODE_SONG_WINC 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 | |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_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` | |`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. 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 ```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`). 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`).

View file

@ -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| |`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_FORWARD`|`UC_MOD` |Cycle through selected input modes |
|`UNICODE_MODE_REVERSE`|`UC_RMOD`|Cycle through selected input modes in reverse | |`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_LNX` |`UC_M_LN`|Switch to Linux input |
|`UNICODE_MODE_WIN` |`UC_M_WI`|Switch to Windows input | |`UNICODE_MODE_WIN` |`UC_M_WI`|Switch to Windows input |
|`UNICODE_MODE_BSD` |`UC_M_BS`|Switch to BSD input (not implemented) | |`UNICODE_MODE_BSD` |`UC_M_BS`|Switch to BSD input (not implemented) |

View file

@ -397,7 +397,7 @@ qmk_dict = {
"_sp_swp": "SHT(KC_SPC)", "_sp_swp": "SHT(KC_SPC)",
# Unicode support (via X()) included implicitly # Unicode support (via X()) included implicitly
# Switching Unicode Input Modes # 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 # custom keys
"altF4": "LALT(KC_F4)", "altF4": "LALT(KC_F4)",

View file

@ -78,8 +78,8 @@ __attribute__((weak)) void unicode_input_start(void) {
clear_mods(); // Unregister mods to start from a clean state clear_mods(); // Unregister mods to start from a clean state
switch (unicode_config.input_mode) { switch (unicode_config.input_mode) {
case UC_OSX: case UC_MAC:
register_code(UNICODE_KEY_OSX); register_code(UNICODE_KEY_MAC);
break; break;
case UC_LNX: case UC_LNX:
tap_code16(UNICODE_KEY_LNX); tap_code16(UNICODE_KEY_LNX);
@ -99,8 +99,8 @@ __attribute__((weak)) void unicode_input_start(void) {
__attribute__((weak)) void unicode_input_finish(void) { __attribute__((weak)) void unicode_input_finish(void) {
switch (unicode_config.input_mode) { switch (unicode_config.input_mode) {
case UC_OSX: case UC_MAC:
unregister_code(UNICODE_KEY_OSX); unregister_code(UNICODE_KEY_MAC);
break; break;
case UC_LNX: case UC_LNX:
tap_code(KC_SPC); tap_code(KC_SPC);
@ -118,8 +118,8 @@ __attribute__((weak)) void unicode_input_finish(void) {
__attribute__((weak)) void unicode_input_cancel(void) { __attribute__((weak)) void unicode_input_cancel(void) {
switch (unicode_config.input_mode) { switch (unicode_config.input_mode) {
case UC_OSX: case UC_MAC:
unregister_code(UNICODE_KEY_OSX); unregister_code(UNICODE_KEY_MAC);
break; break;
case UC_LNX: case UC_LNX:
case UC_WINC: case UC_WINC:
@ -253,11 +253,11 @@ bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
cycle_unicode_input_mode(-1); cycle_unicode_input_mode(-1);
break; break;
case UNICODE_MODE_OSX: case UNICODE_MODE_MAC:
set_unicode_input_mode(UC_OSX); set_unicode_input_mode(UC_MAC);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX) #if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_MAC)
static float song_osx[][2] = UNICODE_SONG_OSX; static float song_mac[][2] = UNICODE_SONG_MAC;
PLAY_SONG(song_osx); PLAY_SONG(song_mac);
#endif #endif
break; break;
case UNICODE_MODE_LNX: case UNICODE_MODE_LNX:

View file

@ -23,8 +23,8 @@
#endif #endif
// Keycodes used for starting Unicode input on different platforms // Keycodes used for starting Unicode input on different platforms
#ifndef UNICODE_KEY_OSX #ifndef UNICODE_KEY_MAC
# define UNICODE_KEY_OSX KC_LALT # define UNICODE_KEY_MAC KC_LALT
#endif #endif
#ifndef UNICODE_KEY_LNX #ifndef UNICODE_KEY_LNX
# define UNICODE_KEY_LNX LCTL(LSFT(KC_U)) # define UNICODE_KEY_LNX LCTL(LSFT(KC_U))
@ -49,8 +49,17 @@
# define UNICODE_TYPE_DELAY 10 # define UNICODE_TYPE_DELAY 10
#endif #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 { 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_LNX, // Linux using IBus
UC_WIN, // Windows using EnableHexNumpad UC_WIN, // Windows using EnableHexNumpad
UC_BSD, // BSD (not implemented) UC_BSD, // BSD (not implemented)

View file

@ -43,7 +43,7 @@ bool process_unicodemap(uint16_t keycode, keyrecord_t *record) {
if (code > 0x10FFFF || (code > 0xFFFF && input_mode == UC_WIN)) { if (code > 0x10FFFF || (code > 0xFFFF && input_mode == UC_WIN)) {
// Character is out of range supported by the platform // Character is out of range supported by the platform
unicode_input_cancel(); 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 // Convert to UTF-16 surrogate pair on Mac
code -= 0x10000; code -= 0x10000;
uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10; uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10;

View file

@ -459,7 +459,7 @@ enum quantum_keycodes {
UNICODE_MODE_FORWARD, UNICODE_MODE_FORWARD,
UNICODE_MODE_REVERSE, UNICODE_MODE_REVERSE,
UNICODE_MODE_OSX, UNICODE_MODE_MAC,
UNICODE_MODE_LNX, UNICODE_MODE_LNX,
UNICODE_MODE_WIN, UNICODE_MODE_WIN,
UNICODE_MODE_BSD, UNICODE_MODE_BSD,
@ -777,7 +777,9 @@ enum quantum_keycodes {
#define UC_MOD UNICODE_MODE_FORWARD #define UC_MOD UNICODE_MODE_FORWARD
#define UC_RMOD UNICODE_MODE_REVERSE #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_LN UNICODE_MODE_LNX
#define UC_M_WI UNICODE_MODE_WIN #define UC_M_WI UNICODE_MODE_WIN
#define UC_M_BS UNICODE_MODE_BSD #define UC_M_BS UNICODE_MODE_BSD

View file

@ -21,7 +21,7 @@
# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f # 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_LNX SONG(RICK_ROLL)
# define UNICODE_SONG_WIN SONG(RICK_ROLL) # define UNICODE_SONG_WIN SONG(RICK_ROLL)
# define UNICODE_SONG_BSD SONG(RICK_ROLL) # define UNICODE_SONG_BSD SONG(RICK_ROLL)

View file

@ -11,7 +11,7 @@
# undef NOTE_REST # undef NOTE_REST
# define NOTE_REST 1.00f # define NOTE_REST 1.00f
# endif // !__arm__ # 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_LNX SONG(RICK_ROLL)
# define UNICODE_SONG_WIN SONG(RICK_ROLL) # define UNICODE_SONG_WIN SONG(RICK_ROLL)
# define UNICODE_SONG_BSD SONG(RICK_ROLL) # define UNICODE_SONG_BSD SONG(RICK_ROLL)