Windows: Fix bug where windows stopped painting after a restore.

Usually, a window get un-exposed when minimized, and exposed
after the first WM_Paint event when restored.

With layered windows (translucent+frameless) we never receive
a WM_Paint, so lets send the expose event when the window is
restired.

Task-number: QTBUG-17548

Change-Id: Ib56d8abd91b15f9238d223fe692b19a3d2c930b7
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
Sérgio Martins 2013-07-01 09:46:42 +01:00 committed by The Qt Project
parent bef01c87a8
commit 6800728d09

View File

@ -1390,9 +1390,22 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowState state)
setFlag(FrameDirty);
m_windowState = state;
QWindowSystemInterface::handleWindowStateChanged(window(), state);
if (state == Qt::WindowMinimized) {
switch (state) {
case Qt::WindowMinimized:
handleHidden();
QWindowSystemInterface::flushWindowSystemEvents(); // Tell QQuickWindow to stop rendering now.
break;
case Qt::WindowNoState:
// QTBUG-17548: We send expose events when receiving WM_Paint, but for
// layered windows, we won't receive any WM_Paint.
if (GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE) & WS_EX_LAYERED) {
fireExpose(QRegion(0, 0, window()->width(), window()->height()));
if (!QWindowsContext::instance()->asyncExpose())
QWindowSystemInterface::flushWindowSystemEvents();
}
break;
default:
break;
}
}