From 9d4d18a3a80de7be94cea10a67826d9eef6ed20b Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Wed, 15 Jan 2014 11:09:33 +0100 Subject: QNX: Fixed window positioning Child windows have to keep their relative position when the parent is moved. Change-Id: I7d24d67578c9aaa332136d18ad9b478b120e4696 Reviewed-by: Roger Maclean Reviewed-by: Kevin Krammer Reviewed-by: Fabian Bumberger --- src/plugins/platforms/qnx/qqnxwindow.cpp | 37 +++----------------------------- src/plugins/platforms/qnx/qqnxwindow.h | 3 +-- 2 files changed, 4 insertions(+), 36 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 29cc757fca..aa7ec0e499 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -130,7 +130,7 @@ void QQnxWindow::setGeometry(const QRect &rect) if (screen()->rootWindow() == this) //If this is the root window, it has to be shown fullscreen newGeometry = screen()->geometry(); - const QRect oldGeometry = setGeometryHelper(newGeometry); + setGeometryHelper(newGeometry); // Send a geometry change event to Qt (triggers resizeEvent() in QWindow/QWidget). @@ -140,23 +140,15 @@ void QQnxWindow::setGeometry(const QRect &rect) QWindowSystemInterface::handleGeometryChange(window(), newGeometry); QWindowSystemInterface::handleExposeEvent(window(), newGeometry); QWindowSystemInterface::setSynchronousWindowsSystemEvents(false); - - // Now move all children. - if (!oldGeometry.isEmpty()) { - const QPoint offset = newGeometry.topLeft() - oldGeometry.topLeft(); - Q_FOREACH (QQnxWindow *childWindow, m_childWindows) - childWindow->setOffset(offset); - } } -QRect QQnxWindow::setGeometryHelper(const QRect &rect) +void QQnxWindow::setGeometryHelper(const QRect &rect) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << ", (" << rect.x() << "," << rect.y() << "," << rect.width() << "," << rect.height() << ")"; // Call base class method - QRect oldGeometry = QPlatformWindow::geometry(); QPlatformWindow::setGeometry(rect); // Set window geometry equal to widget geometry @@ -181,30 +173,7 @@ QRect QQnxWindow::setGeometryHelper(const QRect &rect) if (result != 0) qFatal("QQnxWindow: failed to set window source size, errno=%d", errno); - return oldGeometry; -} - -void QQnxWindow::setOffset(const QPoint &offset) -{ - qWindowDebug() << Q_FUNC_INFO << "window =" << window(); - // Move self and then children. - QRect newGeometry = geometry(); - newGeometry.translate(offset); - - // Call the base class - QPlatformWindow::setGeometry(newGeometry); - - int val[2]; - - errno = 0; - val[0] = newGeometry.x(); - val[1] = newGeometry.y(); - int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val); - if (result != 0) - qFatal("QQnxWindow: failed to set window position, errno=%d", errno); - - Q_FOREACH (QQnxWindow *childWindow, m_childWindows) - childWindow->setOffset(offset); + screen_flush_context(m_screenContext, 0); } void QQnxWindow::setVisible(bool visible) diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 2f44202b4c..2120c07816 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -125,9 +125,8 @@ protected: private: void createWindowGroup(); - QRect setGeometryHelper(const QRect &rect); + void setGeometryHelper(const QRect &rect); void removeFromParent(); - void setOffset(const QPoint &setOffset); void updateVisibility(bool parentVisible); void updateZorder(int &topZorder); void updateZorder(screen_window_t window, int &zOrder); -- cgit v1.2.3