user32: Turn the combobox winproc into a Wow handler.

This commit is contained in:
Alexandre Julliard 2009-12-15 13:17:15 +01:00
parent 02e74fa8a6
commit 57d439f4f1
4 changed files with 84 additions and 79 deletions

View File

@ -41,7 +41,6 @@
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "wine/winuser16.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "user_private.h" #include "user_private.h"
#include "win.h" #include "win.h"
@ -1833,8 +1832,7 @@ static char *strdupA(LPCSTR str)
/*********************************************************************** /***********************************************************************
* ComboWndProc_common * ComboWndProc_common
*/ */
static LRESULT ComboWndProc_common( HWND hwnd, UINT message, LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode )
WPARAM wParam, LPARAM lParam, BOOL unicode )
{ {
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW( hwnd, 0 ); LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW( hwnd, 0 );
@ -2221,80 +2219,6 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
DefWindowProcA(hwnd, message, wParam, lParam); DefWindowProcA(hwnd, message, wParam, lParam);
} }
/***********************************************************************
* 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 * ComboWndProcA
* *
@ -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 ) static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{ {
if (!IsWindow(hwnd)) return 0; 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 ) static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{ {
if (!IsWindow(hwnd)) return 0; if (!IsWindow(hwnd)) return 0;
return ComboWndProc_wrapper16( hwnd, message, wParam, lParam, TRUE ); return wow_handlers.combo_proc( hwnd, message, wParam, lParam, TRUE );
} }
/************************************************************************* /*************************************************************************

View File

@ -62,16 +62,19 @@ extern const struct builtin_class_descr STATIC_builtin_class DECLSPEC_HIDDEN;
struct wow_handlers16 struct wow_handlers16
{ {
LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
}; };
struct wow_handlers32 struct wow_handlers32
{ {
LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL); 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 struct wow_handlers16 wow_handlers DECLSPEC_HIDDEN;
extern LRESULT ButtonWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) 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 register_wow_handlers(void) DECLSPEC_HIDDEN;
extern void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, extern void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new,

View File

@ -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) void register_wow_handlers(void)
{ {
static const struct wow_handlers16 handlers16 = static const struct wow_handlers16 handlers16 =
{ {
button_proc16, button_proc16,
combo_proc16,
}; };
UserRegisterWowHandlers( &handlers16, &wow_handlers32 ); UserRegisterWowHandlers( &handlers16, &wow_handlers32 );

View File

@ -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 ) void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wow_handlers32 *orig )
{ {
orig->button_proc = ButtonWndProc_common; orig->button_proc = ButtonWndProc_common;
orig->combo_proc = ComboWndProc_common;
wow_handlers = *new; wow_handlers = *new;
} }
struct wow_handlers16 wow_handlers = struct wow_handlers16 wow_handlers =
{ {
ButtonWndProc_common, ButtonWndProc_common,
ComboWndProc_common,
}; };