Windows: Reduce warning output when creating a new window

Amends f32aa06f4f, which called
setDarkBorderToWindow with false when creating a window if windows is
not running in dark mode. This generates warning messages on Windows 10.

We don't have to call the setter at all unless we want dark mode frames,
so skip it if we'd call it with 'false', as that is the default anyway.

At the same time, use categorized logging for these messages; they are
not the result of application developers doing something wrong, and are
only interesting when analysing specific issues.

Change-Id: If80028d71cc2cd9d6dd380976e00b736741287cb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Volker Hilsheimer 2022-12-05 09:42:17 +01:00
parent a874087504
commit b3dbfdd597

View File

@ -926,8 +926,8 @@ QWindowsWindowData
return result;
}
QWindowsWindow::setDarkBorderToWindow(result.hwnd, QWindowsContext::isDarkMode()
&& shouldApplyDarkFrame(w));
if (QWindowsContext::isDarkMode() && shouldApplyDarkFrame(w))
QWindowsWindow::setDarkBorderToWindow(result.hwnd, true);
if (mirrorParentWidth != 0) {
context->obtainedPos.setX(mirrorParentWidth - context->obtainedSize.width()
@ -3161,7 +3161,7 @@ static bool queryDarkBorder(HWND hwnd)
SUCCEEDED(DwmGetWindowAttribute(hwnd, DwmwaUseImmersiveDarkMode, &result, sizeof(result)))
|| SUCCEEDED(DwmGetWindowAttribute(hwnd, DwmwaUseImmersiveDarkModeBefore20h1, &result, sizeof(result)));
if (!ok)
qWarning("%s: Unable to retrieve dark window border setting.", __FUNCTION__);
qCWarning(lcQpaWindow, "%s: Unable to retrieve dark window border setting.", __FUNCTION__);
return result == TRUE;
}
@ -3172,7 +3172,7 @@ bool QWindowsWindow::setDarkBorderToWindow(HWND hwnd, bool d)
SUCCEEDED(DwmSetWindowAttribute(hwnd, DwmwaUseImmersiveDarkMode, &darkBorder, sizeof(darkBorder)))
|| SUCCEEDED(DwmSetWindowAttribute(hwnd, DwmwaUseImmersiveDarkModeBefore20h1, &darkBorder, sizeof(darkBorder)));
if (!ok)
qWarning("%s: Unable to set dark window border.", __FUNCTION__);
qCWarning(lcQpaWindow, "%s: Unable to set %s window border.", __FUNCTION__, d ? "dark" : "light");
return ok;
}