From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/keyboard.c | 107 +++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 50 deletions(-)
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 832e6178466..33dbe509ff7 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -696,57 +696,62 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data) static const struct { WCHAR wchar; DWORD vkey; + /* Mac virtual key code that must match wchar under the current layout. + * A value of -1 means match-any. + * TODO: replace -1 with the actual mac virtual key codes for all mappings + * and their respective layouts to avoid false matches, when possible. */ + int mac_keyc; } symbol_vkeys[] = { - { '-', VK_OEM_MINUS }, - { '+', VK_OEM_PLUS }, - { '_', VK_OEM_MINUS }, - { ',', VK_OEM_COMMA }, - { '.', VK_OEM_PERIOD }, - { '=', VK_OEM_PLUS }, - { '>', VK_OEM_PERIOD }, - { '<', VK_OEM_COMMA }, - { '|', VK_OEM_5 }, - { '\', VK_OEM_5 }, - { '`', VK_OEM_3 }, - { '[', VK_OEM_4 }, - { '~', VK_OEM_3 }, - { 0x00DF, VK_OEM_4 }, /* 0x00DF is ESZETT */ - { 0x00FC, VK_OEM_1 }, /* 0x00FC is German U Umlaut */ - { 0x00F6, VK_OEM_3 }, /* 0x00F6 is German O Umlaut */ - { 0x00E4, VK_OEM_7 }, /* 0x00B4 is German A Umlaut */ - { '?', VK_OEM_2 }, - { ']', VK_OEM_6 }, - { '/', VK_OEM_2 }, - { ':', VK_OEM_1 }, - { '}', VK_OEM_6 }, - { '{', VK_OEM_4 }, - { ';', VK_OEM_1 }, - { ''', VK_OEM_7 }, - { ':', VK_OEM_PERIOD }, - { ';', VK_OEM_COMMA }, - { '"', VK_OEM_7 }, - { 0x00B4, VK_OEM_4 }, /* 0x00B4 is ACUTE ACCENT */ - { ''', VK_OEM_2 }, - { 0x00A7, VK_OEM_5 }, /* 0x00A7 is SECTION SIGN */ - { '*', VK_OEM_PLUS }, - { 0x00B4, VK_OEM_7 }, - { '`', VK_OEM_4 }, - { '[', VK_OEM_6 }, - { '/', VK_OEM_5 }, - { '^', VK_OEM_6 }, - { '*', VK_OEM_2 }, - { '{', VK_OEM_6 }, - { 0x00B4, VK_OEM_6 }, - { '~', VK_OEM_1 }, - { '?', VK_OEM_PLUS }, - { '?', VK_OEM_4 }, - { 0x00B4, VK_OEM_3 }, - { '?', VK_OEM_COMMA }, - { '~', VK_OEM_PLUS }, - { ']', VK_OEM_4 }, - { ''', VK_OEM_3 }, - { 0x00A7, VK_OEM_7 }, - { '<', VK_OEM_102 }, + { '-', VK_OEM_MINUS, -1 }, + { '+', VK_OEM_PLUS, -1 }, + { '_', VK_OEM_MINUS, -1 }, + { ',', VK_OEM_COMMA, -1 }, + { '.', VK_OEM_PERIOD, -1 }, + { '=', VK_OEM_PLUS, -1 }, + { '>', VK_OEM_PERIOD, -1 }, + { '<', VK_OEM_COMMA, -1 }, + { '|', VK_OEM_5, -1 }, + { '\', VK_OEM_5, -1 }, + { '`', VK_OEM_3, -1 }, + { '[', VK_OEM_4, -1 }, + { '~', VK_OEM_3, -1 }, + { 0x00DF, VK_OEM_4, -1 }, /* 0x00DF is ESZETT */ + { 0x00FC, VK_OEM_1, -1 }, /* 0x00FC is German U Umlaut */ + { 0x00F6, VK_OEM_3, -1 }, /* 0x00F6 is German O Umlaut */ + { 0x00E4, VK_OEM_7, -1 }, /* 0x00B4 is German A Umlaut */ + { '?', VK_OEM_2, -1 }, + { ']', VK_OEM_6, -1 }, + { '/', VK_OEM_2, -1 }, + { ':', VK_OEM_1, -1 }, + { '}', VK_OEM_6, -1 }, + { '{', VK_OEM_4, }, + { ';', VK_OEM_1, -1 }, + { ''', VK_OEM_7, -1 }, + { ':', VK_OEM_PERIOD, -1 }, + { ';', VK_OEM_COMMA, -1 }, + { '"', VK_OEM_7, -1 }, + { 0x00B4, VK_OEM_4, -1 }, /* 0x00B4 is ACUTE ACCENT */ + { ''', VK_OEM_2, -1 }, + { 0x00A7, VK_OEM_5, -1 }, /* 0x00A7 is SECTION SIGN */ + { '*', VK_OEM_PLUS, -1 }, + { 0x00B4, VK_OEM_7, -1 }, + { '`', VK_OEM_4, -1 }, + { '[', VK_OEM_6, -1 }, + { '/', VK_OEM_5, -1 }, + { '^', VK_OEM_6, -1 }, + { '*', VK_OEM_2, -1 }, + { '{', VK_OEM_6, -1 }, + { 0x00B4, VK_OEM_6, -1 }, + { '~', VK_OEM_1, -1 }, + { '?', VK_OEM_PLUS, -1 }, + { '?', VK_OEM_4, -1 }, + { 0x00B4, VK_OEM_3, -1 }, + { '?', VK_OEM_COMMA, -1 }, + { '~', VK_OEM_PLUS, -1 }, + { ']', VK_OEM_4, -1 }, + { ''', VK_OEM_3, -1 }, + { 0x00A7, VK_OEM_7, -1 }, + { '<', VK_OEM_102, -1 }, }; int i;
@@ -915,6 +920,8 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data) if (!thread_data->keyc2scan[keyc]) continue; /* not a known Mac key code */ if (thread_data->keyc2vkey[keyc] || !map[keyc][combo][0]) continue; + if (symbol_vkeys[i].mac_keyc != -1 && symbol_vkeys[i].mac_keyc != keyc) + continue;
if (char_matches_string(symbol_vkeys[i].wchar, map[keyc][combo], collatorRef)) {
From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/keyboard.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 33dbe509ff7..69005eb617e 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -715,10 +715,10 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data) { '`', VK_OEM_3, -1 }, { '[', VK_OEM_4, -1 }, { '~', VK_OEM_3, -1 }, - { 0x00DF, VK_OEM_4, -1 }, /* 0x00DF is ESZETT */ - { 0x00FC, VK_OEM_1, -1 }, /* 0x00FC is German U Umlaut */ - { 0x00F6, VK_OEM_3, -1 }, /* 0x00F6 is German O Umlaut */ - { 0x00E4, VK_OEM_7, -1 }, /* 0x00B4 is German A Umlaut */ + { 0x00DF, VK_OEM_4, kVK_ANSI_Minus }, /* 0x00DF is ESZETT */ + { 0x00FC, VK_OEM_1, kVK_ANSI_LeftBracket }, /* 0x00FC is German U Umlaut */ + { 0x00F6, VK_OEM_3, kVK_ANSI_Semicolon }, /* 0x00F6 is German O Umlaut */ + { 0x00E4, VK_OEM_7, kVK_ANSI_Quote }, /* 0x00B4 is German A Umlaut */ { '?', VK_OEM_2, -1 }, { ']', VK_OEM_6, -1 }, { '/', VK_OEM_2, -1 }, @@ -730,7 +730,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data) { ':', VK_OEM_PERIOD, -1 }, { ';', VK_OEM_COMMA, -1 }, { '"', VK_OEM_7, -1 }, - { 0x00B4, VK_OEM_4, -1 }, /* 0x00B4 is ACUTE ACCENT */ + { 0x00B4, VK_OEM_4, kVK_ANSI_Equal }, /* 0x00B4 is ACUTE ACCENT */ { ''', VK_OEM_2, -1 }, { 0x00A7, VK_OEM_5, -1 }, /* 0x00A7 is SECTION SIGN */ { '*', VK_OEM_PLUS, -1 },
From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/winemac.drv/keyboard.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 69005eb617e..fe4f7d70a10 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -702,12 +702,22 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data) * and their respective layouts to avoid false matches, when possible. */ int mac_keyc; } symbol_vkeys[] = { + { '-', VK_OEM_PLUS, kVK_ANSI_Equal }, { '-', VK_OEM_MINUS, -1 }, { '+', VK_OEM_PLUS, -1 }, { '_', VK_OEM_MINUS, -1 }, { ',', VK_OEM_COMMA, -1 }, { '.', VK_OEM_PERIOD, -1 }, + { '=', VK_OEM_8, kVK_ANSI_Slash }, { '=', VK_OEM_PLUS, -1 }, + { '!', VK_OEM_8, kVK_ANSI_Slash }, + { 0x00F9, VK_OEM_3, kVK_ANSI_Quote }, /* 0x00F9 is French U accent grave */ + { '$', VK_OEM_1, kVK_ANSI_RightBracket }, + { ':', VK_OEM_2, kVK_ANSI_Period }, + { '*', VK_OEM_5, kVK_ANSI_Backslash }, + { '`', VK_OEM_5, kVK_ANSI_Backslash }, + { ';', VK_OEM_PERIOD, kVK_ANSI_Comma }, + { ')', VK_OEM_4, kVK_ANSI_Minus }, { '>', VK_OEM_PERIOD, -1 }, { '<', VK_OEM_COMMA, -1 }, { '|', VK_OEM_5, -1 },
Rémi Bernon (@rbernon) commented about dlls/winemac.drv/keyboard.c:
* and their respective layouts to avoid false matches, when possible. */ int mac_keyc; } symbol_vkeys[] = {
{ '-', VK_OEM_PLUS, kVK_ANSI_Equal },
kVK_ANSI_Equal/VK_OEM_PLUS seems to be the good mapping, but I don't see how it can ever produce '-' for the `char_matches_string` check at https://gitlab.winehq.org/wine/wine/-/merge_requests/6754/diffs?commit_id=78....
Rémi Bernon (@rbernon) commented about dlls/winemac.drv/keyboard.c:
* and their respective layouts to avoid false matches, when possible. */ int mac_keyc; } symbol_vkeys[] = {
{ '-', VK_OEM_PLUS, kVK_ANSI_Equal }, { '-', VK_OEM_MINUS, -1 }, { '+', VK_OEM_PLUS, -1 }, { '_', VK_OEM_MINUS, -1 }, { ',', VK_OEM_COMMA, -1 }, { '.', VK_OEM_PERIOD, -1 },
{ '=', VK_OEM_8, kVK_ANSI_Slash },
Same thing here, kVK_ANSI_Slash/VK_OEM_8 looks okay for the kbdfr layout, but it's can only produce '!' or '§'?
Rémi Bernon (@rbernon) commented about dlls/winemac.drv/keyboard.c:
int mac_keyc; } symbol_vkeys[] = {
{ '-', VK_OEM_PLUS, kVK_ANSI_Equal }, { '-', VK_OEM_MINUS, -1 }, { '+', VK_OEM_PLUS, -1 }, { '_', VK_OEM_MINUS, -1 }, { ',', VK_OEM_COMMA, -1 }, { '.', VK_OEM_PERIOD, -1 },
{ '=', VK_OEM_8, kVK_ANSI_Slash }, { '=', VK_OEM_PLUS, -1 },
{ '!', VK_OEM_8, kVK_ANSI_Slash },
{ 0x00F9, VK_OEM_3, kVK_ANSI_Quote }, /* 0x00F9 is French U accent grave */
{ '$', VK_OEM_1, kVK_ANSI_RightBracket },
{ ':', VK_OEM_2, kVK_ANSI_Period },
{ '*', VK_OEM_5, kVK_ANSI_Backslash },
{ '`', VK_OEM_5, kVK_ANSI_Backslash },
kVK_ANSI_Backslash/VK_OEM_5 can produce '*' / 'µ' on fr keyboards, '`' is on alt+gr+7 instead.
On Tue Nov 12 14:21:06 2024 +0000, Rémi Bernon wrote:
kVK_ANSI_Equal/VK_OEM_PLUS seems to be the good mapping, but I don't see how it can ever produce '-' for the `char_matches_string` check at https://gitlab.winehq.org/wine/wine/-/merge_requests/6754/diffs?commit_id=78.... It's mapped to '=' / '+' on fr keyboards too.
I was trying to capture both the standard PC and Mac fr keyboards (which does explain all deviations as fast as I can tell atm).
![french-mac-keyboard-layout-keyshorts_1fb60b79-9eec-44c5-95b2-8a265174c630_1024x1024.png](/uploads/6b9b9e3a0ead541f2d2b671cc3320ac6/french-mac-keyboard-layout-keyshorts_1fb60b79-9eec-44c5-95b2-8a265174c630_1024x1024.png.webp)
On Tue Nov 12 15:59:11 2024 +0000, Marc-Aurel Zent wrote:
I was trying to capture both the standard PC and Mac fr keyboards (which does explain all deviations as far as I can tell atm). ![french-mac-keyboard-layout-keyshorts_1fb60b79-9eec-44c5-95b2-8a265174c630_1024x1024.png](/uploads/6b9b9e3a0ead541f2d2b671cc3320ac6/french-mac-keyboard-layout-keyshorts_1fb60b79-9eec-44c5-95b2-8a265174c630_1024x1024.png.webp)
I see...
This merge request was approved by Rémi Bernon.