diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-10-27 10:31:29 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-27 11:12:38 +0200 |
commit | 19b029cd9d8540b6d6628feb9201b75679f1dbd2 (patch) | |
tree | b19566115b0777c28577b23bc07b8da346ca4bdf /src/plugins/platforms | |
parent | abf25d3f64b2a30453eac9bbf7b5c1238313938e (diff) |
Windows: More fine-grained paint event handling.
Pass expose events to GL widgets, handle invalid
update rectangles, ignore WM_ERASEBKND (using code from 4.8).
Change-Id: Ide062efb392292fff556d37b0ef0e880676748a2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 15 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.h | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index d3ca49635d..92f764cf14 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -680,8 +680,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, } break; case QtWindows::ExposeEvent: - platformWindow->handleWmPaint(hwnd, message, wParam, lParam); - return true; + return platformWindow->handleWmPaint(hwnd, message, wParam, lParam); case QtWindows::MouseWheelEvent: case QtWindows::MouseEvent: case QtWindows::NonClientMouseEvent: diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index ef5c2ae246..21d02ab664 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -942,12 +942,22 @@ void QWindowsWindow::releaseDC() } } -void QWindowsWindow::handleWmPaint(HWND hwnd, UINT, +bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, WPARAM, LPARAM) { + // Ignore invalid update bounding rectangles + if (!GetUpdateRect(m_data.hwnd, 0, FALSE)) + return false; + if (message == WM_ERASEBKGND) // Backing store - ignored. + return true; PAINTSTRUCT ps; if (testFlag(OpenGLSurface)) { - BeginPaint(hwnd, &ps); // WM_ERASEBKGND needs to be handled. + // Observed painting problems with Aero style disabled (QTBUG-7865). + if (testFlag(OpenGLDoubleBuffered)) + InvalidateRect(hwnd, 0, false); + BeginPaint(hwnd, &ps); + QWindowSystemInterface::handleSynchronousExposeEvent(window(), + QRegion(qrectFromRECT(ps.rcPaint))); EndPaint(hwnd, &ps); } else { releaseDC(); @@ -963,6 +973,7 @@ void QWindowsWindow::handleWmPaint(HWND hwnd, UINT, m_hdc = 0; EndPaint(hwnd, &ps); } + return true; } void QWindowsWindow::setWindowTitle(const QString &title) diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 2aaf722277..95e497acdb 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -156,7 +156,7 @@ public: { return GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE); } void setExStyle(unsigned s) const; - void handleWmPaint(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + bool handleWmPaint(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); void handleMoved(); void handleResized(int wParam); |