Alexandre Julliard : user32: Turn the scrollbar winproc into a Wow handler.

Alexandre Julliard julliard at winehq.org
Tue Dec 15 09:40:20 CST 2009


Module: wine
Branch: master
Commit: 3dc6317fc6cbdec26c0dbab798bef5dffd178650
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3dc6317fc6cbdec26c0dbab798bef5dffd178650

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 15 13:19:30 2009 +0100

user32: Turn the scrollbar winproc into a Wow handler.

---

 dlls/user32/controls.h |    3 +++
 dlls/user32/msg16.c    |   33 +++++++++++++++++++++++++++++++++
 dlls/user32/scroll.c   |   40 ++++------------------------------------
 dlls/user32/winproc.c  |   10 ++++++----
 4 files changed, 46 insertions(+), 40 deletions(-)

diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index 80f6bf5..82036bf 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -65,6 +65,7 @@ struct wow_handlers16
     LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
+    LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
 };
 
 struct wow_handlers32
@@ -73,6 +74,7 @@ struct wow_handlers32
     LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
+    LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
 };
 
 extern struct wow_handlers16 wow_handlers DECLSPEC_HIDDEN;
@@ -81,6 +83,7 @@ extern LRESULT ButtonWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDE
 extern LRESULT ComboWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
 extern LRESULT EditWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
 extern LRESULT ListBoxWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
+extern LRESULT ScrollBarWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
 
 extern void register_wow_handlers(void) DECLSPEC_HIDDEN;
 extern void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new,
diff --git a/dlls/user32/msg16.c b/dlls/user32/msg16.c
index 2ebb133..239e8e5 100644
--- a/dlls/user32/msg16.c
+++ b/dlls/user32/msg16.c
@@ -1159,6 +1159,38 @@ static LRESULT listbox_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
 }
 
 
+/***********************************************************************
+ *           scrollbar_proc16
+ */
+static LRESULT scrollbar_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
+{
+    static const UINT msg16_offset = SBM_SETPOS16 - SBM_SETPOS;
+
+    switch (msg)
+    {
+    case SBM_SETPOS16:
+    case SBM_GETPOS16:
+    case SBM_ENABLE_ARROWS16:
+        msg -= msg16_offset;
+        break;
+    case SBM_SETRANGE16:
+        msg = wParam ? SBM_SETRANGEREDRAW : SBM_SETRANGE;
+        wParam = LOWORD(lParam);
+        lParam = HIWORD(lParam);
+        break;
+    case SBM_GETRANGE16:
+    {
+        INT min, max;
+        wow_handlers32.scrollbar_proc( hwnd, SBM_GETRANGE, (WPARAM)&min, (LPARAM)&max, FALSE );
+        return MAKELRESULT(min, max);
+    }
+    default:
+        return wow_handlers32.scrollbar_proc( hwnd, msg, wParam, lParam, unicode );
+    }
+    return wow_handlers32.scrollbar_proc( hwnd, msg, wParam, lParam, FALSE );
+}
+
+
 void register_wow_handlers(void)
 {
     static const struct wow_handlers16 handlers16 =
@@ -1167,6 +1199,7 @@ void register_wow_handlers(void)
         combo_proc16,
         edit_proc16,
         listbox_proc16,
+        scrollbar_proc16,
     };
 
     UserRegisterWowHandlers( &handlers16, &wow_handlers32 );
diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index 6ab1e56..b948c82 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -33,7 +33,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
-#include "wine/winuser16.h"
 #include "controls.h"
 #include "win.h"
 #include "wine/debug.h"
@@ -1401,9 +1400,9 @@ static BOOL SCROLL_SetScrollRange(HWND hwnd, INT nBar, INT minVal, INT maxVal)
 
 
 /***********************************************************************
- *           ScrollBarWndProc
+ *           ScrollBarWndProc_common
  */
-static LRESULT ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode )
+LRESULT ScrollBarWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode )
 {
     if (!IsWindow( hwnd )) return 0;
 
@@ -1576,42 +1575,11 @@ static LRESULT ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM
 
 
 /***********************************************************************
- *           ScrollBarWndProc_wrapper16
- */
-static LRESULT ScrollBarWndProc_wrapper16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
-{
-    static const UINT msg16_offset = SBM_SETPOS16 - SBM_SETPOS;
-
-    switch (msg)
-    {
-    case SBM_SETPOS16:
-    case SBM_GETPOS16:
-    case SBM_ENABLE_ARROWS16:
-        msg -= msg16_offset;
-        break;
-    case SBM_SETRANGE16:
-        msg = wParam ? SBM_SETRANGEREDRAW : SBM_SETRANGE;
-        wParam = LOWORD(lParam);
-        lParam = HIWORD(lParam);
-        break;
-    case SBM_GETRANGE16:
-    {
-        INT min, max;
-        ScrollBarWndProc( hwnd, SBM_GETRANGE, (WPARAM)&min, (LPARAM)&max, FALSE );
-        return MAKELRESULT(min, max);
-    }
-    default:
-        return ScrollBarWndProc( hwnd, msg, wParam, lParam, unicode );
-    }
-    return ScrollBarWndProc( hwnd, msg, wParam, lParam, FALSE );
-}
-
-/***********************************************************************
  *           ScrollBarWndProcA
  */
 static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
 {
-    return ScrollBarWndProc_wrapper16( hwnd, message, wParam, lParam, FALSE );
+    return wow_handlers.scrollbar_proc( hwnd, message, wParam, lParam, FALSE );
 }
 
 
@@ -1620,7 +1588,7 @@ static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT message, WPARAM wParam,
  */
 static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
 {
-    return ScrollBarWndProc_wrapper16( hwnd, message, wParam, lParam, TRUE );
+    return wow_handlers.scrollbar_proc( hwnd, message, wParam, lParam, TRUE );
 }
 
 
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index 0a91a58..d434961 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -2388,10 +2388,11 @@ INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam,
  */
 void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wow_handlers32 *orig )
 {
-    orig->button_proc  = ButtonWndProc_common;
-    orig->combo_proc   = ComboWndProc_common;
-    orig->edit_proc    = EditWndProc_common;
-    orig->listbox_proc = ListBoxWndProc_common;
+    orig->button_proc    = ButtonWndProc_common;
+    orig->combo_proc     = ComboWndProc_common;
+    orig->edit_proc      = EditWndProc_common;
+    orig->listbox_proc   = ListBoxWndProc_common;
+    orig->scrollbar_proc = ScrollBarWndProc_common;
 
     wow_handlers = *new;
 }
@@ -2402,4 +2403,5 @@ struct wow_handlers16 wow_handlers =
     ComboWndProc_common,
     EditWndProc_common,
     ListBoxWndProc_common,
+    ScrollBarWndProc_common,
 };




More information about the wine-cvs mailing list