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 wrong, a failed attempt. The actual problem is that NtUserGetAsyncKeyboardState limits itself to 256 virtual keys, discarding the extended scan code info. So it results on my down arrow being kept repeated while being focused out, and when focused in, pressing the arrow again is needed to stop the repeat.
Also using the KEYEVENTF_SCANCODE flag results in win32u/message.c's send_hardware_message calling NtUserGetKeyboardLayout which get a incorect hkl value but it doesn't seems to have an impact.
-- v3: winewayland.drv: Fix release_all_keys modifier filtering server: Fix repeated key for no reason win32u: Exit menu key by default
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 1f1e5f68e21..5c810be9ba3 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -4242,10 +4242,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; @@ -4262,8 +4258,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 c99c8d8661b..25ca5e89592 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 8f7b6dce30f..9b382204f0b 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) {
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=148762
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 input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000002B800F4, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 menu: Timeout msg.c:17539: Test failed: popup menu command: 9: the msg 0x0117 was expected, but got msg 0x011f instead msg.c:17539: Test failed: popup menu command: 11: the winevent_hook 0x8000 was expected, but got msg 0x011f instead msg.c:17539: Test failed: popup menu command: 13: the winevent_hook 0x8002 was expected, but got msg 0x011f instead msg.c:17539: Test failed: popup menu command: 14: the winevent_hook 0x800b was expected, but got msg 0x011f instead msg.c:17539: Test failed: popup menu command: 16: in msg 0x011f expecting wParam 0x8000c8 got 0xffff0000 msg.c:17539: Test failed: popup menu command: 24: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17539: Test failed: popup menu command: 25: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17539: Test failed: popup menu command: 26: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17539: Test failed: popup menu command: 27: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17539: Test failed: popup menu command: 29: the msg 0x0126 was expected, but got msg 0x0105 instead msg.c:17539: Test failed: popup menu command: 29: the msg 0x0126 was expected, but got msg 0x0101 instead msg.c:17539: Test failed: popup menu command: 31: in msg 0x0101 expecting wParam 0xd got 0x12 msg.c:17539: Test failed: popup menu command: 32: the msg sequence is not complete: expected msg 0000 - actual msg 0100 msg.c:17557: Test failed: submenu of a popup menu command: 9: the msg 0x0117 was expected, but got msg 0x011f instead msg.c:17557: Test failed: submenu of a popup menu command: 10: in msg 0x011f expecting wParam 0x900000 got 0xffff0000 msg.c:17557: Test failed: submenu of a popup menu command: 12: the hook 0x0003 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 13: the winevent_hook 0x8000 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 15: the winevent_hook 0x8002 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 16: the winevent_hook 0x800b was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 18: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 25: the winevent_hook 0x8000 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 27: the winevent_hook 0x8002 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 28: the winevent_hook 0x800b was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 36: the hook 0x0004 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 37: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 38: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 39: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 42: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 43: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 44: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 45: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17557: Test failed: submenu of a popup menu command: 47: the msg 0x0126 was expected, but got msg 0x0105 instead msg.c:17557: Test failed: submenu of a popup menu command: 47: the msg 0x0126 was expected, but got msg 0x0101 instead msg.c:17557: Test failed: submenu of a popup menu command: 49: in msg 0x0101 expecting wParam 0xd got 0x12 msg.c:17557: Test failed: submenu of a popup menu command: 50: the msg sequence is not complete: expected msg 0000 - actual msg 0100 msg.c:17572: Test failed: single menu item command: 11: the msg 0x0126 was expected, but got msg 0x0105 instead msg.c:17605: Test failed: submenu of a popup menu command: 9: the msg 0x0117 was expected, but got msg 0x011f instead msg.c:17605: Test failed: submenu of a popup menu command: 10: in msg 0x011f expecting wParam 0x900000 got 0xffff0000 msg.c:17605: Test failed: submenu of a popup menu command: 12: the hook 0x0003 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 13: the winevent_hook 0x8000 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 15: the winevent_hook 0x8002 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 16: the winevent_hook 0x800b was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 18: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 25: the winevent_hook 0x8000 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 27: the winevent_hook 0x8002 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 28: the winevent_hook 0x800b was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 36: the hook 0x0004 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 37: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 38: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 39: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 42: the winevent_hook 0x8003 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 43: the winevent_hook 0x8001 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 44: the msg 0x0125 was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 45: the msg 0x011f was expected, but got msg 0x0212 instead msg.c:17605: Test failed: submenu of a popup menu command: 47: the msg 0x0111 was expected, but got msg 0x0105 instead msg.c:17605: Test failed: submenu of a popup menu command: 47: the msg 0x0111 was expected, but got msg 0x0101 instead msg.c:17605: Test failed: submenu of a popup menu command: 49: in msg 0x0101 expecting wParam 0xd got 0x12 msg.c:17605: Test failed: submenu of a popup menu command: 50: the msg sequence is not complete: expected msg 0000 - actual msg 0100
@afrantzis There is a remaining problem, NtUserGetAsyncKeyboardState limits itself to 256 virtual keys, discarding the extended scan code info. So it results on my down arrow key (e0 50) being kept repeated while being focused out, and when focused in, pressing the arrow again is needed to stop the repeat.
I believe to solve this we should either limit/convert the key handling to the 256 default scan code, or locally memorize in winewayland the pressed keys or create a version of NtUserGetAsyncKeyboardState with extended scan code info.