Alexandre Julliard : user32: Turn the combobox winproc into a Wow handler.
Alexandre Julliard
julliard at winehq.org
Tue Dec 15 09:40:20 CST 2009
Module: wine
Branch: master
Commit: 57d439f4f181c52c60aae6ad4473143c52a1b87c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=57d439f4f181c52c60aae6ad4473143c52a1b87c
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Dec 15 13:17:15 2009 +0100
user32: Turn the combobox winproc into a Wow handler.
---
dlls/user32/combo.c | 82 ++----------------------------------------------
dlls/user32/controls.h | 3 ++
dlls/user32/msg16.c | 76 ++++++++++++++++++++++++++++++++++++++++++++
dlls/user32/winproc.c | 2 +
4 files changed, 84 insertions(+), 79 deletions(-)
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
index a0f0eb5..c405c1a 100644
--- a/dlls/user32/combo.c
+++ b/dlls/user32/combo.c
@@ -41,7 +41,6 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
-#include "wine/winuser16.h"
#include "wine/unicode.h"
#include "user_private.h"
#include "win.h"
@@ -1833,8 +1832,7 @@ static char *strdupA(LPCSTR str)
/***********************************************************************
* ComboWndProc_common
*/
-static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam, BOOL unicode )
+LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode )
{
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW( hwnd, 0 );
@@ -2222,80 +2220,6 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
}
/***********************************************************************
- * ComboWndProc_wrapper16
- */
-static LRESULT ComboWndProc_wrapper16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
-{
- static const UINT msg16_offset = CB_GETEDITSEL16 - CB_GETEDITSEL;
-
- switch (msg)
- {
- case CB_INSERTSTRING16:
- case CB_SELECTSTRING16:
- case CB_FINDSTRING16:
- case CB_FINDSTRINGEXACT16:
- wParam = (INT)(INT16)wParam;
- /* fall through */
- case CB_ADDSTRING16:
- if (GetWindowLongW( hwnd, GWL_STYLE ) & CBS_HASSTRINGS) lParam = (LPARAM)MapSL(lParam);
- msg -= msg16_offset;
- break;
- case CB_SETITEMHEIGHT16:
- case CB_GETITEMHEIGHT16:
- case CB_SETCURSEL16:
- case CB_GETLBTEXTLEN16:
- case CB_GETITEMDATA16:
- case CB_SETITEMDATA16:
- wParam = (INT)(INT16)wParam; /* signed integer */
- msg -= msg16_offset;
- break;
- case CB_GETDROPPEDCONTROLRECT16:
- lParam = (LPARAM)MapSL(lParam);
- if (lParam)
- {
- RECT r;
- RECT16 *r16 = (RECT16 *)lParam;
- ComboWndProc_common( hwnd, CB_GETDROPPEDCONTROLRECT, wParam, (LPARAM)&r, FALSE );
- r16->left = r.left;
- r16->top = r.top;
- r16->right = r.right;
- r16->bottom = r.bottom;
- }
- return CB_OKAY;
- case CB_DIR16:
- if (wParam & DDL_DRIVES) wParam |= DDL_EXCLUSIVE;
- lParam = (LPARAM)MapSL(lParam);
- msg -= msg16_offset;
- break;
- case CB_GETLBTEXT16:
- wParam = (INT)(INT16)wParam;
- lParam = (LPARAM)MapSL(lParam);
- msg -= msg16_offset;
- break;
- case CB_GETEDITSEL16:
- wParam = lParam = 0; /* just in case */
- msg -= msg16_offset;
- break;
- case CB_LIMITTEXT16:
- case CB_SETEDITSEL16:
- case CB_DELETESTRING16:
- case CB_RESETCONTENT16:
- case CB_GETDROPPEDSTATE16:
- case CB_SHOWDROPDOWN16:
- case CB_GETCOUNT16:
- case CB_GETCURSEL16:
- case CB_SETEXTENDEDUI16:
- case CB_GETEXTENDEDUI16:
- msg -= msg16_offset;
- break;
- default:
- return ComboWndProc_common( hwnd, msg, wParam, lParam, unicode );
- }
- return ComboWndProc_common( hwnd, msg, wParam, lParam, FALSE );
-}
-
-
-/***********************************************************************
* ComboWndProcA
*
* This is just a wrapper for the real ComboWndProc which locks/unlocks
@@ -2304,7 +2228,7 @@ static LRESULT ComboWndProc_wrapper16( HWND hwnd, UINT msg, WPARAM wParam, LPARA
static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
if (!IsWindow(hwnd)) return 0;
- return ComboWndProc_wrapper16( hwnd, message, wParam, lParam, FALSE );
+ return wow_handlers.combo_proc( hwnd, message, wParam, lParam, FALSE );
}
/***********************************************************************
@@ -2313,7 +2237,7 @@ static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPA
static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
if (!IsWindow(hwnd)) return 0;
- return ComboWndProc_wrapper16( hwnd, message, wParam, lParam, TRUE );
+ return wow_handlers.combo_proc( hwnd, message, wParam, lParam, TRUE );
}
/*************************************************************************
diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index a407c93..64731b5 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -62,16 +62,19 @@ extern const struct builtin_class_descr STATIC_builtin_class DECLSPEC_HIDDEN;
struct wow_handlers16
{
LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
+ LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
};
struct wow_handlers32
{
LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
+ LRESULT (*combo_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 LRESULT ComboWndProc_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 b677e51..42710aa 100644
--- a/dlls/user32/msg16.c
+++ b/dlls/user32/msg16.c
@@ -609,11 +609,87 @@ static LRESULT button_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
}
}
+
+/***********************************************************************
+ * combo_proc16
+ */
+static LRESULT combo_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
+{
+ static const UINT msg16_offset = CB_GETEDITSEL16 - CB_GETEDITSEL;
+
+ switch (msg)
+ {
+ case CB_INSERTSTRING16:
+ case CB_SELECTSTRING16:
+ case CB_FINDSTRING16:
+ case CB_FINDSTRINGEXACT16:
+ wParam = (INT)(INT16)wParam;
+ /* fall through */
+ case CB_ADDSTRING16:
+ if (GetWindowLongW( hwnd, GWL_STYLE ) & CBS_HASSTRINGS) lParam = (LPARAM)MapSL(lParam);
+ msg -= msg16_offset;
+ break;
+ case CB_SETITEMHEIGHT16:
+ case CB_GETITEMHEIGHT16:
+ case CB_SETCURSEL16:
+ case CB_GETLBTEXTLEN16:
+ case CB_GETITEMDATA16:
+ case CB_SETITEMDATA16:
+ wParam = (INT)(INT16)wParam; /* signed integer */
+ msg -= msg16_offset;
+ break;
+ case CB_GETDROPPEDCONTROLRECT16:
+ lParam = (LPARAM)MapSL(lParam);
+ if (lParam)
+ {
+ RECT r;
+ RECT16 *r16 = (RECT16 *)lParam;
+ wow_handlers32.combo_proc( hwnd, CB_GETDROPPEDCONTROLRECT, wParam, (LPARAM)&r, FALSE );
+ r16->left = r.left;
+ r16->top = r.top;
+ r16->right = r.right;
+ r16->bottom = r.bottom;
+ }
+ return CB_OKAY;
+ case CB_DIR16:
+ if (wParam & DDL_DRIVES) wParam |= DDL_EXCLUSIVE;
+ lParam = (LPARAM)MapSL(lParam);
+ msg -= msg16_offset;
+ break;
+ case CB_GETLBTEXT16:
+ wParam = (INT)(INT16)wParam;
+ lParam = (LPARAM)MapSL(lParam);
+ msg -= msg16_offset;
+ break;
+ case CB_GETEDITSEL16:
+ wParam = lParam = 0; /* just in case */
+ msg -= msg16_offset;
+ break;
+ case CB_LIMITTEXT16:
+ case CB_SETEDITSEL16:
+ case CB_DELETESTRING16:
+ case CB_RESETCONTENT16:
+ case CB_GETDROPPEDSTATE16:
+ case CB_SHOWDROPDOWN16:
+ case CB_GETCOUNT16:
+ case CB_GETCURSEL16:
+ case CB_SETEXTENDEDUI16:
+ case CB_GETEXTENDEDUI16:
+ msg -= msg16_offset;
+ break;
+ default:
+ return wow_handlers32.combo_proc( hwnd, msg, wParam, lParam, unicode );
+ }
+ return wow_handlers32.combo_proc( hwnd, msg, wParam, lParam, FALSE );
+}
+
+
void register_wow_handlers(void)
{
static const struct wow_handlers16 handlers16 =
{
button_proc16,
+ combo_proc16,
};
UserRegisterWowHandlers( &handlers16, &wow_handlers32 );
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index 040fd72..3e85b77 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -2389,10 +2389,12 @@ 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;
wow_handlers = *new;
}
struct wow_handlers16 wow_handlers =
{
ButtonWndProc_common,
+ ComboWndProc_common,
};
More information about the wine-cvs
mailing list