user32: Introduce rawinput_thread_data helper.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2020-06-25 19:08:42 +02:00 committed by Alexandre Julliard
parent 262ad90d3f
commit b269354f45
3 changed files with 16 additions and 10 deletions

View File

@ -2286,15 +2286,7 @@ static void accept_hardware_message( UINT hw_id, BOOL remove )
static BOOL process_rawinput_message( MSG *msg, const struct hardware_msg_data *msg_data )
{
struct user_thread_info *thread_info = get_user_thread_info();
RAWINPUT *rawinput = thread_info->rawinput;
if (!rawinput)
{
thread_info->rawinput = HeapAlloc( GetProcessHeap(), 0, sizeof(*rawinput) );
if (!(rawinput = thread_info->rawinput)) return FALSE;
}
RAWINPUT *rawinput = rawinput_thread_data();
if (!rawinput_from_hardware_message(rawinput, msg_data))
return FALSE;

View File

@ -223,6 +223,15 @@ static void find_devices(void)
}
RAWINPUT *rawinput_thread_data(void)
{
struct user_thread_info *thread_info = get_user_thread_info();
RAWINPUT *rawinput = thread_info->rawinput;
if (!rawinput) rawinput = thread_info->rawinput = HeapAlloc( GetProcessHeap(), 0, RAWINPUT_BUFFER_SIZE );
return rawinput;
}
BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data)
{
rawinput->header.dwType = msg_data->rawinput.type;

View File

@ -169,6 +169,10 @@ struct wm_char_mapping_data
MSG get_msg;
};
/* on windows the buffer capacity is quite large as well, enough to */
/* hold up to 10s of 1kHz mouse rawinput events */
#define RAWINPUT_BUFFER_SIZE (512*1024)
/* this is the structure stored in TEB->Win32ClientInfo */
/* no attempt is made to keep the layout compatible with the Windows one */
struct user_thread_info
@ -192,7 +196,7 @@ struct user_thread_info
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;
RAWINPUT *rawinput; /* Rawinput buffer */
};
C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo) );
@ -232,6 +236,7 @@ struct tagWND;
struct hardware_msg_data;
extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data);
extern RAWINPUT *rawinput_thread_data(void);
extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;