--- dlls/winex11.drv/settings.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c index afa26cf543..b0164d5806 100644 --- a/dlls/winex11.drv/settings.c +++ b/dlls/winex11.drv/settings.c @@ -344,7 +344,7 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, { DWORD i, dwBpp = 0; DEVMODEW dm; - BOOL def_mode = TRUE; + BOOL def_mode = TRUE, test_bpp, test_frequency;
TRACE("(%s,%p,%p,0x%08x,%p)\n",debugstr_w(devname),devmode,hwnd,flags,lpvoid); TRACE("flags=%s\n",_CDS_flags(flags)); @@ -387,29 +387,24 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, return DISP_CHANGE_BADMODE; }
+ test_bpp = devmode->dmFields & DM_BITSPERPEL; + test_frequency = (devmode->dmFields & DM_DISPLAYFREQUENCY) && + (devmode->dmDisplayFrequency != 0); for (i = 0; i < dd_mode_count; i++) { - if (devmode->dmFields & DM_BITSPERPEL) + if (devmode->dmPelsWidth != dd_modes[i].width) continue; + if (devmode->dmPelsHeight != dd_modes[i].height) continue; + if (test_bpp) { if (dwBpp != dd_modes[i].bpp) continue; } - if (devmode->dmFields & DM_PELSWIDTH) - { - if (devmode->dmPelsWidth != dd_modes[i].width) - continue; - } - if (devmode->dmFields & DM_PELSHEIGHT) - { - if (devmode->dmPelsHeight != dd_modes[i].height) - continue; - } - if ((devmode->dmFields & DM_DISPLAYFREQUENCY) && (dd_modes[i].refresh_rate != 0) && - devmode->dmDisplayFrequency != 0) + if (test_frequency && (dd_modes[i].refresh_rate != 0)) { if (devmode->dmDisplayFrequency != dd_modes[i].refresh_rate) continue; } + /* we have a valid mode */ TRACE("Requested display settings match mode %d (%s)\n", i, handler_name);