summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp59
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h7
3 files changed, 35 insertions, 34 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 3f4555a31f..872fd07729 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -842,9 +842,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::FocusOutEvent:
handleFocusEvent(et, platformWindow);
return true;
- case QtWindows::ShowEvent:
- platformWindow->handleShown();
- return false; // Indicate transient children should be shown by windows (SW_PARENTOPENING)
case QtWindows::HideEvent:
platformWindow->handleHidden();
return false;// Indicate transient children should be hidden by windows (SW_PARENTCLOSING)
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 9a9877b43f..1ff98a3d29 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -839,6 +839,15 @@ QWindowsWindow::~QWindowsWindow()
destroyIcon();
}
+void QWindowsWindow::fireExpose(const QRegion &region, bool force)
+{
+ if (region.isEmpty() && !force)
+ clearFlag(Exposed);
+ else
+ setFlag(Exposed);
+ QWindowSystemInterface::handleExposeEvent(window(), region);
+}
+
void QWindowsWindow::destroyWindow()
{
if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows)
@@ -942,13 +951,19 @@ void QWindowsWindow::setVisible(bool visible)
if (m_data.hwnd) {
if (visible) {
show_sys();
- QWindowSystemInterface::handleExposeEvent(window(),
- QRect(QPoint(), geometry().size()));
+
+ // When the window is layered, we won't get WM_PAINT, and "we" are in control
+ // over the rendering of the window
+ // There is nobody waiting for this, so we don't need to flush afterwards.
+ QWindow *w = window();
+ if (w->format().hasAlpha() || qFuzzyCompare(w->opacity(), qreal(1)))
+ fireExpose(QRect(0, 0, w->width(), w->height()));
+
} else {
if (hasMouseCapture())
setMouseGrabEnabled(false);
hide_sys();
- QWindowSystemInterface::handleExposeEvent(window(), QRegion());
+ fireExpose(QRegion());
}
}
}
@@ -1094,14 +1109,9 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const
}
}
-void QWindowsWindow::handleShown()
-{
- QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size()));
-}
-
void QWindowsWindow::handleHidden()
{
- QWindowSystemInterface::handleExposeEvent(window(), QRegion());
+ fireExpose(QRegion());
}
void QWindowsWindow::setGeometry(const QRect &rectIn)
@@ -1267,28 +1277,21 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
if (message == WM_ERASEBKGND) // Backing store - ignored.
return true;
PAINTSTRUCT ps;
- if (testFlag(OpenGLSurface)) {
- // Observed painting problems with Aero style disabled (QTBUG-7865).
- if (testFlag(OpenGLDoubleBuffered))
- InvalidateRect(hwnd, 0, false);
- BeginPaint(hwnd, &ps);
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(qrectFromRECT(ps.rcPaint)));
- if (!QWindowsContext::instance()->asyncExpose())
- QWindowSystemInterface::flushWindowSystemEvents();
- EndPaint(hwnd, &ps);
- } else {
- BeginPaint(hwnd, &ps);
- const QRect updateRect = qrectFromRECT(ps.rcPaint);
+ // Observed painting problems with Aero style disabled (QTBUG-7865).
+ if (testFlag(OpenGLSurface) && testFlag(OpenGLDoubleBuffered))
+ InvalidateRect(hwnd, 0, false);
- if (QWindowsContext::verboseIntegration)
- qDebug() << __FUNCTION__ << this << window() << updateRect;
+ BeginPaint(hwnd, &ps);
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(updateRect));
- if (!QWindowsContext::instance()->asyncExpose())
- QWindowSystemInterface::flushWindowSystemEvents();
- EndPaint(hwnd, &ps);
- }
+ // If the a window is obscured by another window (such as a child window)
+ // we still need to send isExposed=true, for compatibility.
+ // Our tests depend on it.
+ fireExpose(QRegion(qrectFromRECT(ps.rcPaint)), true);
+ if (!QWindowsContext::instance()->asyncExpose())
+ QWindowSystemInterface::flushWindowSystemEvents();
+
+ EndPaint(hwnd, &ps);
return true;
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 2117ca50b8..fed9d089df 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -133,7 +133,8 @@ public:
WithinSetStyle = 0x800,
WithinDestroy = 0x1000,
TouchRegistered = 0x2000,
- AlertState = 0x4000
+ AlertState = 0x4000,
+ Exposed = 0x08000
};
struct WindowData
@@ -161,7 +162,7 @@ public:
virtual void setVisible(bool visible);
bool isVisible() const;
- virtual bool isExposed() const { return m_windowState != Qt::WindowMinimized && isVisible(); }
+ virtual bool isExposed() const { return testFlag(Exposed); }
virtual bool isActive() const;
virtual bool isEmbedded(const QPlatformWindow *parentWindow) const;
virtual QPoint mapToGlobal(const QPoint &pos) const;
@@ -217,7 +218,6 @@ public:
void handleMoved();
void handleResized(int wParam);
- void handleShown();
void handleHidden();
static inline HWND handleOf(const QWindow *w);
@@ -278,6 +278,7 @@ private:
void handleGeometryChange();
void handleWindowStateChange(Qt::WindowState state);
inline void destroyIcon();
+ void fireExpose(const QRegion &region, bool force=false);
mutable WindowData m_data;
mutable unsigned m_flags;