win32u: Move desktop window proc implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-05-19 14:23:17 +02:00 committed by Alexandre Julliard
parent a15df248e5
commit 336f033273
5 changed files with 46 additions and 22 deletions

View File

@ -95,30 +95,13 @@ LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lP
switch (message)
{
case WM_NCCREATE:
{
CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
const GUID *guid = cs->lpCreateParams;
if (guid)
{
ATOM atom;
WCHAR buffer[37];
if (NtUserGetAncestor( hwnd, GA_PARENT )) return FALSE; /* refuse to create non-desktop window */
swprintf( buffer, ARRAY_SIZE(buffer), L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
guid->Data1, guid->Data2, guid->Data3,
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
atom = GlobalAddAtomW( buffer );
SetPropW( hwnd, L"__wine_display_device_guid", ULongToHandle( atom ) );
}
return TRUE;
}
case WM_NCCALCSIZE:
return 0;
return NtUserMessageCall( hwnd, message, wParam, lParam, 0, NtUserDesktopWindowProc, FALSE );
default:
return DefWindowProcW( hwnd, message, wParam, lParam );
if (message < WM_USER)
return DefWindowProcW( hwnd, message, wParam, lParam );
return NtUserMessageCall( hwnd, message, wParam, lParam, 0, NtUserDesktopWindowProc, FALSE );
}
}

View File

@ -384,3 +384,40 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
return result;
}
LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
static const WCHAR wine_display_device_guidW[] =
{'_','_','w','i','n','e','_','d','i','s','p','l','a','y','_','d','e','v','i','c','e',
'_','g','u','i','d',0};
switch (msg)
{
case WM_NCCREATE:
{
CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam;
const GUID *guid = cs->lpCreateParams;
if (guid)
{
ATOM atom = 0;
char buffer[37];
WCHAR bufferW[37];
if (NtUserGetAncestor( hwnd, GA_PARENT )) return FALSE; /* refuse to create non-desktop window */
sprintf( buffer, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
(unsigned int)guid->Data1, guid->Data2, guid->Data3,
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
NtAddAtom( bufferW, asciiz_to_unicode( bufferW, buffer ) - sizeof(WCHAR), &atom );
NtUserSetProp( hwnd, wine_display_device_guidW, ULongToHandle( atom ) );
}
return TRUE;
}
case WM_NCCALCSIZE:
return 0;
}
return default_window_proc( hwnd, msg, wparam, lparam, FALSE );
}

View File

@ -2890,6 +2890,8 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
{
switch (type)
{
case NtUserDesktopWindowProc:
return desktop_window_proc( hwnd, msg, wparam, lparam );
case NtUserDefWindowProc:
return default_window_proc( hwnd, msg, wparam, lparam, ansi );
case NtUserCallWindowProc:

View File

@ -360,6 +360,7 @@ extern void register_window_surface( struct window_surface *old,
/* defwnd.c */
extern LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
BOOL ansi ) DECLSPEC_HIDDEN;
extern LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
extern void fill_rect( HDC dc, const RECT *rect, HBRUSH hbrush ) DECLSPEC_HIDDEN;
/* hook.c */

View File

@ -181,6 +181,7 @@ struct render_synthesized_format_params
/* NtUserMessageCall codes */
enum
{
NtUserDesktopWindowProc = 0x029d,
NtUserDefWindowProc = 0x029e,
NtUserCallWindowProc = 0x02ab,
NtUserSendMessage = 0x02b1,