summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer.qnx@kdab.com>2012-07-31 15:27:37 +0100
committerQt by Nokia <qt-info@nokia.com>2012-08-01 15:37:46 +0200
commit19d1eb06b33237426e643b21ab1122b2aaff3a8c (patch)
treea4dc4bb930537e14952af5922c36679729fd193b
parentb23c37358d2240919d618c0435420645567ebaf3 (diff)
QNX: Do not send geometry change events to Qt too early
We explicitly do not send geometry change events to Qt from QQnxWindow from the constructor. This prevents us from ending up in resizeEvent() reimplementations from the QWindow ctor. Change-Id: I045b35aa7eb23890772fe131c3d19314252f6a5a Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp52
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.h1
2 files changed, 31 insertions, 22 deletions
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index f717a33d78..dd69d15002 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -139,7 +139,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
setWindowState(window->windowState());
if (window->parent())
setParent(window->parent()->handle());
- setGeometry(window->geometry());
+ setGeometryHelper(window->geometry());
setVisible(window->isVisible());
}
@@ -164,6 +164,34 @@ QQnxWindow::~QQnxWindow()
void QQnxWindow::setGeometry(const QRect &rect)
{
+ const QRect oldGeometry = setGeometryHelper(rect);
+
+ // If this is an OpenGL window we need to request that the GL context updates
+ // the EGLsurface on which it is rendering. The surface will be recreated the
+ // next time QQnxGLContext::makeCurrent() is called.
+ {
+ // We want the setting of the atomic bool in the GL context to be atomic with
+ // setting m_requestedBufferSize and therefore extended the scope to include
+ // that test.
+ const QMutexLocker locker(&m_mutex);
+ m_requestedBufferSize = rect.size();
+ if (m_platformOpenGLContext != 0 && bufferSize() != rect.size())
+ m_platformOpenGLContext->requestSurfaceChange();
+ }
+
+ // Send a geometry change event to Qt (triggers resizeEvent() in QWindow/QWidget)
+ QWindowSystemInterface::handleSynchronousGeometryChange(window(), rect);
+
+ // Now move all children.
+ if (!oldGeometry.isEmpty()) {
+ const QPoint offset = rect.topLeft() - oldGeometry.topLeft();
+ Q_FOREACH (QQnxWindow *childWindow, m_childWindows)
+ childWindow->setOffset(offset);
+ }
+}
+
+QRect QQnxWindow::setGeometryHelper(const QRect &rect)
+{
qWindowDebug() << Q_FUNC_INFO << "window =" << window()
<< ", (" << rect.x() << "," << rect.y()
<< "," << rect.width() << "," << rect.height() << ")";
@@ -197,27 +225,7 @@ void QQnxWindow::setGeometry(const QRect &rect)
qFatal("QQnxWindow: failed to set window source size, errno=%d", errno);
}
- // If this is an OpenGL window we need to request that the GL context updates
- // the EGLsurface on which it is rendering. The surface will be recreated the
- // next time QQnxGLContext::makeCurrent() is called.
- {
- // We want the setting of the atomic bool in the GL context to be atomic with
- // setting m_requestedBufferSize and therefore extended the scope to include
- // that test.
- const QMutexLocker locker(&m_mutex);
- m_requestedBufferSize = rect.size();
- if (m_platformOpenGLContext != 0 && bufferSize() != rect.size())
- m_platformOpenGLContext->requestSurfaceChange();
- }
-
- QWindowSystemInterface::handleSynchronousGeometryChange(window(), rect);
-
- // Now move all children.
- if (!oldGeometry.isEmpty()) {
- const QPoint offset = rect.topLeft() - oldGeometry.topLeft();
- Q_FOREACH (QQnxWindow *childWindow, m_childWindows)
- childWindow->setOffset(offset);
- }
+ return oldGeometry;
}
void QQnxWindow::setOffset(const QPoint &offset)
diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h
index 091476edec..5c3f8e6452 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.h
+++ b/src/plugins/platforms/qnx/qqnxwindow.h
@@ -118,6 +118,7 @@ public:
void blitFrom(QQnxWindow *sourceWindow, const QPoint &sourceOffset, const QRegion &targetRegion);
private:
+ QRect setGeometryHelper(const QRect &rect);
void removeFromParent();
void setOffset(const QPoint &setOffset);
void updateVisibility(bool parentVisible);