diff options
author | Morten Sorvig <morten.sorvig@nokia.com> | 2011-08-16 09:25:50 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2011-08-16 09:36:43 +0200 |
commit | 30774e9552591746a2640ba39c7afdc052952597 (patch) | |
tree | 8d368f367a403c9e9fb654186b2e2328e5bde7cb /src | |
parent | 7589bdc7202b11f40c2fe5820aa0afaca3cf2670 (diff) |
Cocoa: Fix flicker on window resize.
During window resizing the geometry change events
must be processed before returning from the event
handler.
New API: QWindowSystemInterface::handleSynchronousGeometryChange,
similar to handleGeometryChange but sends the event
immediately instead of queueing it.
Change-Id: I7dc809b3fd2e8a933c100fef3f5144972f46e363
Reviewed-on: http://codereview.qt.nokia.com/2993
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 047c134b69..9b3d691805 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -93,6 +93,11 @@ void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &new QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleSynchronousGeometryChange(QWindow *tlw, const QRect &newRect) +{ + QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect); + QGuiApplicationPrivate::processWindowSystemEvent(e); // send event immediately. +} void QWindowSystemInterface::handleCloseEvent(QWindow *tlw) { diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 52838e03c5..dcfd7f1651 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -95,6 +95,7 @@ public: static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList<struct TouchPoint> &points); static void handleGeometryChange(QWindow *w, const QRect &newRect); + static void handleSynchronousGeometryChange(QWindow *w, const QRect &newRect); static void handleCloseEvent(QWindow *w); static void handleEnterEvent(QWindow *w); static void handleLeaveEvent(QWindow *w); diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 08a45cba6b..fefdbc8205 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -154,10 +154,9 @@ void QCocoaWindow::windowDidMove() void QCocoaWindow::windowDidResize() { - //jlind: XXX This isn't ideal. Eventdispatcher does not run when resizing... NSRect rect = [[m_nsWindow contentView]frame]; QRect geo(rect.origin.x,rect.origin.y,rect.size.width,rect.size.height); - QWindowSystemInterface::handleGeometryChange(window(),geo); + QWindowSystemInterface::handleSynchronousGeometryChange(window(), geo); if (m_glContext) m_glContext->update(); |