A couple of win32u auto-repeat related improvements:
1. Cancel auto-repeat only if the repeat key is released (not other keys). 2. Cancel previous key auto-repeat when starting a new one for a different window (see commit message for more info).
I have kept the changes minimal, which can lead to a few extraneous `kill_system_timer` calls. To improve on this would require more extensive tracking/clearing of `thread_info->key_repeat_msg`.
-- v2: win32u: Cancel previous key auto-repeat when starting a new one.
From: Alexandros Frantzis alexandros.frantzis@collabora.com
This fixes the behavior to match other systems, where releasing an unrelated key does not affect the repeating key. --- dlls/win32u/message.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index f7f751ef883..417f67452d7 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2433,7 +2433,9 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter,
case WM_KEYUP: case WM_SYSKEYUP: - kill_system_timer( thread_info->key_repeat_msg.hwnd, SYSTEM_TIMER_KEY_REPEAT ); + /* Only stop repeat if the scan codes match. */ + if ((thread_info->key_repeat_msg.lParam & 0x01ff0000) == (msg->lParam & 0x01ff0000)) + kill_system_timer( thread_info->key_repeat_msg.hwnd, SYSTEM_TIMER_KEY_REPEAT ); break; } }
From: Alexandros Frantzis alexandros.frantzis@collabora.com
The previous auto-repeat may be associated with a different HWND, so we cannot rely on the new timer replacing the old timer, and we don't want simultaneous repeats on different windows in the same thread.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56307 --- dlls/win32u/message.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 417f67452d7..44a27763bdc 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2425,6 +2425,8 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter,
if (msg->wParam == VK_PROCESSKEY) break;
+ if (thread_info->key_repeat_msg.hwnd != msg->hwnd) + kill_system_timer( thread_info->key_repeat_msg.hwnd, SYSTEM_TIMER_KEY_REPEAT ); thread_info->key_repeat_msg = *msg; if (NtUserSystemParametersInfo( SPI_GETKEYBOARDDELAY, 0, &delay, 0 )) NtUserSetSystemTimer( msg->hwnd, SYSTEM_TIMER_KEY_REPEAT, (delay + 1) * 250 );
This merge request was approved by Rémi Bernon.