Commit b269354f authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

user32: Introduce rawinput_thread_data helper.

parent 262ad90d
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment