Commit 8494682f authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Move 16-bit window creation functions to 16-bit files.

parent 4b3c0e31
......@@ -98,6 +98,7 @@ struct wow_handlers32
LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
HWND (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,UINT);
WNDPROC (*alloc_winproc)(WNDPROC,WNDPROC);
};
......
......@@ -2003,6 +2003,73 @@ BOOL16 WINAPI TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg )
/***********************************************************************
* CreateWindowEx (USER.452)
*/
HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
LPCSTR windowName, DWORD style, INT16 x,
INT16 y, INT16 width, INT16 height,
HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, LPVOID data )
{
CREATESTRUCTA cs;
char buffer[256];
HWND hwnd;
/* Fix the coordinates */
cs.x = (x == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)x;
cs.y = (y == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)y;
cs.cx = (width == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)width;
cs.cy = (height == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)height;
/* Create the window */
cs.lpCreateParams = data;
cs.hInstance = HINSTANCE_32(instance);
cs.hMenu = HMENU_32(menu);
cs.hwndParent = WIN_Handle32( parent );
cs.style = style;
cs.lpszName = windowName;
cs.lpszClass = className;
cs.dwExStyle = exStyle;
/* map to module handle */
if (instance) instance = GetExePtr( instance );
/* load the menu */
if (!menu && (style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
{
WNDCLASSA class;
if (GetClassInfoA( HINSTANCE_32(instance), className, &class ))
cs.hMenu = HMENU_32( LoadMenu16( instance, class.lpszMenuName ));
}
if (!IS_INTRESOURCE(className))
{
WCHAR bufferW[256];
if (!MultiByteToWideChar( CP_ACP, 0, className, -1, bufferW, sizeof(bufferW)/sizeof(WCHAR) ))
return 0;
hwnd = wow_handlers32.create_window( (CREATESTRUCTW *)&cs, bufferW,
HINSTANCE_32(instance), 0 );
}
else
{
if (!GlobalGetAtomNameA( LOWORD(className), buffer, sizeof(buffer) ))
{
ERR( "bad atom %x\n", LOWORD(className));
return 0;
}
cs.lpszClass = buffer;
hwnd = wow_handlers32.create_window( (CREATESTRUCTW *)&cs, (LPCWSTR)className,
HINSTANCE_32(instance), 0 );
}
return HWND_16( hwnd );
}
/***********************************************************************
* button_proc16
*/
static LRESULT button_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
......
......@@ -27,9 +27,6 @@
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "wownt32.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "win.h"
......@@ -884,7 +881,7 @@ void WIN_DestroyThreadWindows( HWND hwnd )
*/
static void WIN_FixCoordinates( CREATESTRUCTW *cs, INT *sw)
{
#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == CW_USEDEFAULT16)
#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == (SHORT)0x8000)
POINT pos[2];
if (cs->dwExStyle & WS_EX_MDICHILD)
......@@ -1072,7 +1069,7 @@ static void dump_window_styles( DWORD style, DWORD exstyle )
*
* Implementation of CreateWindowEx().
*/
static HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags )
HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags )
{
INT cx, cy, style, sw = SW_SHOW;
LRESULT result;
......@@ -1440,83 +1437,6 @@ failed:
/***********************************************************************
* CreateWindow (USER.41)
*/
HWND16 WINAPI CreateWindow16( LPCSTR className, LPCSTR windowName,
DWORD style, INT16 x, INT16 y, INT16 width,
INT16 height, HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, LPVOID data )
{
return CreateWindowEx16( 0, className, windowName, style,
x, y, width, height, parent, menu, instance, data );
}
/***********************************************************************
* CreateWindowEx (USER.452)
*/
HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
LPCSTR windowName, DWORD style, INT16 x,
INT16 y, INT16 width, INT16 height,
HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, LPVOID data )
{
CREATESTRUCTA cs;
char buffer[256];
/* Fix the coordinates */
cs.x = (x == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)x;
cs.y = (y == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)y;
cs.cx = (width == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)width;
cs.cy = (height == CW_USEDEFAULT16) ? CW_USEDEFAULT : (INT)height;
/* Create the window */
cs.lpCreateParams = data;
cs.hInstance = HINSTANCE_32(instance);
cs.hMenu = HMENU_32(menu);
cs.hwndParent = WIN_Handle32( parent );
cs.style = style;
cs.lpszName = windowName;
cs.lpszClass = className;
cs.dwExStyle = exStyle;
/* map to module handle */
if (instance) instance = GetExePtr( instance );
/* load the menu */
if (!menu && (style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
{
WNDCLASSA class;
if (GetClassInfoA( HINSTANCE_32(instance), className, &class ))
cs.hMenu = HMENU_32( LoadMenu16( instance, class.lpszMenuName ));
}
if (!IS_INTRESOURCE(className))
{
WCHAR bufferW[256];
if (!MultiByteToWideChar( CP_ACP, 0, className, -1, bufferW, sizeof(bufferW)/sizeof(WCHAR) ))
return 0;
return HWND_16( WIN_CreateWindowEx( (CREATESTRUCTW *)&cs, bufferW, HINSTANCE_32(instance), 0 ));
}
else
{
if (!GlobalGetAtomNameA( LOWORD(className), buffer, sizeof(buffer) ))
{
ERR( "bad atom %x\n", LOWORD(className));
return 0;
}
cs.lpszClass = buffer;
return HWND_16( WIN_CreateWindowEx( (CREATESTRUCTW *)&cs, (LPCWSTR)className,
HINSTANCE_32(instance), 0 ));
}
}
/***********************************************************************
* CreateWindowExA (USER32.@)
*/
HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
......
......@@ -87,6 +87,7 @@ extern ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPE
extern BOOL WIN_GetRectangles( HWND hwnd, RECT *rectWindow, RECT *rectClient ) DECLSPEC_HIDDEN;
extern LRESULT WIN_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN;
extern void WIN_DestroyThreadWindows( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, UINT flags ) DECLSPEC_HIDDEN;
extern BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL ) DECLSPEC_HIDDEN;
extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN;
extern LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOOL unicode ) DECLSPEC_HIDDEN;
......
......@@ -1135,6 +1135,7 @@ void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wo
orig->mdiclient_proc = MDIClientWndProc_common;
orig->scrollbar_proc = ScrollBarWndProc_common;
orig->static_proc = StaticWndProc_common;
orig->create_window = WIN_CreateWindowEx;
orig->alloc_winproc = WINPROC_AllocProc;
wow_handlers = *new;
......
......@@ -305,6 +305,19 @@ BOOL16 WINAPI EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps )
}
/***********************************************************************
* CreateWindow (USER.41)
*/
HWND16 WINAPI CreateWindow16( LPCSTR className, LPCSTR windowName,
DWORD style, INT16 x, INT16 y, INT16 width,
INT16 height, HWND16 parent, HMENU16 menu,
HINSTANCE16 instance, LPVOID data )
{
return CreateWindowEx16( 0, className, windowName, style,
x, y, width, height, parent, menu, instance, data );
}
/**************************************************************************
* ShowWindow (USER.42)
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment