Skip to content

Commit 74eff25

Browse files
zzhiyidoitsujin
authored andcommitted
[wsi] Check more display mode flags when comparing them.
EnumDisplaySettings(..., ENUM_CURRENT_SETTINGS, ...) is guaranteed to have DM_DISPLAYORIENTATION, DM_BITSPERPEL, DM_PELSWIDTH, DM_PELSHEIGHT, DM_DISPLAYFLAGS, DM_DISPLAYFREQUENCY, and DM_POSITION. If we don't compare positions, then in Win32WsiDriver::restoreDisplayMode(), the original monitor layout might not be restored. For example, a secondary 1080p monitor at (3840, 0) can be moved to (1280, -1080) after the primary 4K monitor resolution changes to 720p and back to 4K. And due to the secondary monitor having the same resolution, its position won't be restored before this patch. Fix Rime (493200) fails to switch monitors in borderless mode in some cases for Proton 10 alpha. Related to #2064.
1 parent 29f33f0 commit 74eff25

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/wsi/win32/wsi_window_win32.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ namespace dxvk::wsi {
4848

4949
if (pMode->dmFields & DM_DISPLAYFREQUENCY)
5050
eq &= curMode.dmDisplayFrequency == pMode->dmDisplayFrequency;
51+
if (pMode->dmFields & DM_DISPLAYFLAGS)
52+
eq &= curMode.dmDisplayFlags == pMode->dmDisplayFlags;
53+
if (pMode->dmFields & DM_DISPLAYORIENTATION)
54+
eq &= curMode.dmDisplayOrientation == pMode->dmDisplayOrientation;
55+
if (pMode->dmFields & DM_POSITION)
56+
eq &= curMode.dmPosition.x == pMode->dmPosition.x && curMode.dmPosition.y == pMode->dmPosition.y;
5157

5258
if (eq)
5359
return true;

0 commit comments

Comments
 (0)