user32: Pre-allocate the window procedure for the button class.

This commit is contained in:
Alexandre Julliard 2009-12-17 12:56:50 +01:00
parent b71173f7ac
commit 87f83f8618
3 changed files with 37 additions and 27 deletions

View File

@ -113,8 +113,6 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action );
static void UB_Paint( HWND hwnd, HDC hDC, UINT action );
static void OB_Paint( HWND hwnd, HDC hDC, UINT action );
static void BUTTON_CheckAutoRadioButton( HWND hwnd );
static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
#define MAX_BTN_TYPE 12
@ -164,8 +162,8 @@ const struct builtin_class_descr BUTTON_builtin_class =
{
buttonW, /* name */
CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */
ButtonWndProcA, /* procA */
ButtonWndProcW, /* procW */
NULL, /* procA */
BUILTIN_WINPROC(WINPROC_BUTTON), /* procW */
NB_EXTRA_BYTES, /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
@ -238,6 +236,8 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
LONG state;
HANDLE oldHbitmap;
if (!IsWindow( hWnd )) return 0;
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
@ -545,26 +545,6 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
return 0;
}
/***********************************************************************
* ButtonWndProcW
*/
static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (!IsWindow( hWnd )) return 0;
return wow_handlers.button_proc( hWnd, uMsg, wParam, lParam, TRUE );
}
/***********************************************************************
* ButtonWndProcA
*/
static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (!IsWindow( hWnd )) return 0;
return wow_handlers.button_proc( hWnd, uMsg, wParam, lParam, FALSE );
}
/**********************************************************************
* Convert button styles to flags used by DrawText.
*/

View File

@ -31,6 +31,15 @@
#define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771) /* WinSwitch */
#define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772) /* IconTitle */
enum builtin_winprocs
{
WINPROC_BUTTON = 0,
NB_BUILTIN_WINPROCS
};
#define WINPROC_HANDLE (~0u >> 16)
#define BUILTIN_WINPROC(index) ((WNDPROC)(ULONG_PTR)((index) | (WINPROC_HANDLE << 16)))
/* Built-in class descriptor */
struct builtin_class_descr
{

View File

@ -44,7 +44,6 @@ typedef struct tagWINDOWPROC
WNDPROC procW; /* Unicode window proc */
} WINDOWPROC;
#define WINPROC_HANDLE (~0u >> 16)
#define MAX_WINPROCS 4096
#define BUILTIN_WINPROCS 9 /* first BUILTIN_WINPROCS entries are reserved for builtin procs */
#define MAX_WINPROC_RECURSION 64
@ -52,8 +51,15 @@ typedef struct tagWINDOWPROC
WNDPROC EDIT_winproc_handle = 0;
static WINDOWPROC winproc_array[MAX_WINPROCS];
static UINT builtin_used;
static LRESULT WINAPI ButtonWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
static LRESULT WINAPI ButtonWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
static WINDOWPROC winproc_array[MAX_WINPROCS] =
{
{ ButtonWndProcA, ButtonWndProcW }, /* WINPROC_BUTTON */
};
static UINT builtin_used = NB_BUILTIN_WINPROCS;
static UINT winproc_used = BUILTIN_WINPROCS;
static CRITICAL_SECTION winproc_cs;
@ -1032,6 +1038,21 @@ INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam,
}
/***********************************************************************
* Window procedures for builtin classes
*/
static LRESULT WINAPI ButtonWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
return wow_handlers.button_proc( hwnd, msg, wParam, lParam, FALSE );
}
static LRESULT WINAPI ButtonWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
return wow_handlers.button_proc( hwnd, msg, wParam, lParam, TRUE );
}
/**********************************************************************
* UserRegisterWowHandlers (USER32.@)
*