Commit efda9908 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

winex11.drv: Use display device guid managed by explorer.

parent be32b341
......@@ -21,6 +21,7 @@
#include "config.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
......@@ -166,17 +167,40 @@ void X11DRV_Settings_Init(void)
X11DRV_Settings_AddOneMode(screen_width, screen_height, 0, 60);
}
/* Our fake driver GUID path */
static const char wine_X11_reg_key[] =
"System\\CurrentControlSet\\Control\\Video\\{64498428-1122-3344-5566-778899aabbcc}\\0000";
static BOOL get_display_device_reg_key(char *key, unsigned len)
{
static const char display_device_guid_prop[] = "__wine_display_device_guid";
static const char video_path[] = "System\\CurrentControlSet\\Control\\Video\\{";
static const char display0[] = "}\\0000";
ATOM guid_atom;
assert(len >= sizeof(video_path) + sizeof(display0) + 40);
guid_atom = HandleToULong(GetPropA(GetDesktopWindow(), display_device_guid_prop));
if (!guid_atom) return FALSE;
memcpy(key, video_path, sizeof(video_path));
if (!GlobalGetAtomNameA(guid_atom, key + strlen(key), 40))
return FALSE;
strcat(key, display0);
TRACE("display device key %s\n", wine_dbgstr_a(key));
return TRUE;
}
static BOOL read_registry_settings(DEVMODEW *dm)
{
char wine_x11_reg_key[128];
HKEY hkey;
DWORD type, size;
BOOL ret = TRUE;
if (RegOpenKeyA(HKEY_CURRENT_CONFIG, wine_X11_reg_key, &hkey))
if (!get_display_device_reg_key(wine_x11_reg_key, sizeof(wine_x11_reg_key)))
return FALSE;
if (RegOpenKeyExA(HKEY_CURRENT_CONFIG, wine_x11_reg_key, 0, KEY_READ, &hkey))
return FALSE;
#define query_value(name, data) \
......@@ -203,10 +227,15 @@ static BOOL read_registry_settings(DEVMODEW *dm)
static BOOL write_registry_settings(const DEVMODEW *dm)
{
char wine_x11_reg_key[128];
HKEY hkey;
BOOL ret = TRUE;
if (RegCreateKeyA(HKEY_CURRENT_CONFIG, wine_X11_reg_key, &hkey))
if (!get_display_device_reg_key(wine_x11_reg_key, sizeof(wine_x11_reg_key)))
return FALSE;
if (RegCreateKeyExA(HKEY_CURRENT_CONFIG, wine_x11_reg_key, 0, NULL,
REG_OPTION_VOLATILE, KEY_WRITE, NULL, &hkey, NULL))
return FALSE;
#define set_value(name, data) \
......
......@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = explorer.exe
APPMODE = -mwindows
IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
IMPORTS = rpcrt4 user32 gdi32 advapi32 kernel32 ntdll
DELAYIMPORTS = comctl32
EXTRADEFS = @HALINCL@
EXTRALIBS = @DISKARBITRATIONLIB@
......
......@@ -115,6 +115,25 @@ static BOOL get_default_desktop_size( unsigned int *width, unsigned int *height
return ret;
}
static void initialize_display_settings( HWND desktop )
{
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 };
GUID guid;
LPWSTR guid_str;
ATOM guid_atom;
UuidCreate( &guid );
UuidToStringW( &guid, &guid_str );
WINE_TRACE( "display guid %s\n", wine_dbgstr_w(guid_str) );
guid_atom = GlobalAddAtomW( guid_str );
SetPropW( desktop, display_device_guid_propW, ULongToHandle(guid_atom) );
RpcStringFreeW( &guid_str );
}
/* main desktop management function */
void manage_desktop( char *arg )
{
......@@ -171,6 +190,7 @@ void manage_desktop( char *arg )
SetWindowTextW( hwnd, desktop_nameW );
SystemParametersInfoA( SPI_SETDESKPATTERN, -1, NULL, FALSE );
SetDeskWallPaper( (LPSTR)-1 );
initialize_display_settings( hwnd );
initialize_diskarbitration();
initialize_hal();
initialize_systray();
......
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