Jacek Caban : win32u: Use a separate helper to send messages from win32u.

Alexandre Julliard julliard at winehq.org
Mon Aug 15 15:23:44 CDT 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Aug 14 18:13:42 2022 +0200

win32u: Use a separate helper to send messages from win32u.

---

 dlls/win32u/clipboard.c      |  4 ++--
 dlls/win32u/input.c          |  2 +-
 dlls/win32u/message.c        | 22 +++++++++++++++-------
 dlls/win32u/palette.c        |  2 +-
 dlls/win32u/sysparams.c      |  4 ++--
 dlls/win32u/win32u_private.h |  2 +-
 6 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/dlls/win32u/clipboard.c b/dlls/win32u/clipboard.c
index d91d4339493..dfc0b629763 100644
--- a/dlls/win32u/clipboard.c
+++ b/dlls/win32u/clipboard.c
@@ -232,8 +232,8 @@ BOOL WINAPI NtUserEmptyClipboard(void)
 
     TRACE( "owner %p\n", owner );
 
-    if (owner) send_message_timeout( owner, WM_DESTROYCLIPBOARD, 0, 0, SMTO_ABORTIFHUNG,
-                                     5000, NULL, FALSE );
+    if (owner)
+        send_message_timeout( owner, WM_DESTROYCLIPBOARD, 0, 0, SMTO_ABORTIFHUNG, 5000, FALSE );
 
     pthread_mutex_lock( &clipboard_mutex );
 
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index 19233af4418..1344ab997cd 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -1636,7 +1636,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
         /* send palette messages */
         if (send_message( hwnd, WM_QUERYNEWPALETTE, 0, 0 ))
             send_message_timeout( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0,
-                                  SMTO_ABORTIFHUNG, 2000, NULL, FALSE );
+                                  SMTO_ABORTIFHUNG, 2000, FALSE );
         if (!is_window(hwnd)) return FALSE;
     }
 
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index b0c444f5407..f1ff3da2cd6 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -2609,11 +2609,11 @@ static BOOL broadcast_message( struct send_message_info *info, DWORD_PTR *res_pt
             {
             case MSG_UNICODE:
                 send_message_timeout( list[i], info->msg, info->wparam, info->lparam,
-                                      info->flags, info->timeout, NULL, FALSE );
+                                      info->flags, info->timeout, FALSE );
                 break;
             case MSG_ASCII:
                 send_message_timeout( list[i], info->msg, info->wparam, info->lparam,
-                                      info->flags, info->timeout, NULL, TRUE );
+                                      info->flags, info->timeout, TRUE );
                 break;
             case MSG_NOTIFY:
                 NtUserMessageCall( list[i], info->msg, info->wparam, info->lparam,
@@ -2810,8 +2810,8 @@ static LRESULT send_window_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
 }
 
 /* see SendMessageTimeoutW */
-LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
-                              UINT flags, UINT timeout, DWORD_PTR *res_ptr, BOOL ansi )
+static LRESULT send_client_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
+                                    UINT flags, UINT timeout, DWORD_PTR *res_ptr, BOOL ansi )
 {
     struct send_message_info info;
 
@@ -2828,10 +2828,18 @@ LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
     return process_message( &info, res_ptr, ansi );
 }
 
+LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
+                              UINT flags, UINT timeout, BOOL ansi )
+{
+    DWORD_PTR res = 0;
+    send_client_message( hwnd, msg, wparam, lparam, flags, timeout, &res, ansi );
+    return res;
+}
+
 /* see SendMessageW */
 LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
 {
-    return send_window_message( hwnd, msg, wparam, lparam, NULL, FALSE );
+    return send_message_timeout( hwnd, msg, wparam, lparam, SMTO_NORMAL, 0, FALSE );
 }
 
 /* see SendNotifyMessageW */
@@ -2971,8 +2979,8 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
         {
             struct send_message_timeout_params *params = (void *)result_info;
             DWORD_PTR res = 0;
-            params->result = send_message_timeout( hwnd, msg, wparam, lparam, params->flags,
-                                                   params->timeout, &res, ansi );
+            params->result = send_client_message( hwnd, msg, wparam, lparam, params->flags,
+                                                  params->timeout, &res, ansi );
             return res;
         }
 
diff --git a/dlls/win32u/palette.c b/dlls/win32u/palette.c
index 217a96bb027..e8fd51dba22 100644
--- a/dlls/win32u/palette.c
+++ b/dlls/win32u/palette.c
@@ -584,7 +584,7 @@ UINT realize_palette( HDC hdc )
         /* send palette change notification */
         HWND hwnd = NtUserWindowFromDC( hdc );
         if (hwnd) send_message_timeout( HWND_BROADCAST, WM_PALETTECHANGED, HandleToUlong(hwnd), 0,
-                                        SMTO_ABORTIFHUNG, 2000, NULL, FALSE );
+                                        SMTO_ABORTIFHUNG, 2000, FALSE );
     }
     return realized;
 }
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index 99495349246..52665f7a641 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -4397,7 +4397,7 @@ BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT w
         static const WCHAR emptyW[1];
         if (winini & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
             send_message_timeout( HWND_BROADCAST, WM_SETTINGCHANGE, action, (LPARAM) emptyW,
-                                  SMTO_ABORTIFHUNG, 2000, NULL, FALSE );
+                                  SMTO_ABORTIFHUNG, 2000, FALSE );
     }
     TRACE( "(%u, %u, %p, %u) ret %d\n", action, val, ptr, winini, ret );
     return ret;
@@ -4840,7 +4840,7 @@ BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *va
 
     /* Send WM_SYSCOLORCHANGE message to all windows */
     send_message_timeout( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0,
-                          SMTO_ABORTIFHUNG, 2000, NULL, FALSE );
+                          SMTO_ABORTIFHUNG, 2000, FALSE );
     /* Repaint affected portions of all visible windows */
     NtUserRedrawWindow( 0, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
     return TRUE;
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index ba6479a5426..a243afd668c 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -308,7 +308,7 @@ extern LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, UI
                                               PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
 extern LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
 extern LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
-                                     UINT flags, UINT timeout, PDWORD_PTR res_ptr, BOOL ansi );
+                                     UINT flags, UINT timeout, BOOL ansi );
 
 /* rawinput.c */
 extern BOOL process_rawinput_message( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data ) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list