Alexandre Julliard : user32: Pre-allocate the window procedure for the button class.
Alexandre Julliard
julliard at winehq.org
Thu Dec 17 10:37:09 CST 2009
Module: wine
Branch: master
Commit: 87f83f8618105eaa5fcd9d03399118c106707a74
URL: http://source.winehq.org/git/wine.git/?a=commit;h=87f83f8618105eaa5fcd9d03399118c106707a74
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Dec 17 12:56:50 2009 +0100
user32: Pre-allocate the window procedure for the button class.
---
dlls/user32/button.c | 28 ++++------------------------
dlls/user32/controls.h | 9 +++++++++
dlls/user32/winproc.c | 27 ++++++++++++++++++++++++---
3 files changed, 37 insertions(+), 27 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 42163eb..6e68785 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -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.
*/
diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index 45dd2d0..501520f 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -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
{
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index 0bde530..dd3e234 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -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.@)
*
More information about the wine-cvs
mailing list