user32: Implement UserRegisterWowHandlers function and add a handler for the button winproc.

This commit is contained in:
Alexandre Julliard 2009-12-15 13:16:50 +01:00
parent 020c75b0fe
commit 02e74fa8a6
6 changed files with 77 additions and 26 deletions

View File

@ -73,7 +73,6 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/winuser16.h"
#include "controls.h"
#include "win.h"
#include "user_private.h"
@ -230,8 +229,7 @@ static void setup_clipping( HWND hwnd, HDC hdc )
/***********************************************************************
* ButtonWndProc_common
*/
static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam, BOOL unicode )
LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode )
{
RECT rect;
POINT pt;
@ -547,33 +545,13 @@ static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg,
return 0;
}
/***********************************************************************
* ButtonWndProc_wrapper16
*/
static LRESULT ButtonWndProc_wrapper16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
{
static const UINT msg16_offset = BM_GETCHECK16 - BM_GETCHECK;
switch (msg)
{
case BM_GETCHECK16:
case BM_SETCHECK16:
case BM_GETSTATE16:
case BM_SETSTATE16:
case BM_SETSTYLE16:
return ButtonWndProc_common( hwnd, msg - msg16_offset, wParam, lParam, FALSE );
default:
return ButtonWndProc_common( hwnd, msg, wParam, lParam, unicode );
}
}
/***********************************************************************
* ButtonWndProcW
*/
static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (!IsWindow( hWnd )) return 0;
return ButtonWndProc_wrapper16( hWnd, uMsg, wParam, lParam, TRUE );
return wow_handlers.button_proc( hWnd, uMsg, wParam, lParam, TRUE );
}
@ -583,7 +561,7 @@ static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (!IsWindow( hWnd )) return 0;
return ButtonWndProc_wrapper16( hWnd, uMsg, wParam, lParam, FALSE );
return wow_handlers.button_proc( hWnd, uMsg, wParam, lParam, FALSE );
}

View File

@ -57,6 +57,26 @@ extern const struct builtin_class_descr MESSAGE_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr SCROLL_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr STATIC_builtin_class DECLSPEC_HIDDEN;
/* Wow handlers */
struct wow_handlers16
{
LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
};
struct wow_handlers32
{
LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
};
extern struct wow_handlers16 wow_handlers DECLSPEC_HIDDEN;
extern LRESULT ButtonWndProc_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,
struct wow_handlers32 *orig );
extern WNDPROC EDIT_winproc_handle DECLSPEC_HIDDEN;
/* Class functions */

View File

@ -23,12 +23,15 @@
#include "winerror.h"
#include "win.h"
#include "user_private.h"
#include "controls.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msg);
DWORD USER16_AlertableWait = 0;
static struct wow_handlers32 wow_handlers32;
static LRESULT cwp_hook_callback( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
LRESULT *result, void *arg )
{
@ -584,3 +587,34 @@ BOOL16 WINAPI TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg )
}
return 0;
}
/***********************************************************************
* button_proc16
*/
static LRESULT button_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
{
static const UINT msg16_offset = BM_GETCHECK16 - BM_GETCHECK;
switch (msg)
{
case BM_GETCHECK16:
case BM_SETCHECK16:
case BM_GETSTATE16:
case BM_SETSTATE16:
case BM_SETSTYLE16:
return wow_handlers32.button_proc( hwnd, msg - msg16_offset, wParam, lParam, FALSE );
default:
return wow_handlers32.button_proc( hwnd, msg, wParam, lParam, unicode );
}
}
void register_wow_handlers(void)
{
static const struct wow_handlers16 handlers16 =
{
button_proc16,
};
UserRegisterWowHandlers( &handlers16, &wow_handlers32 );
}

View File

@ -1387,6 +1387,7 @@ BOOL WINAPI DllEntryPoint( DWORD reason, HINSTANCE16 inst, WORD ds,
if (USER_HeapSel) return TRUE; /* already called */
USER_HeapSel = ds;
register_wow_handlers();
return TRUE;
}

View File

@ -738,7 +738,7 @@
# @ stub UserLpkPSMTextOut
# @ stub UserLpkTabbedTextOut
@ stdcall UserRealizePalette(long)
@ stub UserRegisterWowHandlers
@ stdcall UserRegisterWowHandlers(ptr ptr)
# @ stub UserSetDeviceHoldState
@ stdcall UserSignalProc(long long long long)
# @ stub VRipOutput

View File

@ -2378,3 +2378,21 @@ INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam,
}
return ret;
}
/**********************************************************************
* UserRegisterWowHandlers (USER32.@)
*
* NOTE: no attempt has been made to be compatible here,
* the Windows function is most likely completely different.
*/
void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wow_handlers32 *orig )
{
orig->button_proc = ButtonWndProc_common;
wow_handlers = *new;
}
struct wow_handlers16 wow_handlers =
{
ButtonWndProc_common,
};