Better key handling for macOS and Qt#4216
Conversation
freakboy3742
left a comment
There was a problem hiding this comment.
It's a little difficult for me to live test without access to a UK (or other European) keyboard layout, but I can't fault the logic, and it all seems to work as expected.
|
For future reference, the way I've been testing this on macOS is to add new keyboard layouts in keyboard settings and then switch between them (I already had this set up for AU and GB) with a widget modified to get keyboard focus and events and report them. You don't get the exact same physical layout as a native language keyboard, but the key codes map correctly as best I can tell. Although it is surprising when you have your keyboard set to something like Slovenian to test, and then try to type some code and it comes out not quite right because you forgot to set it back to English... |
On macOS, this PR minimises the use of hardware key codes for interpreting key events on macOS in favour of using the various character methods to determine the intended key press based on the keyboard layout. It doesn't yet add toga support for non-US characters, but should improve things like mapping keys correctly on an AZERTY layout keyboard.
On Qt, this PR fixes some missing key codes and fixes some issues raised by new tests.
Ref #2428.
PR Checklist: