From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/class.c | 10 ----- dlls/user32/controls.h | 3 -- dlls/user32/desktop.c | 14 ------- dlls/user32/message.c | 12 ------ dlls/user32/user_main.c | 1 - dlls/win32u/class.c | 73 ++++++++++++++++++++++++++++++++++++ dlls/win32u/ntuser_private.h | 1 + dlls/win32u/syscall.c | 2 + 8 files changed, 76 insertions(+), 40 deletions(-)
diff --git a/dlls/user32/class.c b/dlls/user32/class.c index c18e48b257a..bb81e4551bc 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -332,16 +332,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.@) * diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index a6c45ca1652..b004413113b 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -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; diff --git a/dlls/user32/desktop.c b/dlls/user32/desktop.c index ca000972bc4..377c21d4f48 100644 --- a/dlls/user32/desktop.c +++ b/dlls/user32/desktop.c @@ -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 */ diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 65aa93d858c..42cab89da05 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -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 ) { diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index acbd93cccdd..133a7457bfd 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -220,7 +220,6 @@ static BOOL process_attach(void)
dpiaware_init(); winproc_init(); - register_desktop_class();
/* Initialize system colors and metrics */ SYSPARAMS_Init(); diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index eab65b72ef6..84e923c5b0c 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -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 ); +} diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 3ecd7424f77..e068ff849f3 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -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; diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 532c08ef2e0..e36e7097047 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -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; }
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/edit.c | 6 +----- dlls/user32/tests/class.c | 10 +++------- 2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 81296f7deeb..3bbcd9ab746 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -5265,11 +5265,7 @@ const struct builtin_class_descr EDIT_builtin_class = L"Edit", /* name */ CS_DBLCLKS | CS_PARENTDC, /* style */ WINPROC_EDIT, /* proc */ -#ifdef __i386__ - sizeof(EDITSTATE *) + sizeof(WORD), /* extra */ -#else - sizeof(EDITSTATE *), /* extra */ -#endif + sizeof(UINT64), /* extra */ IDC_IBEAM, /* cursor */ 0 /* brush */ }; diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c index 795c65b7c48..686fced55ee 100644 --- a/dlls/user32/tests/class.c +++ b/dlls/user32/tests/class.c @@ -957,15 +957,11 @@ static const struct { const char name[9]; int value; - int badvalue; + int value64; /* 64-bit Windows use 64-bit size also for 32-bit applications */ } extra_values[] = { {"#32770",30,30}, /* Dialog */ -#ifdef _WIN64 - {"Edit",8,8}, -#else - {"Edit",6,8}, /* Windows XP 64-bit returns 8 also to 32-bit applications */ -#endif + {"Edit",6,8}, };
static void test_extra_values(void) @@ -978,7 +974,7 @@ static void test_extra_values(void)
ok( ret, "GetClassInfo (0) failed for global class %s\n", extra_values[i].name); if (!ret) continue; - ok(extra_values[i].value == wcx.cbWndExtra || broken(extra_values[i].badvalue == wcx.cbWndExtra), + ok(extra_values[i].value == wcx.cbWndExtra || extra_values[i].value64 == wcx.cbWndExtra, "expected %d, got %d\n", extra_values[i].value, wcx.cbWndExtra); } }
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/button.c | 13 ----- dlls/user32/class.c | 43 +-------------- dlls/user32/combo.c | 14 ----- dlls/user32/controls.h | 24 --------- dlls/user32/dialog.c | 14 ----- dlls/user32/edit.c | 14 ----- dlls/user32/icontitle.c | 13 ----- dlls/user32/listbox.c | 27 ---------- dlls/user32/mdi.c | 14 ----- dlls/user32/menu.c | 13 ----- dlls/user32/misc.c | 10 ---- dlls/user32/scroll.c | 13 ----- dlls/user32/static.c | 14 ----- dlls/user32/user_main.c | 2 +- dlls/user32/user_private.h | 2 +- dlls/win32u/class.c | 104 ++++++++++++++++++++++++++++++++++++- include/ntuser.h | 2 +- 17 files changed, 107 insertions(+), 229 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c index d1dc6a3c6ff..afc0f53134a 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -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 ) { diff --git a/dlls/user32/class.c b/dlls/user32/class.c index bb81e4551bc..4e55b3bcc33 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -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 */ diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index fe7b33235c0..31deadb2ba9 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -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 * diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index b004413113b..66c2d1af2da 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -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; diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index 5c74de65ac0..00d315f9ff7 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -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 * diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 3bbcd9ab746..496d5e7287f 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -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 */ -}; diff --git a/dlls/user32/icontitle.c b/dlls/user32/icontitle.c index e6b89b0a92a..718da3006e2 100644 --- a/dlls/user32/icontitle.c +++ b/dlls/user32/icontitle.c @@ -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 */ diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index d96fc8c219d..f6b5a3fb7db 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -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 diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index 746f8c6f46f..be567e6024d 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -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 ); diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 07be830eed3..4ba6fa71028 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -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 diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c index 64a300f83ef..24adcc62b9c 100644 --- a/dlls/user32/misc.c +++ b/dlls/user32/misc.c @@ -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); diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index 9750d6276df..976f88ea7dd 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -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 diff --git a/dlls/user32/static.c b/dlls/user32/static.c index cfcbe92cd98..a88203f5716 100644 --- a/dlls/user32/static.c +++ b/dlls/user32/static.c @@ -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 * diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 133a7457bfd..269fdede708 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -201,11 +201,11 @@ static const void *kernel_callback_table[NtUserCallCount] = User32FreeCachedClipboardData, User32ImmProcessKey, User32ImmTranslateMessage, + User32InitBuiltinClasses, User32LoadDriver, User32LoadImage, User32LoadSysMenu, User32PostDDEMessage, - User32RegisterBuiltinClasses, User32RenderSsynthesizedFormat, User32UnpackDDEMessage, }; diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 4abb0080a0f..77a5ba54929 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -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 */
diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index 84e923c5b0c..19009fc5c0a 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -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 ); }
/*********************************************************************** diff --git a/include/ntuser.h b/include/ntuser.h index eb1b860b5c4..6d0ae96ec6f 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -39,11 +39,11 @@ enum NtUserFreeCachedClipboardData, NtUserImmProcessKey, NtUserImmTranslateMessage, + NtUserInitBuiltinClasses, NtUserLoadDriver, NtUserLoadImage, NtUserLoadSysMenu, NtUserPostDDEMessage, - NtUserRegisterBuiltinClasses, NtUserRenderSynthesizedFormat, NtUserUnpackDDEMessage, /* win16 hooks */
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/sysparams.c | 4 ++-- dlls/win32u/ntuser_private.h | 1 - dlls/win32u/sysparams.c | 4 ++-- include/ntuser.h | 17 +++++++++-------- 4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 26259ab76e9..36b166c627c 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -888,7 +888,7 @@ UINT WINAPI GetDpiForSystem(void) */ DPI_AWARENESS_CONTEXT WINAPI GetThreadDpiAwarenessContext(void) { - struct user_thread_info *info = get_user_thread_info(); + struct ntuser_thread_info *info = NtUserGetThreadInfo();
if (info->dpi_awareness) return ULongToHandle( info->dpi_awareness ); return UlongToHandle( (NtUserGetProcessDpiAwarenessContext( GetCurrentProcess() ) & 3 ) | 0x10 ); @@ -899,7 +899,7 @@ DPI_AWARENESS_CONTEXT WINAPI GetThreadDpiAwarenessContext(void) */ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT context ) { - struct user_thread_info *info = get_user_thread_info(); + struct ntuser_thread_info *info = NtUserGetThreadInfo(); DPI_AWARENESS prev, val = GetAwarenessFromDpiAwarenessContext( context );
if (val == DPI_AWARENESS_INVALID) diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index e068ff849f3..b048d194a4e 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -129,7 +129,6 @@ struct user_thread_info WORD hook_unicode; /* Is current hook unicode? */ HHOOK hook; /* Current hook */ UINT active_hooks; /* Bitmap of active hooks */ - DPI_AWARENESS dpi_awareness; /* DPI awareness */ INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */ struct received_message_info *receive_info; /* Message being currently received */ struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */ diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 3a77ec47769..afcf6bbf2fc 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1602,7 +1602,7 @@ UINT get_win_monitor_dpi( HWND hwnd ) */ DPI_AWARENESS get_thread_dpi_awareness(void) { - struct user_thread_info *info = get_user_thread_info(); + struct ntuser_thread_info *info = NtUserGetThreadInfo(); ULONG_PTR context = info->dpi_awareness;
if (!context) context = NtUserGetProcessDpiAwarenessContext( NULL ); @@ -1671,7 +1671,7 @@ static DPI_AWARENESS get_awareness_from_dpi_awareness_context( DPI_AWARENESS_CON */ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT context ) { - struct user_thread_info *info = get_user_thread_info(); + struct ntuser_thread_info *info = NtUserGetThreadInfo(); DPI_AWARENESS prev, val = get_awareness_from_dpi_awareness_context( context );
if (val == DPI_AWARENESS_INVALID) diff --git a/include/ntuser.h b/include/ntuser.h index 6d0ae96ec6f..b36b630ce7f 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -61,14 +61,15 @@ enum /* TEB thread info, not compatible with Windows */ struct ntuser_thread_info { - void *driver_data; /* driver-specific data */ - DWORD message_time; /* value for GetMessageTime */ - DWORD message_pos; /* value for GetMessagePos */ - ULONG_PTR message_extra; /* value for GetMessageExtraInfo */ - HWND top_window; /* desktop window */ - HWND msg_window; /* HWND_MESSAGE parent window */ - HIMC default_imc; /* default input context */ - void *client_imm; /* client IMM thread info */ + void *driver_data; /* driver-specific data */ + DWORD message_time; /* value for GetMessageTime */ + DWORD message_pos; /* value for GetMessagePos */ + ULONG_PTR message_extra; /* value for GetMessageExtraInfo */ + HWND top_window; /* desktop window */ + HWND msg_window; /* HWND_MESSAGE parent window */ + DPI_AWARENESS dpi_awareness; /* DPI awareness */ + HIMC default_imc; /* default input context */ + void *client_imm; /* client IMM thread info */ };
static inline struct ntuser_thread_info *NtUserGetThreadInfo(void)
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/message.c | 10 +++++----- dlls/user32/user_main.c | 2 +- dlls/win32u/ntuser_private.h | 1 - include/ntuser.h | 1 + 4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 42cab89da05..d1a211bb281 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -63,7 +63,7 @@ static inline void *unpack_ptr( ULONGLONG ptr64 ) /* check for pending WM_CHAR message with DBCS trailing byte */ static inline BOOL get_pending_wmchar( MSG *msg, UINT first, UINT last, BOOL remove ) { - struct wm_char_mapping_data *data = get_user_thread_info()->wmchar_data; + struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data;
if (!data || !data->get_msg.message) return FALSE; if ((first || last) && (first > WM_CHAR || last < WM_CHAR)) return FALSE; @@ -119,7 +119,7 @@ BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping */ if (mapping != WMCHAR_MAP_NOMAPPING) { - struct wm_char_mapping_data *data = get_user_thread_info()->wmchar_data; + struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data; BYTE low = LOBYTE(*wparam); cp = get_input_codepage();
@@ -152,7 +152,7 @@ BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping { if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) return FALSE; - get_user_thread_info()->wmchar_data = data; + NtUserGetThreadInfo()->wmchar_data = data; } TRACE( "storing lead byte %02x mapping %u\n", low, mapping ); data->lead_byte[mapping] = low; @@ -210,11 +210,11 @@ static void map_wparam_WtoA( MSG *msg, BOOL remove ) len = WideCharToMultiByte( cp, 0, wch, 1, (LPSTR)ch, 2, NULL, NULL ); if (len == 2) /* DBCS char */ { - struct wm_char_mapping_data *data = get_user_thread_info()->wmchar_data; + struct wm_char_mapping_data *data = NtUserGetThreadInfo()->wmchar_data; if (!data) { if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) return; - get_user_thread_info()->wmchar_data = data; + NtUserGetThreadInfo()->wmchar_data = data; } if (remove) { diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 269fdede708..139d9b5f46e 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -233,7 +233,7 @@ static BOOL process_attach(void) */ static void thread_detach(void) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo();
NtUserCallNoParam( NtUserExitingThread );
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index b048d194a4e..c62bb0d457f 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -131,7 +131,6 @@ struct user_thread_info UINT active_hooks; /* Bitmap of active hooks */ INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */ struct received_message_info *receive_info; /* Message being currently received */ - struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */ struct user_key_state_info *key_state; /* Cache of global key state */ struct imm_thread_data *imm_thread_data; /* IMM thread data */ HKL kbd_layout; /* Current keyboard layout */ diff --git a/include/ntuser.h b/include/ntuser.h index b36b630ce7f..ec6f58a2f2e 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -70,6 +70,7 @@ struct ntuser_thread_info DPI_AWARENESS dpi_awareness; /* DPI awareness */ HIMC default_imc; /* default input context */ void *client_imm; /* client IMM thread info */ + struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */ };
static inline struct ntuser_thread_info *NtUserGetThreadInfo(void)
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/message.c | 4 ++-- dlls/win32u/message.c | 17 +++++++++-------- dlls/win32u/ntuser_private.h | 2 -- include/ntuser.h | 2 ++ 4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index d1a211bb281..e62e0566dd9 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -585,7 +585,7 @@ LRESULT WINAPI SendMessageTimeoutA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
static LRESULT dispatch_send_message( struct win_proc_params *params ) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); INPUT_MESSAGE_SOURCE prev_source = thread_info->msg_source; LRESULT retval = 0;
@@ -1031,7 +1031,7 @@ LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam) */ BOOL WINAPI GetCurrentInputMessageSource( INPUT_MESSAGE_SOURCE *source ) { - *source = get_user_thread_info()->msg_source; + *source = NtUserGetThreadInfo()->msg_source; return TRUE; }
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 7045aedb4b1..e262fd7ab22 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -245,7 +245,7 @@ static BOOL init_window_call_params( struct win_proc_params *params, HWND hwnd,
static BOOL dispatch_win_proc_params( struct win_proc_params *params, size_t size ) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); void *ret_ptr; ULONG ret_len;
@@ -1593,11 +1593,12 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H static BOOL process_hardware_message( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data, HWND hwnd_filter, UINT first, UINT last, BOOL remove ) { + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); DPI_AWARENESS_CONTEXT context; BOOL ret = FALSE;
- get_user_thread_info()->msg_source.deviceType = msg_data->source.device; - get_user_thread_info()->msg_source.originId = msg_data->source.origin; + thread_info->msg_source.deviceType = msg_data->source.device; + thread_info->msg_source.originId = msg_data->source.origin;
/* hardware messages are always in physical coords */ context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ); @@ -1625,7 +1626,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, { LRESULT result; struct user_thread_info *thread_info = get_user_thread_info(); - INPUT_MESSAGE_SOURCE prev_source = thread_info->msg_source; + INPUT_MESSAGE_SOURCE prev_source = thread_info->client_info.msg_source; struct received_message_info info; unsigned int hw_id = 0; /* id of previous hardware message */ void *buffer; @@ -1643,7 +1644,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, const message_data_t *msg_data = buffer; BOOL needs_unpack = FALSE;
- thread_info->msg_source = prev_source; + thread_info->client_info.msg_source = prev_source;
SERVER_START_REQ( get_message ) { @@ -1854,7 +1855,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, thread_info->client_info.message_pos = MAKELONG( msg->pt.x, msg->pt.y ); thread_info->client_info.message_time = info.msg.time; thread_info->client_info.message_extra = 0; - thread_info->msg_source = msg_source_unavailable; + thread_info->client_info.msg_source = msg_source_unavailable; free( buffer ); call_hooks( WH_GETMESSAGE, HC_ACTION, flags & PM_REMOVE, (LPARAM)msg, TRUE ); return 1; @@ -1863,7 +1864,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, /* if we get here, we have a sent message; call the window procedure */ info.prev = thread_info->receive_info; thread_info->receive_info = &info; - thread_info->msg_source = msg_source_unavailable; + thread_info->client_info.msg_source = msg_source_unavailable; result = call_window_proc( info.msg.hwnd, info.msg.message, info.msg.wParam, info.msg.lParam, (info.type != MSG_ASCII), FALSE, WMCHAR_MAP_RECVMESSAGE, needs_unpack, buffer, size ); @@ -2619,7 +2620,7 @@ static BOOL broadcast_message( struct send_message_info *info, DWORD_PTR *res_pt */ static BOOL process_message( struct send_message_info *info, DWORD_PTR *res_ptr, BOOL ansi ) { - struct user_thread_info *thread_info = get_user_thread_info(); + struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); INPUT_MESSAGE_SOURCE prev_source = thread_info->msg_source; DWORD dest_pid; BOOL ret; diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index c62bb0d457f..0f25ede6b2b 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -123,13 +123,11 @@ struct user_thread_info HANDLE server_queue; /* Handle to server-side queue */ DWORD wake_mask; /* Current queue wake mask */ DWORD changed_mask; /* Current queue changed mask */ - WORD recursion_count; /* SendMessage recursion counter */ WORD message_count; /* Get/PeekMessage loop counter */ WORD hook_call_depth; /* Number of recursively called hook procs */ WORD hook_unicode; /* Is current hook unicode? */ HHOOK hook; /* Current hook */ UINT active_hooks; /* Bitmap of active hooks */ - INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */ struct received_message_info *receive_info; /* Message being currently received */ struct user_key_state_info *key_state; /* Cache of global key state */ struct imm_thread_data *imm_thread_data; /* IMM thread data */ diff --git a/include/ntuser.h b/include/ntuser.h index ec6f58a2f2e..5bc92fb562c 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -65,6 +65,8 @@ struct ntuser_thread_info DWORD message_time; /* value for GetMessageTime */ DWORD message_pos; /* value for GetMessagePos */ ULONG_PTR message_extra; /* value for GetMessageExtraInfo */ + INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */ + WORD recursion_count; /* SendMessage recursion counter */ HWND top_window; /* desktop window */ HWND msg_window; /* HWND_MESSAGE parent window */ DPI_AWARENESS dpi_awareness; /* DPI awareness */
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/message.c | 5 +---- dlls/win32u/message.c | 12 ++++++++++-- include/ntuser.h | 1 + 3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index e62e0566dd9..097e8fd4391 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -713,10 +713,7 @@ BOOL WINAPI InSendMessage(void) */ DWORD WINAPI InSendMessageEx( LPVOID reserved ) { - struct received_message_info *info = get_user_thread_info()->receive_info; - - if (info) return info->flags; - return ISMEX_NOSEND; + return NtUserGetThreadInfo()->receive_flags; }
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index e262fd7ab22..5fb065e1208 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1045,6 +1045,8 @@ static void reply_message( struct received_message_info *info, LRESULT result, M
memset( &data, 0, sizeof(data) ); info->flags |= ISMEX_REPLIED; + if (info == get_user_thread_info()->receive_info) + NtUserGetThreadInfo()->receive_flags = info->flags;
if (info->type == MSG_OTHER_PROCESS && !replied) { @@ -1069,11 +1071,16 @@ static void reply_message( struct received_message_info *info, LRESULT result, M */ BOOL reply_message_result( LRESULT result, MSG *msg ) { - struct received_message_info *info = get_user_thread_info()->receive_info; + struct user_thread_info *thread_info = get_user_thread_info(); + struct received_message_info *info = thread_info->receive_info;
if (!info) return FALSE; reply_message( info, result, msg ); - if (msg) get_user_thread_info()->receive_info = info->prev; + if (msg) + { + thread_info->receive_info = info->prev; + thread_info->client_info.receive_flags = info->prev ? info->prev->flags : ISMEX_NOSEND; + } return TRUE; }
@@ -1865,6 +1872,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, info.prev = thread_info->receive_info; thread_info->receive_info = &info; thread_info->client_info.msg_source = msg_source_unavailable; + thread_info->client_info.receive_flags = info.flags; result = call_window_proc( info.msg.hwnd, info.msg.message, info.msg.wParam, info.msg.lParam, (info.type != MSG_ASCII), FALSE, WMCHAR_MAP_RECVMESSAGE, needs_unpack, buffer, size ); diff --git a/include/ntuser.h b/include/ntuser.h index 5bc92fb562c..07b5afe7919 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -67,6 +67,7 @@ struct ntuser_thread_info ULONG_PTR message_extra; /* value for GetMessageExtraInfo */ INPUT_MESSAGE_SOURCE msg_source; /* Message source for current message */ WORD recursion_count; /* SendMessage recursion counter */ + UINT receive_flags; /* currently received message flags */ HWND top_window; /* desktop window */ HWND msg_window; /* HWND_MESSAGE parent window */ DPI_AWARENESS dpi_awareness; /* DPI awareness */
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/controls.h | 3 +-- dlls/user32/dialog.c | 2 ++ dlls/user32/user_private.h | 14 +------------- dlls/user32/win.c | 7 +++++++ dlls/user32/win.h | 7 ------- dlls/win32u/ntuser_private.h | 10 ---------- include/ntuser.h | 10 ++++++++++ 7 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h index 66c2d1af2da..613de0af6c2 100644 --- a/dlls/user32/controls.h +++ b/dlls/user32/controls.h @@ -21,8 +21,7 @@ #ifndef __WINE_CONTROLS_H #define __WINE_CONTROLS_H
-#include "winuser.h" -#include "../win32u/ntuser_private.h" +#include "ntuser.h"
extern LRESULT WINAPI ImeWndProcA(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN; extern LRESULT WINAPI ImeWndProcW(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN; diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index 00d315f9ff7..c8d1596a01b 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -39,6 +39,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dialog);
+#define DIALOG_CLASS_ATOM MAKEINTATOM(32770) /* Dialog */ + /* Dialog control information */ typedef struct { diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 77a5ba54929..06a358376a8 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -25,21 +25,14 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" -#include "../win32u/ntuser_private.h" +#include "ntuser.h" #include "winreg.h" -#include "winternl.h" -#include "hidusage.h" #include "wine/heap.h"
#define GET_WORD(ptr) (*(const WORD *)(ptr)) #define GET_DWORD(ptr) (*(const DWORD *)(ptr)) #define GET_LONG(ptr) (*(const LONG *)(ptr))
-#define WINE_MOUSE_HANDLE ((HANDLE)1) -#define WINE_KEYBOARD_HANDLE ((HANDLE)2) - -struct received_message_info; - /* data to store state for A/W mappings of WM_CHAR */ struct wm_char_mapping_data { @@ -47,11 +40,6 @@ struct wm_char_mapping_data MSG get_msg; };
-static inline struct user_thread_info *get_user_thread_info(void) -{ - return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo; -} - extern HMODULE user32_module DECLSPEC_HIDDEN;
extern BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 8ba4b6ea69e..fa2ae2e9da4 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -121,6 +121,13 @@ BOOL is_desktop_window( HWND hwnd ) }
+/* check if hwnd is a broadcast magic handle */ +static inline BOOL is_broadcast( HWND hwnd ) +{ + return hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST; +} + + /*********************************************************************** * WIN_IsCurrentProcess * diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 5107a606414..ffd4f37d5f0 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -21,14 +21,7 @@ #ifndef __WINE_WIN_H #define __WINE_WIN_H
-#include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <wingdi.h> -#include <winuser.h> - #include "user_private.h" -#include "wine/server_protocol.h"
/* Window functions */ extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 0f25ede6b2b..3b74a2ae83a 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -26,7 +26,6 @@ #include "wine/list.h"
-#define WM_SYSTIMER 0x0118 #define WM_POPUPSYSTEMMENU 0x0313
enum system_timer_id @@ -205,15 +204,6 @@ struct scroll_bar_win_data #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771) /* WinSwitch */ #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772) /* IconTitle */
-/* message spy definitions */ - -#define SPY_DISPATCHMESSAGE 0x0100 -#define SPY_SENDMESSAGE 0x0101 -#define SPY_DEFWNDPROC 0x0102 - -#define SPY_RESULT_OK 0x0001 -#define SPY_RESULT_DEFWND 0x0002 - /* info about the message currently being received by the current thread */ struct received_message_info { diff --git a/include/ntuser.h b/include/ntuser.h index 07b5afe7919..e3694bde779 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -267,6 +267,14 @@ struct unpack_dde_message_params #define NTUSER_DPI_PER_MONITOR_AWARE_V2 0x00000022 #define NTUSER_DPI_PER_UNAWARE_GDISCALED 0x40006010
+/* message spy definitions */ +#define SPY_DISPATCHMESSAGE 0x0100 +#define SPY_SENDMESSAGE 0x0101 +#define SPY_DEFWNDPROC 0x0102 + +#define SPY_RESULT_OK 0x0001 +#define SPY_RESULT_DEFWND 0x0002 + /* NtUserMessageCall codes */ enum { @@ -456,6 +464,8 @@ enum wine_internal_message #define IME_INTERNAL_ACTIVATE 0x17 #define IME_INTERNAL_DEACTIVATE 0x18
+#define WM_SYSTIMER 0x0118 + /* the various structures that can be sent in messages, in platform-independent layout */ struct packed_CREATESTRUCTW {
This merge request was approved by Huw Davies.