1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[util] Don't set display mode if the desired mode is already set

See #1489.

Co-authored-by: zvova7890 <zvova7890@gmail.com>
This commit is contained in:
Philip Rebohle 2020-03-04 11:41:55 +01:00 committed by Joshie
parent 5e41e00456
commit 3a1243b05e

View File

@ -25,6 +25,21 @@ namespace dxvk {
pMode->dmPelsWidth, "x", pMode->dmPelsHeight, "@",
pMode->dmDisplayFrequency));
DEVMODEW curMode = { };
curMode.dmSize = sizeof(curMode);
if (GetMonitorDisplayMode(hMonitor, ENUM_CURRENT_SETTINGS, &curMode)) {
bool eq = curMode.dmPelsWidth == pMode->dmPelsWidth
&& curMode.dmPelsHeight == pMode->dmPelsHeight
&& curMode.dmBitsPerPel == pMode->dmBitsPerPel;
if (pMode->dmFields & DM_DISPLAYFREQUENCY)
eq &= curMode.dmDisplayFrequency == pMode->dmDisplayFrequency;
if (eq)
return true;
}
LONG status = ::ChangeDisplaySettingsExW(monInfo.szDevice,
pMode, nullptr, CDS_FULLSCREEN, nullptr);