Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55146
When virtual desktop mode is used, the current host display mode is still written to the registry, before the desktop is created and virtual desktop mode decided. When it matches the virtual screen size it also triggers the virtual desktop fullscreen detection and the window is resized to cover the entire screen.
Instead, when virtual desktop is used, update the current display mode to match the desktop window size.
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55146 --- programs/explorer/desktop.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 9945f689313..51f53630ae6 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -918,29 +918,45 @@ static HMODULE load_graphics_driver( const WCHAR *driver, GUID *guid ) return module; }
+static const char *debugstr_devmodew( const DEVMODEW *devmode ) +{ + char position[32] = {0}; + + if (devmode->dmFields & DM_POSITION) + { + snprintf( position, sizeof(position), " at (%d,%d)", + (int)devmode->dmPosition.x, (int)devmode->dmPosition.y ); + } + + return wine_dbg_sprintf( "%ux%u %ubits %uHz rotated %u degrees%s", + (unsigned int)devmode->dmPelsWidth, + (unsigned int)devmode->dmPelsHeight, + (unsigned int)devmode->dmBitsPerPel, + (unsigned int)devmode->dmDisplayFrequency, + (unsigned int)devmode->dmDisplayOrientation * 90, + position ); +} + static void initialize_display_settings(void) { DISPLAY_DEVICEW ddW; - DEVMODEW dmW; DWORD i = 0;
/* Store current display mode in the registry */ ddW.cb = sizeof(ddW); - memset(&dmW, 0, sizeof(dmW)); - dmW.dmSize = sizeof(dmW); while (EnumDisplayDevicesW( NULL, i++, &ddW, 0 )) { - if (!EnumDisplaySettingsExW( ddW.DeviceName, ENUM_CURRENT_SETTINGS, &dmW, 0)) + DEVMODEW devmode = {.dmSize = sizeof(DEVMODEW)}; + + if (!EnumDisplaySettingsExW( ddW.DeviceName, ENUM_CURRENT_SETTINGS, &devmode, 0)) { ERR( "Failed to query current display settings for %s.\n", debugstr_w(ddW.DeviceName) ); continue; }
- TRACE( "Device %s current display mode %lux%lu %luBits %luHz at %ld,%ld.\n", - debugstr_w( ddW.DeviceName ), dmW.dmPelsWidth, dmW.dmPelsHeight, - dmW.dmBitsPerPel, dmW.dmDisplayFrequency, dmW.dmPosition.x, dmW.dmPosition.y ); + TRACE( "Device %s current display mode %s.\n", debugstr_w( ddW.DeviceName ), debugstr_devmodew( &devmode ) );
- if (ChangeDisplaySettingsExW( ddW.DeviceName, &dmW, 0, + if (ChangeDisplaySettingsExW( ddW.DeviceName, &devmode, 0, CDS_GLOBAL | CDS_NORESET | CDS_UPDATEREGISTRY, 0 )) ERR( "Failed to initialize registry display settings for %s.\n", debugstr_w(ddW.DeviceName) ); }
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55146 --- programs/explorer/desktop.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 51f53630ae6..49141f1c9cf 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -939,26 +939,25 @@ static const char *debugstr_devmodew( const DEVMODEW *devmode )
static void initialize_display_settings(void) { - DISPLAY_DEVICEW ddW; + DISPLAY_DEVICEW device = {.cb = sizeof(DISPLAY_DEVICEW)}; DWORD i = 0;
/* Store current display mode in the registry */ - ddW.cb = sizeof(ddW); - while (EnumDisplayDevicesW( NULL, i++, &ddW, 0 )) + while (EnumDisplayDevicesW( NULL, i++, &device, 0 )) { DEVMODEW devmode = {.dmSize = sizeof(DEVMODEW)};
- if (!EnumDisplaySettingsExW( ddW.DeviceName, ENUM_CURRENT_SETTINGS, &devmode, 0)) + if (!EnumDisplaySettingsExW( device.DeviceName, ENUM_CURRENT_SETTINGS, &devmode, 0)) { - ERR( "Failed to query current display settings for %s.\n", debugstr_w(ddW.DeviceName) ); + ERR( "Failed to query current display settings for %s.\n", debugstr_w( device.DeviceName ) ); continue; }
- TRACE( "Device %s current display mode %s.\n", debugstr_w( ddW.DeviceName ), debugstr_devmodew( &devmode ) ); + TRACE( "Device %s current display mode %s.\n", debugstr_w( device.DeviceName ), debugstr_devmodew( &devmode ) );
- if (ChangeDisplaySettingsExW( ddW.DeviceName, &devmode, 0, + if (ChangeDisplaySettingsExW( device.DeviceName, &devmode, 0, CDS_GLOBAL | CDS_NORESET | CDS_UPDATEREGISTRY, 0 )) - ERR( "Failed to initialize registry display settings for %s.\n", debugstr_w(ddW.DeviceName) ); + ERR( "Failed to initialize registry display settings for %s.\n", debugstr_w( device.DeviceName ) ); } }
From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55146 --- programs/explorer/desktop.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 49141f1c9cf..0af8d4c8e3c 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -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;