win32u: Move builtin classes registration from user32.

This commit is contained in:
Jacek Caban 2022-07-29 20:33:22 +02:00 committed by Alexandre Julliard
parent 30209d86b0
commit ed693f5b32
17 changed files with 107 additions and 229 deletions

View file

@ -118,19 +118,6 @@ static const pfPaint btnPaintFunc[MAX_BTN_TYPE] =
OB_Paint /* BS_OWNERDRAW */
};
/*********************************************************************
* button class descriptor
*/
const struct builtin_class_descr BUTTON_builtin_class =
{
L"Button", /* name */
CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */
WINPROC_BUTTON, /* proc */
NB_EXTRA_BYTES, /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
static inline LONG get_button_state( HWND hwnd )
{

View file

@ -264,32 +264,6 @@ static void get_versioned_name( const WCHAR *name, UNICODE_STRING *ret, UNICODE_
}
/***********************************************************************
* 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 };
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 = LoadCursorA( 0, (LPSTR)descr->cursor );
init_class_name( &name, descr->name );
if (!NtUserRegisterClassExWOW( &class, &name, &version, &menu_name, 1, 0, NULL ) && class.hCursor)
DestroyCursor( class.hCursor );
}
static void load_uxtheme(void)
{
BOOL (WINAPI * pIsThemeActive)(void);
@ -305,25 +279,12 @@ static void load_uxtheme(void)
}
/***********************************************************************
* User32RegisterBuiltinClasses
* User32InitBuiltinClasses
*/
BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, ULONG size )
BOOL WINAPI User32InitBuiltinClasses( const struct win_hook_params *params, ULONG size )
{
DWORD layout;
register_builtin( &BUTTON_builtin_class );
register_builtin( &COMBO_builtin_class );
register_builtin( &COMBOLBOX_builtin_class );
register_builtin( &DIALOG_builtin_class );
register_builtin( &EDIT_builtin_class );
register_builtin( &ICONTITLE_builtin_class );
register_builtin( &LISTBOX_builtin_class );
register_builtin( &MDICLIENT_builtin_class );
register_builtin( &MENU_builtin_class );
register_builtin( &SCROLL_builtin_class );
register_builtin( &STATIC_builtin_class );
register_builtin( &IME_builtin_class );
GetProcessDefaultLayout( &layout ); /* make sure that process layout is initialized */
/* Load uxtheme.dll so that standard scrollbars and dialogs are hooked for theming support */

View file

@ -76,20 +76,6 @@ static UINT CBitHeight, CBitWidth;
static void CBCalcPlacement(HEADCOMBO *combo);
static void CBResetPos(HEADCOMBO *combo, BOOL redraw);
/*********************************************************************
* combo class descriptor
*/
const struct builtin_class_descr COMBO_builtin_class =
{
L"ComboBox", /* name */
CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, /* style */
WINPROC_COMBO, /* proc */
sizeof(HEADCOMBO *), /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
/***********************************************************************
* COMBO_Init
*

View file

@ -24,30 +24,6 @@
#include "winuser.h"
#include "../win32u/ntuser_private.h"
/* Built-in class descriptor */
struct builtin_class_descr
{
LPCWSTR name; /* class name */
UINT style; /* class style */
enum builtin_winprocs proc;
INT extra; /* window extra bytes */
ULONG_PTR cursor; /* cursor id */
HBRUSH brush; /* brush or system color */
};
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 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 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;
extern LRESULT WINAPI ImeWndProcA(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;
extern LRESULT WINAPI ImeWndProcW(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;
extern LRESULT WINAPI DesktopWndProc(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;

View file

@ -85,20 +85,6 @@ typedef struct
} RADIOGROUP;
/*********************************************************************
* dialog class descriptor
*/
const struct builtin_class_descr DIALOG_builtin_class =
{
(LPCWSTR)DIALOG_CLASS_ATOM, /* name */
CS_SAVEBITS | CS_DBLCLKS, /* style */
WINPROC_DIALOG, /* proc */
DLGWINDOWEXTRA, /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
/***********************************************************************
* DIALOG_GetControl32
*

View file

@ -5255,17 +5255,3 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
return result;
}
/*********************************************************************
* edit class descriptor
*/
const struct builtin_class_descr EDIT_builtin_class =
{
L"Edit", /* name */
CS_DBLCLKS | CS_PARENTDC, /* style */
WINPROC_EDIT, /* proc */
sizeof(UINT64), /* extra */
IDC_IBEAM, /* cursor */
0 /* brush */
};

View file

@ -32,19 +32,6 @@
static BOOL bMultiLineTitle;
static HFONT hIconTitleFont;
/*********************************************************************
* icon title class descriptor
*/
const struct builtin_class_descr ICONTITLE_builtin_class =
{
(LPCWSTR)ICONTITLE_CLASS_ATOM, /* name */
0, /* style */
WINPROC_ICONTITLE, /* proc */
0, /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
/***********************************************************************
* ICONTITLE_SetTitlePos
*/

View file

@ -241,33 +241,6 @@ static void remove_item_data(LB_DESCR *descr, UINT index)
memmove(p, p + size, (descr->nb_items - index) * size);
}
/*********************************************************************
* listbox class descriptor
*/
const struct builtin_class_descr LISTBOX_builtin_class =
{
L"ListBox", /* name */
CS_DBLCLKS /*| CS_PARENTDC*/, /* style */
WINPROC_LISTBOX, /* proc */
sizeof(LB_DESCR *), /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
/*********************************************************************
* combolbox class descriptor
*/
const struct builtin_class_descr COMBOLBOX_builtin_class =
{
L"ComboLBox", /* name */
CS_DBLCLKS | CS_SAVEBITS, /* style */
WINPROC_LISTBOX, /* proc */
sizeof(LB_DESCR *), /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
/***********************************************************************
* LISTBOX_GetCurrentPageSize

View file

@ -178,20 +178,6 @@ static void MDI_PostUpdate(HWND hwnd, MDICLIENTINFO* ci, WORD recalc)
}
/*********************************************************************
* MDIClient class descriptor
*/
const struct builtin_class_descr MDICLIENT_builtin_class =
{
L"MDIClient", /* name */
0, /* style */
WINPROC_MDICLIENT, /* proc */
2 * sizeof(void *), /* extra */
IDC_ARROW, /* cursor */
(HBRUSH)(COLOR_APPWORKSPACE+1) /* brush */
};
static MDICLIENTINFO *get_client_info( HWND client )
{
return NtUserGetMDIClientInfo( client );

View file

@ -68,19 +68,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(menu);
#define STATE_MASK (~TYPE_MASK)
#define MENUITEMINFO_STATE_MASK (STATE_MASK & ~(MF_BYPOSITION | MF_MOUSESELECT))
/*********************************************************************
* menu class descriptor
*/
const struct builtin_class_descr MENU_builtin_class =
{
(LPCWSTR)POPUPMENU_CLASS_ATOM, /* name */
CS_DROPSHADOW | CS_SAVEBITS | CS_DBLCLKS, /* style */
WINPROC_MENU, /* proc */
sizeof(HMENU), /* extra */
IDC_ARROW, /* cursor */
(HBRUSH)(COLOR_MENU+1) /* brush */
};
/**********************************************************************
* MENU_ParseResource

View file

@ -530,16 +530,6 @@ BOOL WINAPI GetPointerType(UINT32 id, POINTER_INPUT_TYPE *type)
return TRUE;
}
const struct builtin_class_descr IME_builtin_class =
{
L"IME", /* name */
0, /* style */
WINPROC_IME, /* proc */
2*sizeof(LONG_PTR), /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
LRESULT WINAPI ImeWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
if (!imm_ime_wnd_proc) return DefWindowProcA(hwnd, msg, wParam, lParam);

View file

@ -35,19 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(scroll);
/* Overlap between arrows and thumb */
#define SCROLL_ARROW_THUMB_OVERLAP 0
/*********************************************************************
* scrollbar class descriptor
*/
const struct builtin_class_descr SCROLL_builtin_class =
{
L"ScrollBar", /* name */
CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */
WINPROC_SCROLLBAR, /* proc */
sizeof(struct scroll_bar_win_data), /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
/***********************************************************************
* SCROLL_DrawArrows

View file

@ -52,7 +52,6 @@ static COLORREF color_3dshadow, color_3ddkshadow, color_3dhighlight;
/* offsets for GetWindowLong for static private information */
#define HFONT_GWL_OFFSET 0
#define HICON_GWL_OFFSET (sizeof(HFONT))
#define STATIC_EXTRA_BYTES (HICON_GWL_OFFSET + sizeof(HICON))
typedef void (*pfPaint)( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style );
@ -80,19 +79,6 @@ static const pfPaint staticPaintFunc[SS_TYPEMASK+1] =
};
/*********************************************************************
* static class descriptor
*/
const struct builtin_class_descr STATIC_builtin_class =
{
L"Static", /* name */
CS_DBLCLKS | CS_PARENTDC, /* style */
WINPROC_STATIC, /* proc */
STATIC_EXTRA_BYTES, /* extra */
IDC_ARROW, /* cursor */
0 /* brush */
};
/***********************************************************************
* STATIC_SetIcon
*

View file

@ -201,11 +201,11 @@ static const void *kernel_callback_table[NtUserCallCount] =
User32FreeCachedClipboardData,
User32ImmProcessKey,
User32ImmTranslateMessage,
User32InitBuiltinClasses,
User32LoadDriver,
User32LoadImage,
User32LoadSysMenu,
User32PostDDEMessage,
User32RegisterBuiltinClasses,
User32RenderSsynthesizedFormat,
User32UnpackDDEMessage,
};

View file

@ -96,7 +96,7 @@ BOOL WINAPI User32CallSendAsyncCallback( const struct send_async_params *params,
BOOL WINAPI User32CallWinEventHook( const struct win_event_hook_params *params, ULONG size );
BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size );
BOOL WINAPI User32CallWindowsHook( const struct win_hook_params *params, ULONG size );
BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, ULONG size );
BOOL WINAPI User32InitBuiltinClasses( const struct win_hook_params *params, ULONG size );
/* message spy definitions */

View file

@ -1075,6 +1075,104 @@ static const struct builtin_class_descr message_builtin_class =
.proc = WINPROC_MESSAGE,
};
static const struct builtin_class_descr builtin_classes[] =
{
/* button */
{
.name = "Button",
.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
.proc = WINPROC_BUTTON,
.extra = sizeof(UINT) + 2 * sizeof(HANDLE),
.cursor = IDC_ARROW,
},
/* combo */
{
.name = "ComboBox",
.style = CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
.proc = WINPROC_COMBO,
.extra = sizeof(void *),
.cursor = IDC_ARROW,
},
/* combolbox */
{
.name = "ComboLBox",
.style = CS_DBLCLKS | CS_SAVEBITS,
.proc = WINPROC_LISTBOX,
.extra = sizeof(void *),
.cursor = IDC_ARROW,
},
/* dialog */
{
.name = MAKEINTRESOURCEA(DIALOG_CLASS_ATOM),
.style = CS_SAVEBITS | CS_DBLCLKS,
.proc = WINPROC_DIALOG,
.extra = DLGWINDOWEXTRA,
.cursor = IDC_ARROW,
},
/* edit */
{
.name = "Edit",
.style = CS_DBLCLKS | CS_PARENTDC,
.proc = WINPROC_EDIT,
.extra = sizeof(UINT64),
.cursor = IDC_IBEAM,
},
/* icon title */
{
.name = MAKEINTRESOURCEA(ICONTITLE_CLASS_ATOM),
.proc = WINPROC_ICONTITLE,
.cursor = IDC_ARROW,
},
/* IME */
{
.name = "IME",
.proc = WINPROC_IME,
.extra = 2 * sizeof(LONG_PTR),
.cursor = IDC_ARROW,
},
/* listbox */
{
.name = "ListBox",
.style = CS_DBLCLKS,
.proc = WINPROC_LISTBOX,
.extra = sizeof(void *),
.cursor = IDC_ARROW,
},
/* menu */
{
.name = MAKEINTRESOURCEA(POPUPMENU_CLASS_ATOM),
.style = CS_DROPSHADOW | CS_SAVEBITS | CS_DBLCLKS,
.proc = WINPROC_MENU,
.extra = sizeof(HMENU),
.cursor = IDC_ARROW,
.brush = (HBRUSH)(COLOR_MENU + 1),
},
/* MDIClient */
{
.name = "MDIClient",
.proc = WINPROC_MDICLIENT,
.extra = 2 * sizeof(void *),
.cursor = IDC_ARROW,
.brush = (HBRUSH)(COLOR_APPWORKSPACE + 1),
},
/* scrollbar */
{
.name = "ScrollBar",
.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
.proc = WINPROC_SCROLLBAR,
.extra = sizeof(struct scroll_bar_win_data),
.cursor = IDC_ARROW,
},
/* static */
{
.name = "Static",
.style = CS_DBLCLKS | CS_PARENTDC,
.proc = WINPROC_STATIC,
.extra = 2 * sizeof(HANDLE),
.cursor = IDC_ARROW,
},
};
/***********************************************************************
* register_builtin
*
@ -1116,9 +1214,11 @@ static void register_builtin( const struct builtin_class_descr *descr )
static void register_builtins(void)
{
ULONG ret_len, i;
void *ret_ptr;
ULONG ret_len;
KeUserModeCallback( NtUserRegisterBuiltinClasses, NULL, 0, &ret_ptr, &ret_len );
for (i = 0; i < ARRAYSIZE(builtin_classes); i++) register_builtin( &builtin_classes[i] );
KeUserModeCallback( NtUserInitBuiltinClasses, NULL, 0, &ret_ptr, &ret_len );
}
/***********************************************************************

View file

@ -39,11 +39,11 @@ enum
NtUserFreeCachedClipboardData,
NtUserImmProcessKey,
NtUserImmTranslateMessage,
NtUserInitBuiltinClasses,
NtUserLoadDriver,
NtUserLoadImage,
NtUserLoadSysMenu,
NtUserPostDDEMessage,
NtUserRegisterBuiltinClasses,
NtUserRenderSynthesizedFormat,
NtUserUnpackDDEMessage,
/* win16 hooks */