Browse Source

add UC_OSX_RALT to make unicode use the Right Alt key on OSX

pull/1663/head 0.5.118
Marco Fontani 6 years ago
committed by Jack Humbert
parent
commit
da83f04a30
4 changed files with 10 additions and 2 deletions
  1. +1
    -0
      docs/unicode.md
  2. +6
    -0
      quantum/process_keycode/process_unicode_common.c
  3. +1
    -0
      quantum/process_keycode/process_unicode_common.h
  4. +2
    -2
      quantum/process_keycode/process_unicodemap.c

+ 1
- 0
docs/unicode.md View File

@ -24,6 +24,7 @@ sort of like macro. Unfortunately, each OS has different ideas on how Unicode is
This is the current list of Unicode input method in QMK:
* UC_OSX: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex.
* UC_OSX_RALT: Same as UC_OSX, but sends the Rigt Alt key for unicode input
* UC_LNX: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else.
* UC_WIN: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead.
* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.


+ 6
- 0
quantum/process_keycode/process_unicode_common.c View File

@ -49,6 +49,9 @@ void unicode_input_start (void) {
case UC_OSX:
register_code(KC_LALT);
break;
case UC_OSX_RALT:
register_code(KC_RALT);
break;
case UC_LNX:
register_code(KC_LCTL);
register_code(KC_LSFT);
@ -78,6 +81,9 @@ void unicode_input_finish (void) {
case UC_WIN:
unregister_code(KC_LALT);
break;
case UC_OSX_RALT:
unregister_code(KC_RALT);
break;
case UC_LNX:
register_code(KC_SPC);
unregister_code(KC_SPC);


+ 1
- 0
quantum/process_keycode/process_unicode_common.h View File

@ -37,6 +37,7 @@ void register_hex(uint16_t hex);
#define UC_WIN 2 // Windows 'HexNumpad'
#define UC_BSD 3 // BSD (not implemented)
#define UC_WINC 4 // WinCompose https://github.com/samhocevar/wincompose
#define UC_OSX_RALT 5 // Mac OS X using Right Alt key for Unicode Compose
#define UC_BSPC UC(0x0008)


+ 2
- 2
quantum/process_keycode/process_unicodemap.c View File

@ -50,7 +50,7 @@ bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
const uint32_t* map = unicode_map;
uint16_t index = keycode - QK_UNICODE_MAP;
uint32_t code = pgm_read_dword(&map[index]);
if (code > 0xFFFF && code <= 0x10ffff && input_mode == UC_OSX) {
if (code > 0xFFFF && code <= 0x10ffff && (input_mode == UC_OSX || input_mode == UC_OSX_RALT)) {
// Convert to UTF-16 surrogate pair
code -= 0x10000;
uint32_t lo = code & 0x3ff;
@ -59,7 +59,7 @@ bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
register_hex32(hi + 0xd800);
register_hex32(lo + 0xdc00);
unicode_input_finish();
} else if ((code > 0x10ffff && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) {
} else if ((code > 0x10ffff && (input_mode == UC_OSX || input_mode == UC_OSX_RALT)) || (code > 0xFFFFF && input_mode == UC_LNX)) {
// when character is out of range supported by the OS
unicode_map_input_error();
} else {


Loading…
Cancel
Save