Commit 6a57ed80 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

dwmapi: Fallback to 60Hz if the display frequency is invalid in get_display_frequency().

DwmGetCompositionTimingInfo() may throw a zero division exception if the display reports a 0Hz frequency, which can happen when testing under Xephyr without -fakescreenfps option.
parent 2fde0a3f
......@@ -213,12 +213,16 @@ HRESULT WINAPI DwmRegisterThumbnail(HWND dest, HWND src, PHTHUMBNAIL thumbnail_i
static int get_display_frequency(void)
{
DEVMODEA mode;
DEVMODEW mode;
BOOL ret;
memset(&mode, 0, sizeof(mode));
mode.dmSize = sizeof(mode);
if (EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &mode))
ret = EnumDisplaySettingsExW(NULL, ENUM_CURRENT_SETTINGS, &mode, 0);
if (ret && mode.dmFields & DM_DISPLAYFREQUENCY && mode.dmDisplayFrequency)
{
return mode.dmDisplayFrequency;
}
else
{
WARN("Failed to query display frequency, returning a fallback value.\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment