The DWM workaround is not needed when DWM composition is disabled

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-01-03 11:03:24 +08:00
parent 9904a5077a
commit c3c5ef0d5d
1 changed files with 58 additions and 56 deletions

View File

@ -376,7 +376,8 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
// is not correct. It confuses QPA's internal logic. // is not correct. It confuses QPA's internal logic.
clientRect->bottom += 1; clientRect->bottom += 1;
#endif #endif
// Dirty hack to workaround the DWM flicker. if (Utilities::isDwmCompositionAvailable()) {
// Dirty hack to workaround the resize flicker caused by DWM.
LARGE_INTEGER freq = {}; LARGE_INTEGER freq = {};
if (QueryPerformanceFrequency(&freq) == FALSE) { if (QueryPerformanceFrequency(&freq) == FALSE) {
qWarning() << Utilities::getSystemErrorMessage(QStringLiteral("QueryPerformanceFrequency")); qWarning() << Utilities::getSystemErrorMessage(QStringLiteral("QueryPerformanceFrequency"));
@ -433,6 +434,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
qWarning() << "timeEndPeriod() failed."; qWarning() << "timeEndPeriod() failed.";
break; break;
} }
}
// We cannot return WVR_REDRAW otherwise Windows exhibits bugs where // We cannot return WVR_REDRAW otherwise Windows exhibits bugs where
// client pixels and child windows are mispositioned by the width/height // client pixels and child windows are mispositioned by the width/height
// of the upper-left nonclient area. // of the upper-left nonclient area.