Commit eb7f5dd5 authored by Alexandre Julliard's avatar Alexandre Julliard

explorer: Allow specifying a default size for each desktop using the…

explorer: Allow specifying a default size for each desktop using the HKCU\Software\Wine\Explorer\Desktops registry key.
parent 981f31be
...@@ -111,24 +111,31 @@ static BOOL parse_size( const WCHAR *size, unsigned int *width, unsigned int *he ...@@ -111,24 +111,31 @@ static BOOL parse_size( const WCHAR *size, unsigned int *width, unsigned int *he
return !*end; return !*end;
} }
/* retrieve the default desktop size from the X11 driver config */ /* retrieve the default desktop size from the registry */
/* FIXME: this is for backwards compatibility, should probably be changed */ static BOOL get_default_desktop_size( const WCHAR *name, unsigned int *width, unsigned int *height )
static BOOL get_default_desktop_size( unsigned int *width, unsigned int *height )
{ {
static const WCHAR keyW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\', static const WCHAR desktop_keyW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
'X','1','1',' ','D','r','i','v','e','r',0}; 'E','x','p','l','o','r','e','r','\\',
static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0}; 'D','e','s','k','t','o','p','s',0};
HKEY hkey; HKEY hkey;
WCHAR buffer[64]; WCHAR buffer[64];
DWORD size = sizeof(buffer); DWORD size = sizeof(buffer);
BOOL ret = FALSE; BOOL found = FALSE;
/* @@ Wine registry key: HKCU\Software\Wine\X11 Driver */ *width = 800;
if (RegOpenKeyW( HKEY_CURRENT_USER, keyW, &hkey )) return FALSE; *height = 600;
if (!RegQueryValueExW( hkey, desktopW, 0, NULL, (LPBYTE)buffer, &size ))
ret = parse_size( buffer, width, height ); /* @@ Wine registry key: HKCU\Software\Wine\Explorer\Desktops */
if (!RegOpenKeyW( HKEY_CURRENT_USER, desktop_keyW, &hkey ))
{
if (!RegQueryValueExW( hkey, name, 0, NULL, (LPBYTE)buffer, &size ))
{
found = TRUE;
if (!parse_size( buffer, width, height )) *width = *height = 0;
}
RegCloseKey( hkey ); RegCloseKey( hkey );
return ret; }
return found;
} }
static void initialize_display_settings( HWND desktop ) static void initialize_display_settings( HWND desktop )
...@@ -218,21 +225,35 @@ void manage_desktop( WCHAR *arg ) ...@@ -218,21 +225,35 @@ void manage_desktop( WCHAR *arg )
if (*arg == '=' || *arg == ',') if (*arg == '=' || *arg == ',')
{ {
arg++; arg++;
name = arg;
if ((p = strchrW( arg, ',' ))) *p++ = 0; if ((p = strchrW( arg, ',' ))) *p++ = 0;
if (!p || !parse_size( p, &width, &height )) if (!p || !parse_size( p, &width, &height ))
{ get_default_desktop_size( name, &width, &height );
width = 800;
height = 600;
} }
name = arg; else /* check for the X11 driver key for backwards compatibility (to be removed) */
xwin = create_desktop( name, width, height ); {
} static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0};
else if (get_default_desktop_size( &width, &height )) static const WCHAR x11_keyW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
'X','1','1',' ','D','r','i','v','e','r',0};
HKEY hkey;
WCHAR buffer[64];
DWORD size = sizeof(buffer);
width = height = 0;
/* @@ Wine registry key: HKCU\Software\Wine\X11 Driver */
if (!RegOpenKeyW( HKEY_CURRENT_USER, x11_keyW, &hkey ))
{
if (!RegQueryValueExW( hkey, desktopW, 0, NULL, (LPBYTE)buffer, &size ))
{ {
name = defaultW; name = defaultW;
xwin = create_desktop( name, width, height ); if (!parse_size( buffer, &width, &height )) width = height = 0;
}
RegCloseKey( hkey );
}
} }
if (name && width && height) xwin = create_desktop( name, width, height );
if (!xwin) using_root = TRUE; /* using the root window */ if (!xwin) using_root = TRUE; /* using the root window */
/* create the desktop window */ /* create the desktop window */
......
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