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
325c061b
Commit
325c061b
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: Move key state cache into a separate struct.
parent
4eff1879
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
15 deletions
+32
-15
hook.c
dlls/user32/hook.c
+4
-1
input.c
dlls/user32/input.c
+15
-8
message.c
dlls/user32/message.c
+4
-3
user_private.h
dlls/user32/user_private.h
+7
-2
winstation.c
dlls/user32/winstation.c
+2
-1
No files found.
dlls/user32/hook.c
View file @
325c061b
...
...
@@ -437,7 +437,10 @@ static LRESULT call_hook( struct hook_info *info, INT code, WPARAM wparam, LPARA
}
if
(
info
->
id
==
WH_KEYBOARD_LL
||
info
->
id
==
WH_MOUSE_LL
)
get_user_thread_info
()
->
key_state_time
=
0
;
/* force refreshing the key state cache */
{
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 */
}
return
ret
;
}
...
...
dlls/user32/input.c
View file @
325c061b
...
...
@@ -368,7 +368,7 @@ static void check_for_events( UINT flags )
*/
SHORT
WINAPI
DECLSPEC_HOTPATCH
GetAsyncKeyState
(
INT
key
)
{
struct
user_
thread_info
*
thread_info
=
get_user_thread_info
()
;
struct
user_
key_state_info
*
key_state_info
=
get_user_thread_info
()
->
key_state
;
SHORT
ret
;
if
(
key
<
0
||
key
>=
256
)
return
0
;
...
...
@@ -377,24 +377,31 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState( INT key )
if
((
ret
=
USER_Driver
->
pGetAsyncKeyState
(
key
))
==
-
1
)
{
if
(
thread_info
->
key_state
&&
!
(
thread_info
->
key_state
[
key
]
&
0xc0
)
&&
GetTickCount
()
-
thread_info
->
key_state_time
<
50
)
if
(
key_state_info
&&
!
(
key_state_info
->
state
[
key
]
&
0xc0
)
&&
GetTickCount
()
-
key_state_info
->
time
<
50
)
{
/* use cached value */
return
0
;
if
(
!
thread_info
->
key_state
)
thread_info
->
key_state
=
HeapAlloc
(
GetProcessHeap
(),
0
,
256
);
}
else
if
(
!
key_state_info
)
{
key_state_info
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
key_state_info
)
);
get_user_thread_info
()
->
key_state
=
key_state_info
;
}
ret
=
0
;
SERVER_START_REQ
(
get_key_state
)
{
req
->
tid
=
0
;
req
->
key
=
key
;
if
(
thread_info
->
key_state
)
wine_server_set_reply
(
req
,
thread_info
->
key_state
,
256
);
if
(
key_state_info
)
wine_server_set_reply
(
req
,
key_state_info
->
state
,
sizeof
(
key_state_info
->
state
)
);
if
(
!
wine_server_call
(
req
))
{
if
(
reply
->
state
&
0x40
)
ret
|=
0x0001
;
if
(
reply
->
state
&
0x80
)
ret
|=
0x8000
;
thread_info
->
key_state_
time
=
GetTickCount
();
if
(
key_state_info
)
key_state_info
->
time
=
GetTickCount
();
}
}
SERVER_END_REQ
;
...
...
dlls/user32/message.c
View file @
325c061b
...
...
@@ -3290,7 +3290,7 @@ static BOOL send_message( struct send_message_info *info, DWORD_PTR *res_ptr, BO
*/
NTSTATUS
send_hardware_message
(
HWND
hwnd
,
const
INPUT
*
input
,
UINT
flags
)
{
struct
user_
thread_info
*
thread_info
=
get_user_thread_info
()
;
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
;
NTSTATUS
ret
;
...
...
@@ -3329,7 +3329,8 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags )
req
->
input
.
hw
.
lparam
=
MAKELONG
(
input
->
u
.
hi
.
wParamL
,
input
->
u
.
hi
.
wParamH
);
break
;
}
if
(
thread_info
->
key_state
)
wine_server_set_reply
(
req
,
thread_info
->
key_state
,
256
);
if
(
key_state_info
)
wine_server_set_reply
(
req
,
key_state_info
->
state
,
sizeof
(
key_state_info
->
state
)
);
ret
=
wine_server_call
(
req
);
wait
=
reply
->
wait
;
prev_x
=
reply
->
prev_x
;
...
...
@@ -3341,7 +3342,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags )
if
(
!
ret
)
{
if
(
thread_info
->
key_state
)
thread_info
->
key_state_
time
=
GetTickCount
();
if
(
key_state_info
)
key_state_info
->
time
=
GetTickCount
();
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 @
325c061b
...
...
@@ -184,8 +184,7 @@ struct user_thread_info
DWORD
GetMessagePosVal
;
/* Value for GetMessagePos */
ULONG_PTR
GetMessageExtraInfoVal
;
/* Value for GetMessageExtraInfo */
UINT
active_hooks
;
/* Bitmap of active hooks */
UINT
key_state_time
;
/* Time of last key state refresh */
BYTE
*
key_state
;
/* Cache of global key state */
struct
user_key_state_info
*
key_state
;
/* Cache of global key state */
HWND
top_window
;
/* Desktop window */
HWND
msg_window
;
/* HWND_MESSAGE parent window */
RAWINPUT
*
rawinput
;
...
...
@@ -193,6 +192,12 @@ struct user_thread_info
C_ASSERT
(
sizeof
(
struct
user_thread_info
)
<=
sizeof
(((
TEB
*
)
0
)
->
Win32ClientInfo
)
);
struct
user_key_state_info
{
UINT
time
;
/* Time of last key state refresh */
BYTE
state
[
256
];
/* State for each key */
};
struct
hook_extra_info
{
HHOOK
handle
;
...
...
dlls/user32/winstation.c
View file @
325c061b
...
...
@@ -399,9 +399,10 @@ BOOL WINAPI SetThreadDesktop( HDESK handle )
if
(
ret
)
/* reset the desktop windows */
{
struct
user_thread_info
*
thread_info
=
get_user_thread_info
();
struct
user_key_state_info
*
key_state_info
=
thread_info
->
key_state
;
thread_info
->
top_window
=
0
;
thread_info
->
msg_window
=
0
;
thread_info
->
key_state_
time
=
0
;
if
(
key_state_info
)
key_state_info
->
time
=
0
;
}
return
ret
;
}
...
...
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