Commit fc0753f9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move register_desktop_class implementation from user32.

parent 8f3352ed
......@@ -333,16 +333,6 @@ BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params,
/***********************************************************************
* register_desktop_class
*/
void register_desktop_class(void)
{
register_builtin( &DESKTOP_builtin_class );
register_builtin( &MESSAGE_builtin_class );
}
/***********************************************************************
* RegisterClassA (USER32.@)
*
* Register a window class.
......
......@@ -39,13 +39,11 @@ extern const struct builtin_class_descr BUTTON_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr COMBO_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr COMBOLBOX_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr DIALOG_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr DESKTOP_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr EDIT_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr ICONTITLE_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr LISTBOX_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr MDICLIENT_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr MENU_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr MESSAGE_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr SCROLL_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr STATIC_builtin_class DECLSPEC_HIDDEN;
extern const struct builtin_class_descr IME_builtin_class DECLSPEC_HIDDEN;
......@@ -102,7 +100,6 @@ extern LRESULT StaticWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDE
/* Class functions */
extern ATOM get_int_atom_value( UNICODE_STRING *name ) DECLSPEC_HIDDEN;
extern void register_desktop_class(void) DECLSPEC_HIDDEN;
/* desktop */
extern BOOL update_wallpaper( const WCHAR *wallpaper, const WCHAR *pattern ) DECLSPEC_HIDDEN;
......
......@@ -34,20 +34,6 @@ static SIZE bitmapSize;
static BOOL fTileWallPaper;
/*********************************************************************
* desktop class descriptor
*/
const struct builtin_class_descr DESKTOP_builtin_class =
{
(LPCWSTR)DESKTOP_CLASS_ATOM, /* name */
CS_DBLCLKS, /* style */
WINPROC_DESKTOP, /* proc */
0, /* extra */
0, /* cursor */
(HBRUSH)(COLOR_BACKGROUND+1) /* brush */
};
/***********************************************************************
* DESKTOP_LoadBitmap
*/
......
......@@ -47,18 +47,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(msg);
/* Message class descriptor */
const struct builtin_class_descr MESSAGE_builtin_class =
{
L"Message", /* name */
0, /* style */
WINPROC_MESSAGE, /* proc */
0, /* extra */
0, /* cursor */
0 /* brush */
};
/* pack a pointer into a 32/64 portable format */
static inline ULONGLONG pack_ptr( const void *ptr )
{
......
......@@ -220,7 +220,6 @@ static BOOL process_attach(void)
dpiaware_init();
winproc_init();
register_desktop_class();
/* Initialize system colors and metrics */
SYSPARAMS_Init();
......
......@@ -60,6 +60,17 @@ typedef struct tagCLASS
struct client_menu_name menu_name; /* Default menu name */
} CLASS;
/* Built-in class descriptor */
struct builtin_class_descr
{
const char *name; /* class name */
UINT style; /* class style */
INT extra; /* window extra bytes */
ULONG_PTR cursor; /* cursor id */
HBRUSH brush; /* brush or system color */
enum builtin_winprocs proc;
};
typedef struct tagWINDOWPROC
{
WNDPROC procA; /* ANSI window proc */
......@@ -1050,6 +1061,59 @@ BOOL needs_ime_window( HWND hwnd )
return ret;
}
static const struct builtin_class_descr desktop_builtin_class =
{
.name = MAKEINTRESOURCEA(DESKTOP_CLASS_ATOM),
.style = CS_DBLCLKS,
.proc = WINPROC_DESKTOP,
.brush = (HBRUSH)(COLOR_BACKGROUND + 1),
};
static const struct builtin_class_descr message_builtin_class =
{
.name = "Message",
.proc = WINPROC_MESSAGE,
};
/***********************************************************************
* register_builtin
*
* Register a builtin control class.
* This allows having both ANSI and Unicode winprocs for the same class.
*/
static void register_builtin( const struct builtin_class_descr *descr )
{
UNICODE_STRING name, version = { .Length = 0 };
struct client_menu_name menu_name = { 0 };
WCHAR nameW[64];
WNDCLASSEXW class = {
.cbSize = sizeof(class),
.hInstance = user32_module,
.style = descr->style,
.cbWndExtra = descr->extra,
.hbrBackground = descr->brush,
.lpfnWndProc = BUILTIN_WINPROC( descr->proc ),
};
if (descr->cursor)
class.hCursor = LoadImageW( 0, (const WCHAR *)descr->cursor, IMAGE_CURSOR,
0, 0, LR_SHARED | LR_DEFAULTSIZE );
if (IS_INTRESOURCE( descr->name ))
{
name.Buffer = (WCHAR *)descr->name;
name.Length = name.MaximumLength = 0;
}
else
{
asciiz_to_unicode( nameW, descr->name );
RtlInitUnicodeString( &name, nameW );
}
if (!NtUserRegisterClassExWOW( &class, &name, &version, &menu_name, 1, 0, NULL ) && class.hCursor)
NtUserDestroyCursor( class.hCursor, 0 );
}
static void register_builtins(void)
{
void *ret_ptr;
......@@ -1065,3 +1129,12 @@ void register_builtin_classes(void)
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
pthread_once( &init_once, register_builtins );
}
/***********************************************************************
* register_desktop_class
*/
void register_desktop_class(void)
{
register_builtin( &desktop_builtin_class );
register_builtin( &message_builtin_class );
}
......@@ -249,6 +249,7 @@ struct dce *get_class_dce( struct tagCLASS *class ) DECLSPEC_HIDDEN;
struct dce *set_class_dce( struct tagCLASS *class, struct dce *dce ) DECLSPEC_HIDDEN;
BOOL needs_ime_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern void register_builtin_classes(void) DECLSPEC_HIDDEN;
extern void register_desktop_class(void) DECLSPEC_HIDDEN;
/* cursoricon.c */
HICON alloc_cursoricon_handle( BOOL is_icon ) DECLSPEC_HIDDEN;
......
......@@ -29,6 +29,7 @@
#include "windef.h"
#include "winnt.h"
#include "ntgdi_private.h"
#include "ntuser_private.h"
#include "ntuser.h"
#include "wine/unixlib.h"
......@@ -318,6 +319,7 @@ static NTSTATUS init( void *dispatcher )
if ((status = gdi_init())) return status;
winstation_init();
sysparams_init();
register_desktop_class();
return STATUS_SUCCESS;
}
......
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