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
d3be42ab
Commit
d3be42ab
authored
Apr 07, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Apr 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Invalidate key state cache globally after running LL hooks.
parent
325c061b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
6 deletions
+18
-6
hook.c
dlls/user32/hook.c
+1
-4
input.c
dlls/user32/input.c
+8
-1
message.c
dlls/user32/message.c
+6
-1
user_private.h
dlls/user32/user_private.h
+3
-0
No files found.
dlls/user32/hook.c
View file @
d3be42ab
...
...
@@ -437,10 +437,7 @@ static LRESULT call_hook( struct hook_info *info, INT code, WPARAM wparam, LPARA
}
if
(
info
->
id
==
WH_KEYBOARD_LL
||
info
->
id
==
WH_MOUSE_LL
)
{
struct
user_key_state_info
*
key_state_info
=
get_user_thread_info
()
->
key_state
;
if
(
key_state_info
)
key_state_info
->
time
=
0
;
/* force refreshing the key state cache */
}
interlocked_xchg_add
(
&
global_key_state_counter
,
1
);
/* force refreshing the key state cache */
return
ret
;
}
...
...
dlls/user32/input.c
View file @
d3be42ab
...
...
@@ -52,6 +52,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
win
);
WINE_DECLARE_DEBUG_CHANNEL
(
keyboard
);
INT
global_key_state_counter
=
0
;
/***********************************************************************
* get_key_state
...
...
@@ -369,6 +370,7 @@ static void check_for_events( UINT flags )
SHORT
WINAPI
DECLSPEC_HOTPATCH
GetAsyncKeyState
(
INT
key
)
{
struct
user_key_state_info
*
key_state_info
=
get_user_thread_info
()
->
key_state
;
INT
counter
=
global_key_state_counter
;
SHORT
ret
;
if
(
key
<
0
||
key
>=
256
)
return
0
;
...
...
@@ -379,6 +381,7 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState( INT key )
{
if
(
key_state_info
&&
!
(
key_state_info
->
state
[
key
]
&
0xc0
)
&&
key_state_info
->
counter
==
counter
&&
GetTickCount
()
-
key_state_info
->
time
<
50
)
{
/* use cached value */
...
...
@@ -401,7 +404,11 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState( INT key )
{
if
(
reply
->
state
&
0x40
)
ret
|=
0x0001
;
if
(
reply
->
state
&
0x80
)
ret
|=
0x8000
;
if
(
key_state_info
)
key_state_info
->
time
=
GetTickCount
();
if
(
key_state_info
)
{
key_state_info
->
time
=
GetTickCount
();
key_state_info
->
counter
=
counter
;
}
}
}
SERVER_END_REQ
;
...
...
dlls/user32/message.c
View file @
d3be42ab
...
...
@@ -3293,6 +3293,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags )
struct
user_key_state_info
*
key_state_info
=
get_user_thread_info
()
->
key_state
;
struct
send_message_info
info
;
int
prev_x
,
prev_y
,
new_x
,
new_y
;
INT
counter
=
global_key_state_counter
;
NTSTATUS
ret
;
BOOL
wait
;
...
...
@@ -3342,7 +3343,11 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags )
if
(
!
ret
)
{
if
(
key_state_info
)
key_state_info
->
time
=
GetTickCount
();
if
(
key_state_info
)
{
key_state_info
->
time
=
GetTickCount
();
key_state_info
->
counter
=
counter
;
}
if
((
flags
&
SEND_HWMSG_INJECTED
)
&&
(
prev_x
!=
new_x
||
prev_y
!=
new_y
))
USER_Driver
->
pSetCursorPos
(
new_x
,
new_y
);
}
...
...
dlls/user32/user_private.h
View file @
d3be42ab
...
...
@@ -192,9 +192,12 @@ struct user_thread_info
C_ASSERT
(
sizeof
(
struct
user_thread_info
)
<=
sizeof
(((
TEB
*
)
0
)
->
Win32ClientInfo
)
);
extern
INT
global_key_state_counter
DECLSPEC_HIDDEN
;
struct
user_key_state_info
{
UINT
time
;
/* Time of last key state refresh */
INT
counter
;
/* Counter to invalidate the key state */
BYTE
state
[
256
];
/* State for each key */
};
...
...
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