1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

explorer: Set virtual desktop primary adapter display settings.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55146
This commit is contained in:
Rémi Bernon 2023-06-27 13:38:09 +02:00 committed by Alexandre Julliard
parent 99ef2dc4e1
commit 7255f63a65

View file

@ -937,10 +937,10 @@ static const char *debugstr_devmodew( const DEVMODEW *devmode )
position );
}
static void initialize_display_settings(void)
static void initialize_display_settings( unsigned int width, unsigned int height )
{
DISPLAY_DEVICEW device = {.cb = sizeof(DISPLAY_DEVICEW)};
DWORD i = 0;
DWORD i = 0, flags = CDS_GLOBAL | CDS_UPDATEREGISTRY;
/* Store current display mode in the registry */
while (EnumDisplayDevicesW( NULL, i++, &device, 0 ))
@ -955,10 +955,24 @@ static void initialize_display_settings(void)
TRACE( "Device %s current display mode %s.\n", debugstr_w( device.DeviceName ), debugstr_devmodew( &devmode ) );
if (ChangeDisplaySettingsExW( device.DeviceName, &devmode, 0,
CDS_GLOBAL | CDS_NORESET | CDS_UPDATEREGISTRY, 0 ))
if (ChangeDisplaySettingsExW( device.DeviceName, &devmode, 0, flags | CDS_NORESET, 0 ))
ERR( "Failed to initialize registry display settings for %s.\n", debugstr_w( device.DeviceName ) );
}
if (!using_root)
{
DEVMODEW devmode =
{
.dmSize = sizeof(DEVMODEW),
.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT,
.dmPelsWidth = width,
.dmPelsHeight = height,
};
/* in virtual desktop mode, set the primary display settings to match desktop size */
if (ChangeDisplaySettingsExW( NULL, &devmode, 0, flags, NULL ))
ERR( "Failed to set primary display settings.\n" );
}
}
static void set_desktop_window_title( HWND hwnd, const WCHAR *name )
@ -1085,7 +1099,7 @@ void manage_desktop( WCHAR *arg )
if (thread) CloseHandle( thread );
SystemParametersInfoW( SPI_SETDESKWALLPAPER, 0, NULL, FALSE );
ClipCursor( NULL );
initialize_display_settings();
initialize_display_settings( width, height );
initialize_appbar();
if (using_root) enable_shell = FALSE;