Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriain holmes <iaholmes@microsoft.com>2022-02-11 23:29:02 +0300
committeriain holmes <iaholmes@microsoft.com>2022-02-11 23:29:02 +0300
commitf0e37f3525eae3e07b425e9eaf17aa4e1c9b6b10 (patch)
treec051999a08dc2f797fc0c3ef16a6804f96d32bdb
parentdbc2e154d977555e93efdc466c92285a51b86aa9 (diff)
[Xwt.Mac] Handle non-roman keyboard layouts correctly
Switch to using Characters instead of CharactersIgnoringModifiers as Cocoa passes the Roman key in Characters when used with a modifier so that commands like cmd+v still work correctly Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1454138
-rw-r--r--Xwt.XamMac/Xwt.Mac/KeyboardUtil.cs9
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;