[PATCH 3/5] user32: Introduce rawinput_thread_data helper.
Rémi Bernon
rbernon at codeweavers.com
Thu Jun 25 12:08:42 CDT 2020
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/message.c | 10 +---------
dlls/user32/rawinput.c | 9 +++++++++
dlls/user32/user_private.h | 7 ++++++-
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 89ffa07f700..c5c7db667cf 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -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;
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index af15f5f6b49..7092c01c659 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -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;
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 25bbeba6f0c..d7f4741ebe6 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -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;
--
2.27.0
More information about the wine-devel
mailing list