summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-05-24 15:53:09 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-24 17:51:47 +0200
commitd74c45a95bd3c9195129e9be495a38b5a0218acf (patch)
treee825188d8740315c67e0ff33deec660d06e692db
parent66e68b79c276f33f9a161c9eb04a9416b4ec9d9d (diff)
QtWidgets: Fix QT_FLUSH_UPDATE for Windows.
Change-Id: I09fd1ca6e7691b326760b83aad612e9a26717379 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index eb86f25601..a9b43e7933 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -57,6 +57,11 @@
#include <private/qpaintengine_raster_p.h>
#include <private/qgraphicseffect_p.h>
+#if defined(Q_OS_WIN) && !defined(QT_NO_PAINT_DEBUG)
+# include <QtCore/qt_windows.h>
+# include <qpa/qplatformnativeinterface.h>
+#endif
+
QT_BEGIN_NAMESPACE
extern QRegion qt_dirtyRegion(QWidget *);
@@ -115,9 +120,19 @@ static inline void qt_flush(QWidget *widget, const QRegion &region, QBackingStor
}
#ifndef QT_NO_PAINT_DEBUG
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
+
static void showYellowThing_win(QWidget *widget, const QRegion &region, int msec)
{
+ // We expect to be passed a native parent.
+ QWindow *nativeWindow = widget->windowHandle();
+ if (!nativeWindow)
+ return;
+ void *hdcV = QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("getDC"), nativeWindow);
+ if (!hdcV)
+ return;
+ const HDC hdc = reinterpret_cast<HDC>(hdcV);
+
HBRUSH brush;
static int i = 0;
switch (i) {
@@ -136,19 +151,16 @@ static void showYellowThing_win(QWidget *widget, const QRegion &region, int msec
}
i = (i + 1) & 3;
- HDC hdc = widget->getDC();
-
- const QVector<QRect> &rects = region.rects();
- foreach (QRect rect, rects) {
+ foreach (const QRect &rect, region.rects()) {
RECT winRect;
SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom());
FillRect(hdc, &winRect, brush);
}
-
- widget->releaseDC(hdc);
+ DeleteObject(brush);
+ QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("releaseDC"), nativeWindow);
::Sleep(msec);
}
-#endif
+#endif // Q_OS_WIN
void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped)
{
@@ -163,7 +175,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa
widget = nativeParent;
}
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
Q_UNUSED(unclipped);
showYellowThing_win(widget, paintRegion, msec);
#else
@@ -215,7 +227,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa
#if defined(Q_OS_UNIX)
::usleep(1000 * msec);
#endif
-#endif // Q_WS_WIN
+#endif // !Q_OS_WIN
}
bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn)