From 1438ad5d3056bca024cc6624f5221b9a9fae6e3b Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 12 Sep 2012 13:09:42 +0300 Subject: Fix repaint issue when resizing a window in Windows QWindowsWindow::handleWmPaint() cached the device context it got from BeginPaint call and used that for the window when the backing store blitted itself to the window. The problem with this device context is that the clipping region is set to only encompass the newly exposed areas, which means any changes caused by the resize on the previously exposed area were not repainted. Fixed by removing the DC caching. The benefit was minimal anyway. Change-Id: I8bd3c4031432ce6b52434c80bfe65d35d9feae49 Reviewed-by: Qt Doc Bot Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 15 +++------------ src/plugins/platforms/windows/qwindowswindow.h | 5 ++--- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d58d10b4d5..d9fcb99f42 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1100,7 +1100,7 @@ HDC QWindowsWindow::getDC() void QWindowsWindow::releaseDC() { - if (m_hdc && !testFlag(DCFromBeginPaint)) { + if (m_hdc) { ReleaseDC(handle(), m_hdc); m_hdc = 0; } @@ -1124,22 +1124,13 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, QRegion(qrectFromRECT(ps.rcPaint))); EndPaint(hwnd, &ps); } else { - const HDC dc = BeginPaint(hwnd, &ps); + BeginPaint(hwnd, &ps); const QRect updateRect = qrectFromRECT(ps.rcPaint); - if (updateRect.size() == m_data.geometry.size()) { - // Store DC for access by the backing store if it has the full size. - releaseDC(); - setFlag(DCFromBeginPaint); - m_hdc = dc; - } + if (QWindowsContext::verboseIntegration) qDebug() << __FUNCTION__ << this << window() << updateRect; QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRegion(updateRect)); - if (testFlag(DCFromBeginPaint)) { - clearFlag(DCFromBeginPaint); - m_hdc = 0; - } EndPaint(hwnd, &ps); } return true; diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 2bcca8710f..2171c7f725 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -116,7 +116,7 @@ public: enum Flags { - DCFromBeginPaint = 0x1, + AutoMouseCapture = 0x1, //! Automatic mouse capture on button press. WithinSetParent = 0x2, FrameDirty = 0x4, //! Frame outdated by setStyle, recalculate in next query. OpenGLSurface = 0x10, @@ -126,8 +126,7 @@ public: SizeGripOperation = 0x100, FrameStrutEventsEnabled = 0x200, SynchronousGeometryChangeEvent = 0x400, - WithinSetStyle = 0x800, - AutoMouseCapture = 0x1000 //! Automatic mouse capture on button press. + WithinSetStyle = 0x800 }; struct WindowData -- cgit v1.2.3