Windows QPA: Restrict expose workaround to non-Aero themes.

The workaround may cause flicker, so only use it when necessary.

Task-number: QTBUG-7865
Change-Id: I813aa0669727303bc947a85a8893a90f29d3ff24
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
bb10
Friedemann Kleint 2016-06-28 10:00:51 +02:00
parent 29ac40d6cd
commit 05aedf4e1d
1 changed files with 7 additions and 2 deletions

View File

@ -1569,6 +1569,12 @@ void QWindowsWindow::releaseDC()
}
}
static inline bool dwmIsCompositionEnabled()
{
BOOL dWmCompositionEnabled = FALSE;
return SUCCEEDED(DwmIsCompositionEnabled(&dWmCompositionEnabled)) && dWmCompositionEnabled == TRUE;
}
bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
WPARAM, LPARAM)
{
@ -1582,8 +1588,7 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
BeginPaint(hwnd, &ps);
// Observed painting problems with Aero style disabled (QTBUG-7865).
// 5.8: Consider making it dependent on !DwmIsCompositionEnabled().
if (testFlag(OpenGLSurface) && testFlag(OpenGLDoubleBuffered))
if (Q_UNLIKELY(testFlag(OpenGLSurface) && testFlag(OpenGLDoubleBuffered) && !dwmIsCompositionEnabled()))
SelectClipRgn(ps.hdc, NULL);
// If the a window is obscured by another window (such as a child window)