Windows: Generate expose events for layered transient children.

Layered (translucent/non-opaque) windows do not receive WM_PAINT,
expose events need to be generated. Improve
6800728d09 to handle transient
children as well.

Task-number: QTBUG-17548
Change-Id: Id113604512692dfbea1f2b10d0db3068213cf599
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2013-08-21 10:36:19 +02:00 committed by The Qt Project
parent 8074693425
commit bc4ce284ad
2 changed files with 29 additions and 6 deletions

View File

@ -1408,14 +1408,27 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowState state)
handleHidden();
QWindowSystemInterface::flushWindowSystemEvents(); // Tell QQuickWindow to stop rendering now.
break;
case Qt::WindowNoState:
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();
// layered windows and transient children, we won't receive any WM_Paint.
QWindow *w = window();
bool exposeEventsSent = false;
if (isLayered()) {
fireExpose(QRegion(0, 0, w->width(), w->height()));
exposeEventsSent = true;
}
foreach (QWindow *child, QGuiApplication::allWindows()) {
if (child != w && child->isVisible() && child->transientParent() == w) {
QWindowsWindow *platformWindow = QWindowsWindow::baseWindowOf(child);
if (platformWindow->isLayered()) {
platformWindow->fireExpose(QRegion(0, 0, child->width(), child->height()));
exposeEventsSent = true;
}
}
}
if (exposeEventsSent && !QWindowsContext::instance()->asyncExpose())
QWindowSystemInterface::flushWindowSystemEvents();
}
break;
default:
break;

View File

@ -229,6 +229,7 @@ public:
static inline void setUserDataOf(HWND hwnd, void *ud);
static bool setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity);
bool isLayered() const;
HDC getDC();
void releaseDC();
@ -375,6 +376,15 @@ inline void QWindowsWindow::destroyIcon()
}
}
inline bool QWindowsWindow::isLayered() const
{
#ifndef Q_OS_WINCE
return GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE) & WS_EX_LAYERED;
#else
return false;
#endif
}
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QMargins)