From 8649f73056d79a06159b5b5787f0e86b4e2ab69a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 15 Dec 2009 13:19:53 +0100 Subject: [PATCH] user32: Turn the static winproc into a Wow handler. --- dlls/user32/controls.h | 3 +++ dlls/user32/msg16.c | 19 +++++++++++++++++++ dlls/user32/static.c | 25 +++---------------------- dlls/user32/winproc.c | 2 ++ 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index 82036bf4a60..036282bf6ec 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -66,6 +66,7 @@ struct wow_handlers16 LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); + LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); }; struct wow_handlers32 @@ -75,6 +76,7 @@ struct wow_handlers32 LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); + LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); }; extern struct wow_handlers16 wow_handlers DECLSPEC_HIDDEN; @@ -84,6 +86,7 @@ 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 LRESULT StaticWndProc_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 239e8e5bfbc..7ccf0490bfc 100644 --- a/dlls/user32/msg16.c +++ b/dlls/user32/msg16.c @@ -1191,6 +1191,24 @@ static LRESULT scrollbar_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar } +/*********************************************************************** + * static_proc16 + */ +static LRESULT static_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode ) +{ + switch (msg) + { + case STM_SETICON16: + wParam = (WPARAM)HICON_32( (HICON16)wParam ); + return wow_handlers32.static_proc( hwnd, STM_SETICON, wParam, lParam, FALSE ); + case STM_GETICON16: + return HICON_16( wow_handlers32.static_proc( hwnd, STM_GETICON, wParam, lParam, FALSE )); + default: + return wow_handlers32.static_proc( hwnd, msg, wParam, lParam, unicode ); + } +} + + void register_wow_handlers(void) { static const struct wow_handlers16 handlers16 = @@ -1200,6 +1218,7 @@ void register_wow_handlers(void) edit_proc16, listbox_proc16, scrollbar_proc16, + static_proc16, }; UserRegisterWowHandlers( &handlers16, &wow_handlers32 ); diff --git a/dlls/user32/static.c b/dlls/user32/static.c index 80c502dca5e..b33033a0c80 100644 --- a/dlls/user32/static.c +++ b/dlls/user32/static.c @@ -47,7 +47,6 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" -#include "wine/winuser16.h" #include "controls.h" #include "user_private.h" #include "wine/debug.h" @@ -400,8 +399,7 @@ static BOOL hasTextStyle( DWORD style ) /*********************************************************************** * StaticWndProc_common */ -static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, - LPARAM lParam, BOOL unicode ) +LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode ) { LRESULT lResult = 0; LONG full_style = GetWindowLongW( hwnd, GWL_STYLE ); @@ -606,30 +604,13 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, return lResult; } -/*********************************************************************** - * StaticWndProc_wrapper16 - */ -static LRESULT StaticWndProc_wrapper16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode ) -{ - switch (msg) - { - case STM_SETICON16: - wParam = (WPARAM)HICON_32( (HICON16)wParam ); - return StaticWndProc_common( hwnd, STM_SETICON, wParam, lParam, FALSE ); - case STM_GETICON16: - return HICON_16( StaticWndProc_common( hwnd, STM_GETICON, wParam, lParam, FALSE )); - default: - return StaticWndProc_common( hwnd, msg, wParam, lParam, unicode ); - } -} - /*********************************************************************** * StaticWndProcA */ static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if (!IsWindow( hWnd )) return 0; - return StaticWndProc_wrapper16(hWnd, uMsg, wParam, lParam, FALSE); + return wow_handlers.static_proc(hWnd, uMsg, wParam, lParam, FALSE); } /*********************************************************************** @@ -638,7 +619,7 @@ static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if (!IsWindow( hWnd )) return 0; - return StaticWndProc_wrapper16(hWnd, uMsg, wParam, lParam, TRUE); + return wow_handlers.static_proc(hWnd, uMsg, wParam, lParam, TRUE); } static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style ) diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index d434961c4ba..67671c99f63 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -2393,6 +2393,7 @@ void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wo orig->edit_proc = EditWndProc_common; orig->listbox_proc = ListBoxWndProc_common; orig->scrollbar_proc = ScrollBarWndProc_common; + orig->static_proc = StaticWndProc_common; wow_handlers = *new; } @@ -2404,4 +2405,5 @@ struct wow_handlers16 wow_handlers = EditWndProc_common, ListBoxWndProc_common, ScrollBarWndProc_common, + StaticWndProc_common, };