Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7b03cbda
Commit
7b03cbda
authored
Oct 11, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Implement opt-in auto-repeat for WM_(SYS)KEYDOWN messages.
parent
c36b4193
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
message.c
dlls/win32u/message.c
+47
-0
ntuser_private.h
dlls/win32u/ntuser_private.h
+4
-0
No files found.
dlls/win32u/message.c
View file @
7b03cbda
...
...
@@ -2292,6 +2292,22 @@ static void send_parent_notify( HWND hwnd, WORD event, WORD idChild, POINT pt )
}
}
static
void
handle_keyboard_repeat_message
(
HWND
hwnd
)
{
struct
user_thread_info
*
thread_info
=
get_user_thread_info
();
MSG
*
msg
=
&
thread_info
->
key_repeat_msg
;
UINT
speed
;
msg
->
lParam
=
(
msg
->
lParam
&
~
(
LPARAM
)
0xffff
)
+
((
msg
->
lParam
+
1
)
&
0xffff
);
if
(
NtUserSystemParametersInfo
(
SPI_GETKEYBOARDSPEED
,
0
,
&
speed
,
0
))
NtUserSetSystemTimer
(
hwnd
,
SYSTEM_TIMER_KEY_REPEAT
,
400
/
(
speed
+
1
)
);
NtUserPostMessage
(
hwnd
,
msg
->
message
,
msg
->
wParam
,
msg
->
lParam
);
}
/***********************************************************************
* process_keyboard_message
*
...
...
@@ -2371,6 +2387,33 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter,
if
(
ImmProcessKey
(
msg
->
hwnd
,
NtUserGetKeyboardLayout
(
0
),
msg
->
wParam
,
msg
->
lParam
,
0
))
msg
->
wParam
=
VK_PROCESSKEY
;
/* set/kill timers for key auto-repeat */
if
(
remove
&&
keyboard_auto_repeat_enabled
)
{
struct
user_thread_info
*
thread_info
=
get_user_thread_info
();
switch
(
msg
->
message
)
{
case
WM_KEYDOWN
:
case
WM_SYSKEYDOWN
:
{
UINT
delay
;
if
(
msg
->
wParam
==
VK_PROCESSKEY
)
break
;
thread_info
->
key_repeat_msg
=
*
msg
;
if
(
NtUserSystemParametersInfo
(
SPI_GETKEYBOARDDELAY
,
0
,
&
delay
,
0
))
NtUserSetSystemTimer
(
msg
->
hwnd
,
SYSTEM_TIMER_KEY_REPEAT
,
(
delay
+
1
)
*
250
);
break
;
}
case
WM_KEYUP
:
case
WM_SYSKEYUP
:
kill_system_timer
(
thread_info
->
key_repeat_msg
.
hwnd
,
SYSTEM_TIMER_KEY_REPEAT
);
break
;
}
}
return
TRUE
;
}
...
...
@@ -3565,6 +3608,10 @@ LRESULT WINAPI NtUserDispatchMessage( const MSG *msg )
case
SYSTEM_TIMER_TRACK_MOUSE
:
update_mouse_tracking_info
(
msg
->
hwnd
);
return
0
;
case
SYSTEM_TIMER_KEY_REPEAT
:
handle_keyboard_repeat_message
(
msg
->
hwnd
);
return
0
;
}
}
...
...
dlls/win32u/ntuser_private.h
View file @
7b03cbda
...
...
@@ -32,6 +32,9 @@ enum system_timer_id
{
SYSTEM_TIMER_TRACK_MOUSE
=
0xfffa
,
SYSTEM_TIMER_CARET
=
0xffff
,
/* not compatible with native */
SYSTEM_TIMER_KEY_REPEAT
=
0xfff0
,
};
struct
rawinput_thread_data
...
...
@@ -126,6 +129,7 @@ struct user_thread_info
struct
received_message_info
*
receive_info
;
/* Message being currently received */
struct
user_key_state_info
*
key_state
;
/* Cache of global key state */
struct
imm_thread_data
*
imm_thread_data
;
/* IMM thread data */
MSG
key_repeat_msg
;
/* Last WM_KEYDOWN message to repeat */
HKL
kbd_layout
;
/* Current keyboard layout */
UINT
kbd_layout_id
;
/* Current keyboard layout ID */
struct
rawinput_thread_data
*
rawinput
;
/* RawInput thread local data / buffer */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment