Jacek Caban : win32u: Move msg_source and recursion_count to ntuser_thread_info.

Alexandre Julliard julliard at winehq.org
Mon Aug 8 15:17:51 CDT 2022


Module: wine
Branch: master
Commit: ca903a4a16142225c9e353c55489f40e8c637e67
URL:    https://gitlab.winehq.org/wine/wine/-/commit/ca903a4a16142225c9e353c55489f40e8c637e67

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jul 29 22:01:44 2022 +0200

win32u: Move msg_source and recursion_count to ntuser_thread_info.

---

 dlls/user32/message.c        |  4 ++--
 dlls/win32u/message.c        | 17 +++++++++--------
 dlls/win32u/ntuser_private.h |  2 --
 include/ntuser.h             |  2 ++
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index d1a211bb281..e62e0566dd9 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -585,7 +585,7 @@ LRESULT WINAPI SendMessageTimeoutA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
 
 static LRESULT dispatch_send_message( struct win_proc_params *params )
 {
-    struct user_thread_info *thread_info = get_user_thread_info();
+    struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
     INPUT_MESSAGE_SOURCE prev_source = thread_info->msg_source;
     LRESULT retval = 0;
 
@@ -1031,7 +1031,7 @@ LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam)
  */
 BOOL WINAPI GetCurrentInputMessageSource( INPUT_MESSAGE_SOURCE *source )
 {
-    *source = get_user_thread_info()->msg_source;
+    *source = NtUserGetThreadInfo()->msg_source;
     return TRUE;
 }
 
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index 7045aedb4b1..e262fd7ab22 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -245,7 +245,7 @@ static BOOL init_window_call_params( struct win_proc_params *params, HWND hwnd,
 
 static BOOL dispatch_win_proc_params( struct win_proc_params *params, size_t size )
 {
-    struct user_thread_info *thread_info = get_user_thread_info();
+    struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
     void *ret_ptr;
     ULONG ret_len;
 
@@ -1593,11 +1593,12 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
 static BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data,
                                       HWND hwnd_filter, UINT first, UINT last, BOOL remove )
 {
+    struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
     DPI_AWARENESS_CONTEXT context;
     BOOL ret = FALSE;
 
-    get_user_thread_info()->msg_source.deviceType = msg_data->source.device;
-    get_user_thread_info()->msg_source.originId   = msg_data->source.origin;
+    thread_info->msg_source.deviceType = msg_data->source.device;
+    thread_info->msg_source.originId   = msg_data->source.origin;
 
     /* hardware messages are always in physical coords */
     context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
@@ -1625,7 +1626,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
 {
     LRESULT result;
     struct user_thread_info *thread_info = get_user_thread_info();
-    INPUT_MESSAGE_SOURCE prev_source = thread_info->msg_source;
+    INPUT_MESSAGE_SOURCE prev_source = thread_info->client_info.msg_source;
     struct received_message_info info;
     unsigned int hw_id = 0;  /* id of previous hardware message */
     void *buffer;
@@ -1643,7 +1644,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
         const message_data_t *msg_data = buffer;
         BOOL needs_unpack = FALSE;
 
-        thread_info->msg_source = prev_source;
+        thread_info->client_info.msg_source = prev_source;
 
         SERVER_START_REQ( get_message )
         {
@@ -1854,7 +1855,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
             thread_info->client_info.message_pos   = MAKELONG( msg->pt.x, msg->pt.y );
             thread_info->client_info.message_time  = info.msg.time;
             thread_info->client_info.message_extra = 0;
-            thread_info->msg_source = msg_source_unavailable;
+            thread_info->client_info.msg_source = msg_source_unavailable;
             free( buffer );
             call_hooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE );
             return 1;
@@ -1863,7 +1864,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
         /* if we get here, we have a sent message; call the window procedure */
         info.prev = thread_info->receive_info;
         thread_info->receive_info = &info;
-        thread_info->msg_source = msg_source_unavailable;
+        thread_info->client_info.msg_source = msg_source_unavailable;
         result = call_window_proc( info.msg.hwnd, info.msg.message, info.msg.wParam,
                                    info.msg.lParam, (info.type != MSG_ASCII), FALSE,
                                    WMCHAR_MAP_RECVMESSAGE, needs_unpack, buffer, size );
@@ -2619,7 +2620,7 @@ static BOOL broadcast_message( struct send_message_info *info, DWORD_PTR *res_pt
  */
 static BOOL process_message( struct send_message_info *info, DWORD_PTR *res_ptr, BOOL ansi )
 {
-    struct user_thread_info *thread_info = get_user_thread_info();
+    struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
     INPUT_MESSAGE_SOURCE prev_source = thread_info->msg_source;
     DWORD dest_pid;
     BOOL ret;
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index c62bb0d457f..0f25ede6b2b 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -123,13 +123,11 @@ struct user_thread_info
     HANDLE                        server_queue;           /* Handle to server-side queue */
     DWORD                         wake_mask;              /* Current queue wake mask */
     DWORD                         changed_mask;           /* Current queue changed mask */
-    WORD                          recursion_count;        /* SendMessage recursion counter */
     WORD                          message_count;          /* Get/PeekMessage loop counter */
     WORD                          hook_call_depth;        /* Number of recursively called hook procs */
     WORD                          hook_unicode;           /* Is current hook unicode? */
     HHOOK                         hook;                   /* Current hook */
     UINT                          active_hooks;           /* Bitmap of active hooks */
-    INPUT_MESSAGE_SOURCE          msg_source;             /* Message source for current message */
     struct received_message_info *receive_info;           /* Message being currently received */
     struct user_key_state_info   *key_state;              /* Cache of global key state */
     struct imm_thread_data       *imm_thread_data;        /* IMM thread data */
diff --git a/include/ntuser.h b/include/ntuser.h
index ec6f58a2f2e..5bc92fb562c 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -65,6 +65,8 @@ struct ntuser_thread_info
     DWORD          message_time;      /* value for GetMessageTime */
     DWORD          message_pos;       /* value for GetMessagePos */
     ULONG_PTR      message_extra;     /* value for GetMessageExtraInfo */
+    INPUT_MESSAGE_SOURCE msg_source;  /* Message source for current message */
+    WORD           recursion_count;   /* SendMessage recursion counter */
     HWND           top_window;        /* desktop window */
     HWND           msg_window;        /* HWND_MESSAGE parent window */
     DPI_AWARENESS  dpi_awareness;     /* DPI awareness */




More information about the wine-cvs mailing list