[PATCH 2/7] win32u: Partially move ScrollBarWndProc implementation from user32.

Jacek Caban wine at gitlab.winehq.org
Mon Jul 4 07:05:53 CDT 2022


From: Jacek Caban <jacek at codeweavers.com>

---
 dlls/user32/scroll.c         |  4 +---
 dlls/win32u/message.c        | 14 ++++++++++++++
 dlls/win32u/scroll.c         | 15 +++++++++++++++
 dlls/win32u/win32u_private.h |  4 ++++
 include/ntuser.h             |  1 +
 5 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index d7972e2c6e8..d9bc69895aa 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -1513,10 +1513,8 @@ LRESULT WINAPI USER_ScrollBarProc( HWND hwnd, UINT message, WPARAM wParam, LPARA
         break;
 
     case WM_ERASEBKGND:
-         return 1;
-
     case WM_GETDLGCODE:
-         return DLGC_WANTARROWS; /* Windows returns this value */
+        return NtUserMessageCall( hwnd, message, wParam, lParam, 0, NtUserScrollBarWndProc, !unicode );
 
     case WM_PAINT:
         {
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index 0603a248f60..65f44783fe6 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -2889,17 +2889,25 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
 {
     switch (type)
     {
+    case NtUserScrollBarWndProc:
+        return scroll_bar_window_proc( hwnd, msg, wparam, lparam, ansi );
+
     case NtUserPopupMenuWndProc:
         return popup_menu_window_proc( hwnd, msg, wparam, lparam );
+
     case NtUserDesktopWindowProc:
         return desktop_window_proc( hwnd, msg, wparam, lparam );
+
     case NtUserDefWindowProc:
         return default_window_proc( hwnd, msg, wparam, lparam, ansi );
+
     case NtUserCallWindowProc:
         return init_win_proc_params( (struct win_proc_params *)result_info, hwnd, msg,
                                      wparam, lparam, ansi );
+
     case NtUserSendMessage:
         return send_window_message( hwnd, msg, wparam, lparam, ansi );
+
     case NtUserSendMessageTimeout:
         {
             struct send_message_timeout_params *params = (void *)result_info;
@@ -2908,18 +2916,24 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
                                                    params->timeout, &res, ansi );
             return res;
         }
+
     case NtUserSendNotifyMessage:
         return send_notify_message( hwnd, msg, wparam, lparam, ansi );
+
     case NtUserSendMessageCallback:
         return send_message_callback( hwnd, msg, wparam, lparam, (void *)result_info, ansi );
+
     case NtUserClipboardWindowProc:
         return user_driver->pClipboardWindowProc( hwnd, msg, wparam, lparam );
+
     case NtUserSpyEnter:
         spy_enter_message( ansi, hwnd, msg, wparam, lparam );
         return 0;
+
     case NtUserSpyExit:
         spy_exit_message( ansi, hwnd, msg, (LPARAM)result_info, wparam, lparam );
         return 0;
+
     default:
         FIXME( "%p %x %lx %lx %p %x %x\n", hwnd, msg, wparam, lparam, result_info, type, ansi );
     }
diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c
index 380ce5fc75b..ff60ec5c4ce 100644
--- a/dlls/win32u/scroll.c
+++ b/dlls/win32u/scroll.c
@@ -68,6 +68,21 @@ static BOOL show_scroll_bar( HWND hwnd, int bar, BOOL show_horz, BOOL show_vert
     return FALSE; /* no frame changes */
 }
 
+LRESULT scroll_bar_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi )
+{
+    switch (msg)
+    {
+    case WM_ERASEBKGND:
+        return 1;
+
+    case WM_GETDLGCODE:
+        return DLGC_WANTARROWS; /* Windows returns this value */
+
+    default:
+        return default_window_proc( hwnd, msg, wparam, lparam, ansi );
+    }
+}
+
 /*************************************************************************
  *           NtUserShowScrollBar   (win32u.@)
  */
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 00bc3e16828..90ca0e9b143 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -440,6 +440,10 @@ extern LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM
 extern BOOL process_rawinput_message( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data ) DECLSPEC_HIDDEN;
 extern BOOL rawinput_device_get_usages( HANDLE handle, USHORT *usage_page, USHORT *usage ) DECLSPEC_HIDDEN;
 
+/* scroll.c */
+extern LRESULT scroll_bar_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
+                                       BOOL ansi ) DECLSPEC_HIDDEN;
+
 /* sysparams.c */
 extern BOOL enable_thunk_lock DECLSPEC_HIDDEN;
 extern DWORD process_layout DECLSPEC_HIDDEN;
diff --git a/include/ntuser.h b/include/ntuser.h
index 2f6b8863228..08a49cbd123 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -211,6 +211,7 @@ struct render_synthesized_format_params
 /* NtUserMessageCall codes */
 enum
 {
+    NtUserScrollBarWndProc    = 0x029a,
     NtUserPopupMenuWndProc    = 0x029c,
     NtUserDesktopWindowProc   = 0x029d,
     NtUserDefWindowProc       = 0x029e,
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/368



More information about the wine-devel mailing list