diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-07-28 15:55:56 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-08-12 07:47:32 +0200 |
commit | b08cc0ec6f096d0e6764486c81264c24a406bee1 (patch) | |
tree | adae4a54595807dd02e9307ae7c570406aa4ecb7 /src/plugins/platforms | |
parent | 611558d877a9ee4448b30e5443e3025c6235daaf (diff) |
Make the expose region local on all platforms
QExposeEvent::region() reports a region in a random coordinate system.
The behavior is undocumented and the platform plugins do different things.
xcb, offscreen and ios are correct. These set the region in local coordinates,
which is the most logical interpretation of the expose region.
windows is almost correct, except for one occurrence.
cocoa and others need changes: passing in geometry() as the exposed region is
always wrong.
The patch documents the expected behavior both for QExposeEvent and
internally in QWindowSystemInterface. The problematic plugins are fixed to
use local coordinates.
Task-number: QTBUG-40470
Change-Id: I6ded3154d14254fa71d4292d8e1b5e6cf696c81a
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/plugins/platforms')
7 files changed, 22 insertions, 18 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp index 7c39cb718d..d821145973 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp @@ -86,7 +86,7 @@ void QAndroidPlatformOpenGLWindow::setGeometry(const QRect &rect) && rect.height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) { - QWindowSystemInterface::handleExposeEvent(window(), QRegion(rect)); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), rect.size())); } } diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index 529ae0a80d..433461f628 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -243,7 +243,7 @@ void QAndroidPlatformScreen::setAvailableGeometry(const QRect &rect) if (w->handle()) { QRect geometry = w->handle()->geometry(); if (geometry.width() > 0 && geometry.height() > 0) - QWindowSystemInterface::handleExposeEvent(w, QRegion(geometry)); + QWindowSystemInterface::handleExposeEvent(w, QRect(QPoint(0, 0), geometry.size())); } } } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 29b983cd89..7e22351818 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -516,7 +516,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect) // call this here: updateGeometry in qnsview.mm is a no-op for this case QWindowSystemInterface::handleGeometryChange(window(), rect); - QWindowSystemInterface::handleExposeEvent(window(), rect); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), rect.size())); } else if (m_nsWindow) { NSRect bounds = qt_mac_flipRect(rect); [m_nsWindow setFrame:[m_nsWindow frameRectForContentRect:bounds] display:YES animate:NO]; @@ -1749,7 +1749,7 @@ void QCocoaWindow::exposeWindow() m_isExposed = true; m_exposedGeometry = geometry(); m_exposedDevicePixelRatio = devicePixelRatio(); - QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), m_exposedGeometry.size())); } } @@ -1780,7 +1780,7 @@ void QCocoaWindow::updateExposedGeometry() m_isExposed = true; m_exposedGeometry = geometry(); m_exposedDevicePixelRatio = devicePixelRatio(); - QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), m_exposedGeometry.size())); } QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint) diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index 670a955bd6..8d7eeb3cd9 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -137,7 +137,7 @@ void QDirectFbWindow::setVisible(bool visible) } if (window()->isTopLevel() && visible) - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), window()->geometry())); } void QDirectFbWindow::setWindowFlags(Qt::WindowFlags flags) diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index a0150b7ade..1f67170efc 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -98,7 +98,7 @@ void QEglFSWindow::create() m_flags |= HasNativeWindow; setGeometry(QRect()); // will become fullscreen - QWindowSystemInterface::handleExposeEvent(window(), geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size())); EGLDisplay display = static_cast<QEglFSScreen *>(screen)->display(); QSurfaceFormat platformFormat = QEglFSHooks::hooks()->surfaceFormatFor(window()->requestedFormat()); @@ -168,8 +168,9 @@ void QEglFSWindow::resetSurface() void QEglFSWindow::setVisible(bool visible) { QList<QEGLPlatformWindow *> windows = screen()->windows(); + QWindow *wnd = window(); - if (window()->type() != Qt::Desktop) { + if (wnd->type() != Qt::Desktop) { if (visible) { screen()->addWindow(this); } else { @@ -180,7 +181,7 @@ void QEglFSWindow::setVisible(bool visible) } } - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); if (visible) QWindowSystemInterface::flushWindowSystemEvents(); @@ -218,15 +219,17 @@ void QEglFSWindow::requestActivateWindow() if (window()->type() != Qt::Desktop) screen()->moveToTop(this); - QWindowSystemInterface::handleWindowActivated(window()); - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindow *wnd = window(); + QWindowSystemInterface::handleWindowActivated(wnd); + QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); } void QEglFSWindow::raise() { - if (window()->type() != Qt::Desktop) { + QWindow *wnd = window(); + if (wnd->type() != Qt::Desktop) { screen()->moveToTop(this); - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); } } @@ -237,7 +240,8 @@ void QEglFSWindow::lower() int idx = windows.indexOf(this); if (idx > 0) { screen()->changeWindowIndex(this, idx - 1); - QWindowSystemInterface::handleExposeEvent(windows.last()->window(), windows.last()->geometry()); + QWindowSystemInterface::handleExposeEvent(windows.last()->window(), + QRect(QPoint(0, 0), windows.last()->geometry().size())); } } } diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 5a405f9577..56f17e6d11 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -252,7 +252,7 @@ void QQnxWindow::setGeometry(const QRect &rect) setGeometryHelper(newGeometry); if (isExposed()) - QWindowSystemInterface::handleExposeEvent(window(), newGeometry); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), newGeometry.size())); } void QQnxWindow::setGeometryHelper(const QRect &rect) @@ -306,7 +306,7 @@ void QQnxWindow::setVisible(bool visible) root->updateVisibility(root->m_visible); - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), window()->geometry().size())); if (visible) { applyWindowState(); @@ -345,7 +345,7 @@ void QQnxWindow::setExposed(bool exposed) if (m_exposed != exposed) { m_exposed = exposed; - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), window()->geometry().size())); } } diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index c5978c125c..3b54feabbf 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1389,7 +1389,7 @@ void QWindowsWindow::handleGeometryChange() // expose events when shrinking, synthesize. if (!testFlag(OpenGL_ES2) && isExposed() && !(m_data.geometry.width() > previousGeometry.width() || m_data.geometry.height() > previousGeometry.height())) { - fireExpose(QRegion(m_data.geometry), true); + fireExpose(QRect(QPoint(0, 0), m_data.geometry.size()), true); } if (previousGeometry.topLeft() != m_data.geometry.topLeft()) { QPlatformScreen *newScreen = screenForGeometry(m_data.geometry); |