]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
add UC_OSX_RALT to make unicode use the Right Alt key on OSX
authorMarco Fontani <MFONTANI@cpan.org>
Mon, 28 Aug 2017 18:05:42 +0000 (20:05 +0200)
committerJack Humbert <jack.humb@gmail.com>
Wed, 30 Aug 2017 15:38:03 +0000 (11:38 -0400)
docs/unicode.md
quantum/process_keycode/process_unicode_common.c
quantum/process_keycode/process_unicode_common.h
quantum/process_keycode/process_unicodemap.c

index ae722fe2b467ba24a1df4a0112c9bdf8de5e6e6a..2dfb38d96ad8dbb4e15908b816c04ce025a77123 100644 (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.
index 84b5d673dd48ce473531d9549bf2f9f9dec12fb2..7f34ad57cfda08875e06816ed01d354723e2140b 100644 (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);
index f5be1da5cb15d32ab6f6f57d7039fc0c18973431..4d2b04fb392d57eaf2e5c21a10932eaffb1452b0 100644 (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)
 
index 75f35112b133db91c16d75a966a7b76d5afb2e12..47c27b9117161d1c3bf44739125032fc334afb22 100644 (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 {