diff options
author | iain <iaholmes@microsoft.com> | 2022-02-14 12:24:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-14 12:24:07 +0300 |
commit | 36c89b26f75bf820c831b684a5cc82498f646025 (patch) | |
tree | c051999a08dc2f797fc0c3ef16a6804f96d32bdb | |
parent | dbc2e154d977555e93efdc466c92285a51b86aa9 (diff) | |
parent | f0e37f3525eae3e07b425e9eaf17aa4e1c9b6b10 (diff) |
Merge pull request #1083 from mono/dev/iain/fix-1454138
[Xwt.Mac] Handle non-roman keyboard layouts correctly
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/KeyboardUtil.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Xwt.XamMac/Xwt.Mac/KeyboardUtil.cs b/Xwt.XamMac/Xwt.Mac/KeyboardUtil.cs index 0c6a1e8d..0215067f 100644 --- a/Xwt.XamMac/Xwt.Mac/KeyboardUtil.cs +++ b/Xwt.XamMac/Xwt.Mac/KeyboardUtil.cs @@ -121,7 +121,14 @@ namespace Xwt.Mac // character keys: use character comparison, since KeyCode is always US // and does not honor inernationalization like WPF or GTK - var characters = keyEvent.CharactersIgnoringModifiers; + + // How non-roman keyboards seem to work in Cocoa, for example a Russian keyboard, is like so + // If you press the м key on the keyboard (which is the 'v' key on a roman/english/qwerty keyboard) + // keyEvent.Characters and keyEvent.CharactersIgnoringModifers both contain м + // If you press the cmd+м on the keyboard, keyEvent.Characters contains a 'v' and keyEvent.CharactersIgnoringModifiers + // contains the м + // This way it can map cmd+м to paste like on a roman keyboard. + var characters = keyEvent.Characters; if (characters.Length > 0) switch (characters[0]) { case 'A': return Key.a; |