[Feature Request] - Support accented characters (non-us keyboard) on MacOS and Linux
It's missing support for accented characters in event SAPP_EVENTTYPE_CHAR on MacOS (using dead keys) for non-us keyboards. Like this: á, ã, ù, etc.
I checked and maybe necessary to use UCKeyTranslate, like this example: https://stackoverflow.com/questions/22566665/how-to-capture-unicode-from-key-events-without-an-nstextview
I found a more ellegant solution in GLFW, using NSTextInputClient protocol in NSView, like this example: https://github.com/glfw/glfw/blob/3.3.2/src/cocoa_window.m
It works perfectly!
The same behavior seems to appear in Linux (Ubuntu 20.04.3 LTS). The sokol_app uses XLookupString inside KeyPress to capture char, but it is not working with accented characters.
Using xev command at terminal I get this result when I press "´" and "a":
KeyPress event, serial 37, synthetic NO, window 0x2400001,
root 0x17d, subw 0x0, time 11120406, (153,-22), root:(259,92),
state 0x10, keycode 34 (keysym 0xfe51, dead_acute), same_screen YES,
XLookupString gives 2 bytes: (c2 b4) "´"
XmbLookupString gives 0 bytes:
XFilterEvent returns: True
KeyRelease event, serial 37, synthetic NO, window 0x2400001,
root 0x17d, subw 0x0, time 11120469, (153,-22), root:(259,92),
state 0x10, keycode 34 (keysym 0xfe51, dead_acute), same_screen YES,
XLookupString gives 2 bytes: (c2 b4) "´"
XFilterEvent returns: False
KeyPress event, serial 37, synthetic NO, window 0x2400001,
root 0x17d, subw 0x0, time 11123685, (153,-22), root:(259,92),
state 0x10, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XmbLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: True
KeyPress event, serial 37, synthetic NO, window 0x2400001,
root 0x17d, subw 0x0, time 11123685, (153,-22), root:(259,92),
state 0x10, keycode 0 (keysym 0xe1, aacute), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 2 bytes: (c3 a1) "á"
XFilterEvent returns: False
KeyRelease event, serial 37, synthetic NO, window 0x2400001,
root 0x17d, subw 0x0, time 11123778, (153,-22), root:(259,92),
state 0x10, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False
It seems that using XmbLookupString I can get the correct character "á".
https://www.x.org/releases/current/doc/man/man3/XmbLookupString.3.xhtml
As on MacOS, on Linux, GLFW latest release also works correctly: https://github.com/glfw/glfw/blob/3.3.6/src/x11_window.c