mirror of
https://github.com/reactos/reactos.git
synced 2026-06-08 00:46:10 +08:00
[WIN32SS] Change LDEVOBJ_bProbeAndCaptureDevmode to account for not provided fields when searching an exact mode
This fixes mode change if an application requests (for example) 640x480x32, without providing display frequency.
This commit is contained in:
@@ -804,9 +804,9 @@ LDEVOBJ_bProbeAndCaptureDevmode(
|
||||
if (!bResult)
|
||||
return FALSE;
|
||||
|
||||
if (bSearchClosestMode)
|
||||
if (LDEVOBJ_bGetClosestMode(pGraphicsDevice, &dmSearch, &pdmSelected))
|
||||
{
|
||||
if (LDEVOBJ_bGetClosestMode(pGraphicsDevice, &dmSearch, &pdmSelected))
|
||||
if (bSearchClosestMode)
|
||||
{
|
||||
/* Ok, found a closest mode. Update search */
|
||||
dmSearch.dmBitsPerPel = pdmSelected->dmBitsPerPel;
|
||||
@@ -814,6 +814,29 @@ LDEVOBJ_bProbeAndCaptureDevmode(
|
||||
dmSearch.dmPelsHeight = pdmSelected->dmPelsHeight;
|
||||
dmSearch.dmDisplayFrequency = pdmSelected->dmDisplayFrequency;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Only update not provided fields */
|
||||
_SEH2_TRY
|
||||
{
|
||||
if (!(RequestedMode->dmFields & DM_BITSPERPEL) || RequestedMode->dmBitsPerPel == 0)
|
||||
dmSearch.dmBitsPerPel = pdmSelected->dmBitsPerPel;
|
||||
if (!(RequestedMode->dmFields & DM_PELSWIDTH) || RequestedMode->dmPelsWidth == 0)
|
||||
dmSearch.dmPelsWidth = pdmSelected->dmPelsWidth;
|
||||
if (!(RequestedMode->dmFields & DM_PELSHEIGHT) || RequestedMode->dmPelsHeight == 0)
|
||||
dmSearch.dmPelsHeight = pdmSelected->dmPelsHeight;
|
||||
if (!(RequestedMode->dmFields & DM_DISPLAYFREQUENCY) || RequestedMode->dmDisplayFrequency == 0)
|
||||
dmSearch.dmDisplayFrequency = pdmSelected->dmDisplayFrequency;
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
bResult = FALSE;
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!bResult)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now, search the exact mode to return to caller */
|
||||
|
||||
Reference in New Issue
Block a user