Fix the wayland side of https://bugs.winehq.org/show_bug.cgi?id=55336
### Exit menu key by default:
That's the actual behavior, any non-special key will exit the menu key, and be sent to the client.
I was also wondering if we should add `menu_sys_key = f10_key = 0;` when receiving a `WM_ACTIVATE` in `win32u/defwnd.c`'s `default_window_proc` but I guess not ?
### Fix repeated key for no reason:
For some reason when ALT is pressed, it is spammed and thus spams SYS_COMMAND. This fix that, but I don't know what I am doing here. I don't see any repeating key spamming with winex11 but I could be wrong. However alt/SYS_COMMAND should not be repeated.
That wasn't happening with winex11.drv.
### Fix release_all_keys modifier filtering:
That was the main reason why alt-tab leads to the menu key, NtUserGetAsyncKeyboardState also uses left and right system keys.
### Fix release_all_keys scan value:
This one is incomplete, the scan code or something else is broken, at least with the down arrow on a french azerty keyboard. Even though release_all_keys sends the input for the down arrow, it is not transmitted to NtUserTranslateMessage.
keyboard_handle_key send a key=28 and scan=0x150, but release_all_keys sends key=28 and scan=0x50. Winex11 sends 0x50, but internally NtUserTranslateMessage receives 0x150.
This results in the down arrow kept being repeated while being focused out, and after focusing in, pressing again the arrow is needed.
I tried changing things but ultimately it doesn't change anything. Maybe NtUserMapVirtualKeyEx is broken or is it the handling of the keyboard layout ? Or is it actually keyboard_handle_key ?
Winex11 and winemac uses `if !(NtUserGetAsyncKeyboardState(state)) return;` but I guess here we don't need to as we want to release all keys even if it fails ?
-- v2: winewayland.drv: Fix release_all_keys scan value winewayland.drv: Fix release_all_keys modifier filtering server: Fix repeated key for no reason
From: yuri_k7 riyu12383@gmail.com
--- dlls/win32u/menu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 8a3f1350004..2c1a0b4b400 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -4246,10 +4246,6 @@ static BOOL track_menu( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, const menu_right_key( &mt, flags, msg.message ); break;
- case VK_ESCAPE: - exit_menu = menu_key_escape( &mt, flags ); - break; - case VK_F1: { HELPINFO hi; @@ -4266,8 +4262,9 @@ static BOOL track_menu( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, const break; }
+ case VK_ESCAPE: default: - NtUserTranslateMessage( &msg, 0 ); + exit_menu = menu_key_escape( &mt, flags ); break; } break; /* WM_KEYDOWN */
From: yuri_k7 riyu12383@gmail.com
--- server/queue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/server/queue.c b/server/queue.c index 0156a4c66f2..8c2a2593cbc 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2423,11 +2423,10 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c } }
- if (origin == IMO_HARDWARE) + if ((origin == IMO_HARDWARE) && (input->kbd.scan == desktop->key_repeat.input.kbd.scan)) { /* if the repeat key is released, stop auto-repeating */ - if (((input->kbd.flags & KEYEVENTF_KEYUP) && - (input->kbd.scan == desktop->key_repeat.input.kbd.scan))) + if (input->kbd.flags & KEYEVENTF_KEYUP) { stop_key_repeat( desktop ); }
From: yuri_k7 riyu12383@gmail.com
--- dlls/winewayland.drv/wayland_keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_keyboard.c b/dlls/winewayland.drv/wayland_keyboard.c index 5c2fe15273e..79fd49ff242 100644 --- a/dlls/winewayland.drv/wayland_keyboard.c +++ b/dlls/winewayland.drv/wayland_keyboard.c @@ -629,8 +629,8 @@ static void release_all_keys(HWND hwnd) { /* Skip mouse buttons. */ if (vkey < 7 && vkey != VK_CANCEL) continue; - /* Skip left/right-agnostic modifier vkeys. */ - if (vkey == VK_SHIFT || vkey == VK_CONTROL || vkey == VK_MENU) continue; + /* Skip modifier vkeys. */ + if (vkey == VK_SHIFT || vkey == VK_CONTROL || vkey == VK_MENU || (vkey >= VK_LSHIFT && vkey <= VK_RMENU)) continue;
if (state[vkey] & 0x80) {
From: yuri_k7 riyu12383@gmail.com
--- dlls/winewayland.drv/wayland_keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_keyboard.c b/dlls/winewayland.drv/wayland_keyboard.c index 79fd49ff242..37e3c990bd2 100644 --- a/dlls/winewayland.drv/wayland_keyboard.c +++ b/dlls/winewayland.drv/wayland_keyboard.c @@ -637,8 +637,8 @@ static void release_all_keys(HWND hwnd) UINT scan = NtUserMapVirtualKeyEx(vkey, MAPVK_VK_TO_VSC_EX, keyboard_hkl); input.ki.wVk = vkey; - input.ki.wScan = scan & 0xff; - input.ki.dwFlags = KEYEVENTF_KEYUP; + input.ki.wScan = scan; + input.ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP; if (scan & ~0xff) input.ki.dwFlags |= KEYEVENTF_EXTENDEDKEY; NtUserSendHardwareInput(hwnd, 0, &input, 0); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147534
Your paranoid android.
=== debian11b (64 bit WoW report) ===
comctl32: edit.c:2784: Test failed: Expected 1 EM_SETSEL message, got 0
user32: edit.c:2750: Test failed: Expected 1 EM_SETSEL message, got 0 menu: Timeout msg.c:4449: Test failed: WM_CHILDACTIVATE sent to enabled window: 9: the winevent_hook 0x8005 was expected, but got msg 0x0222 instead msg.c:4449: Test failed: WM_CHILDACTIVATE sent to enabled window: 10: the msg 0x0007 was expected, but got msg 0x0222 instead msg.c:4449: Test failed: WM_CHILDACTIVATE sent to enabled window: 11: the hook 0x0009 was expected, but got msg 0x0222 instead msg.c:4449: Test failed: WM_CHILDACTIVATE sent to enabled window: 12: the msg 0x0008 was expected, but got msg 0x0222 instead msg.c:4449: Test failed: WM_CHILDACTIVATE sent to enabled window: 13: the winevent_hook 0x8005 was expected, but got msg 0x0222 instead msg.c:4449: Test failed: WM_CHILDACTIVATE sent to enabled window: 14: the msg 0x0007 was expected, but got msg 0x0222 instead msg.c:4471: Test failed: wrong focus window FFFFFFFFE92F00EC msg.c:4491: Test failed: wrong focus window FFFFFFFFE92F00EC msg.c:4505: Test failed: wrong focus window FFFFFFFFE92F00EC msg.c:4521: Test failed: wrong focus window FFFFFFFFE92F00EC msg.c:4534: Test failed: wrong focus window FFFFFFFFE92F00EC msg.c:4547: Test failed: wrong focus window FFFFFFFFE92F00EC msg.c:4558: Test failed: wrong focus window FFFFFFFFE92F00EC msg.c:4591: Test failed: ShowWindow(SW_MAXIMIZE):invisible maximized MDI child: 11: the winevent_hook 0x8005 was expected, but got msg 0x0008 instead msg.c:4591: Test failed: ShowWindow(SW_MAXIMIZE):invisible maximized MDI child: 17: the winevent_hook 0x8005 was expected, but got msg 0x0222 instead msg.c:4638: Test failed: wrong focus window FFFFFFFFE92F00EC(Switch test) msg.c:4660: Test failed: Not maximized child did not switch correctly: 9: the msg 0x0008 should have been sent by DefWindowProc msg.c:4660: Test failed: Not maximized child did not switch correctly: 12: the winevent_hook 0x8005 was expected, but got msg 0x0222 instead msg.c:4660: Test failed: Not maximized child did not switch correctly: 13: the msg 0x0007 was expected, but got msg 0x0222 instead msg.c:4660: Test failed: Not maximized child did not switch correctly: 14: the hook 0x0009 was expected, but got msg 0x0222 instead msg.c:4660: Test failed: Not maximized child did not switch correctly: 15: the msg 0x0008 was expected, but got msg 0x0222 instead msg.c:4660: Test failed: Not maximized child did not switch correctly: 18: the winevent_hook 0x8005 was expected, but got msg 0x0222 instead msg.c:4660: Test failed: Not maximized child did not switch correctly: 19: the msg 0x0007 was expected, but got msg 0x0222 instead msg.c:8041: Test failed: WM_KEYDOWN/VK_DOWN on a ComboBox: 2: the msg 0x0111 was expected, but got msg 0x0101 instead msg.c:8041: Test failed: WM_KEYDOWN/VK_DOWN on a ComboBox: 3: the msg 0x0111 was expected, but got msg 0x0101 instead msg.c:8041: Test failed: WM_KEYDOWN/VK_DOWN on a ComboBox: 4: the msg 0x0133 was expected, but got msg 0x0101 instead msg.c:17536: Test failed: popup menu command: 9: the msg 0x0117 was expected, but got msg 0x011f instead msg.c:17536: Test failed: popup menu command: 11: the winevent_hook 0x8000 was expected, but got msg 0x011f instead msg.c:17536: Test failed: popup menu command: 13: the winevent_hook 0x8002 was expected, but got msg 0x011f instead msg.c:17536: Test failed: popup menu command: 14: the winevent_hook 0x800b was expected, but got msg 0x011f instead msg.c:17536: Test failed: popup menu command: 16: in msg 0x011f expecting wParam 0x8000c8 got 0xffff0000 msg.c:17536: Test failed: popup menu command: 24: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17536: Test failed: popup menu command: 25: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17536: Test failed: popup menu command: 26: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17536: Test failed: popup menu command: 27: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17536: Test failed: popup menu command: 29: the msg 0x0126 was expected, but got msg 0x0105 instead msg.c:17536: Test failed: popup menu command: 29: the msg 0x0126 was expected, but got msg 0x0101 instead msg.c:17536: Test failed: popup menu command: 31: in msg 0x0101 expecting wParam 0xd got 0x12 msg.c:17536: Test failed: popup menu command: 32: the msg sequence is not complete: expected msg 0000 - actual msg 0100 msg.c:17554: Test failed: submenu of a popup menu command: 9: the msg 0x0117 was expected, but got msg 0x011f instead msg.c:17554: Test failed: submenu of a popup menu command: 10: in msg 0x011f expecting wParam 0x900000 got 0xffff0000 msg.c:17554: Test failed: submenu of a popup menu command: 12: the hook 0x0003 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 13: the winevent_hook 0x8000 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 15: the winevent_hook 0x8002 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 16: the winevent_hook 0x800b was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 18: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 25: the winevent_hook 0x8000 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 27: the winevent_hook 0x8002 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 28: the winevent_hook 0x800b was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 36: the hook 0x0004 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 37: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 38: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 39: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 42: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 43: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 44: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 45: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17554: Test failed: submenu of a popup menu command: 47: the msg 0x0126 was expected, but got msg 0x0105 instead msg.c:17554: Test failed: submenu of a popup menu command: 47: the msg 0x0126 was expected, but got msg 0x0101 instead msg.c:17554: Test failed: submenu of a popup menu command: 49: in msg 0x0101 expecting wParam 0xd got 0x12 msg.c:17554: Test failed: submenu of a popup menu command: 50: the msg sequence is not complete: expected msg 0000 - actual msg 0100 msg.c:17569: Test failed: single menu item command: 11: the msg 0x0126 was expected, but got msg 0x0105 instead msg.c:17602: Test failed: submenu of a popup menu command: 9: the msg 0x0117 was expected, but got msg 0x011f instead msg.c:17602: Test failed: submenu of a popup menu command: 10: in msg 0x011f expecting wParam 0x900000 got 0xffff0000 msg.c:17602: Test failed: submenu of a popup menu command: 12: the hook 0x0003 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 13: the winevent_hook 0x8000 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 15: the winevent_hook 0x8002 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 16: the winevent_hook 0x800b was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 18: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 25: the winevent_hook 0x8000 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 27: the winevent_hook 0x8002 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 28: the winevent_hook 0x800b was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 36: the hook 0x0004 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 37: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 38: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 39: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 42: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 43: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 44: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 45: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17602: Test failed: submenu of a popup menu command: 47: the msg 0x0111 was expected, but got msg 0x0105 instead msg.c:17602: Test failed: submenu of a popup menu command: 47: the msg 0x0111 was expected, but got msg 0x0101 instead msg.c:17602: Test failed: submenu of a popup menu command: 49: in msg 0x0101 expecting wParam 0xd got 0x12 msg.c:17602: Test failed: submenu of a popup menu command: 50: the msg sequence is not complete: expected msg 0000 - actual msg 0100
Report validation errors: user32:msg prints too much data (36288 bytes)