user32: Set the display device property on the desktop window as soon as it is created.

This commit is contained in:
Alexandre Julliard 2013-10-24 17:41:28 +02:00
parent fe441a0682
commit f5113d2d56
2 changed files with 39 additions and 16 deletions

View File

@ -32,6 +32,7 @@
#include "wingdi.h"
#include "winnls.h"
#include "controls.h"
#include "wine/unicode.h"
static HBRUSH hbrushPattern;
static HBITMAP hbitmapWallPaper;
@ -97,8 +98,36 @@ static void init_wallpaper( const WCHAR *wallpaper )
*/
LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
if (message == WM_NCCREATE) return TRUE;
return 0; /* all other messages are ignored */
static const WCHAR display_device_guid_propW[] = {
'_','_','w','i','n','e','_','d','i','s','p','l','a','y','_',
'd','e','v','i','c','e','_','g','u','i','d',0 };
static const WCHAR guid_formatW[] = {
'%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0','2','x','%','0','2','x','-',
'%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x',0};
switch (message)
{
case WM_NCCREATE:
{
CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
const GUID *guid = cs->lpCreateParams;
if (guid)
{
ATOM atom;
WCHAR buffer[37];
sprintfW( buffer, guid_formatW, 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, display_device_guid_propW, ULongToHandle( atom ) );
}
return TRUE;
}
default:
return 0; /* all other messages are ignored */
}
}
/***********************************************************************

View File

@ -633,11 +633,8 @@ static BOOL get_default_desktop_size( const WCHAR *name, unsigned int *width, un
return found;
}
static void set_desktop_guid( HWND desktop, HMODULE driver )
static void set_desktop_guid( HWND desktop, GUID *guid, HMODULE driver )
{
static const WCHAR display_device_guid_propW[] = {
'_','_','w','i','n','e','_','d','i','s','p','l','a','y','_',
'd','e','v','i','c','e','_','g','u','i','d',0 };
static const WCHAR device_keyW[] = {
'S','y','s','t','e','m','\\',
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
@ -646,18 +643,11 @@ static void set_desktop_guid( HWND desktop, HMODULE driver )
'{','%','s','}','\\','0','0','0','0',0};
static const WCHAR driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
GUID guid;
RPC_WSTR guid_str;
ATOM guid_atom;
HKEY hkey;
WCHAR key[sizeof(device_keyW)/sizeof(WCHAR) + 39];
UuidCreate( &guid );
UuidToStringW( &guid, &guid_str );
TRACE( "display guid %s\n", debugstr_w(guid_str) );
guid_atom = GlobalAddAtomW( guid_str );
SetPropW( desktop, display_device_guid_propW, ULongToHandle(guid_atom) );
UuidToStringW( guid, &guid_str );
sprintfW( key, device_keyW, guid_str );
RpcStringFreeW( &guid_str );
@ -724,6 +714,7 @@ void manage_desktop( WCHAR *arg )
{
static const WCHAR messageW[] = {'M','e','s','s','a','g','e',0};
HDESK desktop = 0;
GUID guid;
MSG msg;
HDC hdc;
HWND hwnd, msg_hwnd;
@ -766,9 +757,12 @@ void manage_desktop( WCHAR *arg )
SetThreadDesktop( desktop );
}
UuidCreate( &guid );
TRACE( "display guid %s\n", debugstr_guid(&guid) );
/* create the desktop window */
hwnd = CreateWindowExW( 0, DESKTOP_CLASS_ATOM, NULL,
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, 0, NULL );
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, 0, &guid );
/* create the HWND_MESSAGE parent */
msg_hwnd = CreateWindowExW( 0, messageW, NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
@ -785,7 +779,7 @@ void manage_desktop( WCHAR *arg )
ReleaseDC( hwnd, hdc );
SetWindowLongPtrW( hwnd, GWLP_WNDPROC, (LONG_PTR)desktop_wnd_proc );
set_desktop_guid( hwnd, graphics_driver );
set_desktop_guid( hwnd, &guid, graphics_driver );
SendMessageW( hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW( 0, MAKEINTRESOURCEW(OIC_WINLOGO)));
if (name) set_desktop_window_title( hwnd, name );
SetWindowPos( hwnd, 0, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN),