summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto.qnx@kdab.com>2013-05-31 15:26:41 -0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-07 22:18:23 +0200
commit60df445d3bca6d6908bc8c07708e2df1c02584c9 (patch)
tree3a6cf7ba1773ab9f2041debbe68b15b7037aa3c4 /src/plugins
parent16eea84aa873771047785db9ee00a51904c50ded (diff)
QNX: fix QQnxWindow
To ensure the correct event order, only set the geometry() once the window is actually made visible. We also need to post the expose event even for child windows (i.e., windows which have a parent). Change-Id: Ief80778bc3202352bd194e4b3ba655f619350b1a Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp80
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.h1
2 files changed, 45 insertions, 36 deletions
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 9523685f70..4c95950a7e 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -77,7 +77,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
#endif
m_screen(0),
m_parentWindow(0),
- m_visible(true),
+ m_visible(false),
m_windowState(Qt::WindowNoState),
m_requestedBufferSize(window->geometry().size())
{
@@ -153,7 +153,6 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
if (window->parent() && window->parent()->handle())
setParent(window->parent()->handle());
setGeometryHelper(window->geometry());
- setVisible(window->isVisible());
}
QQnxWindow::~QQnxWindow()
@@ -272,6 +271,9 @@ void QQnxWindow::setVisible(bool visible)
{
qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible;
+ if (m_visible == visible)
+ return;
+
m_visible = visible;
QQnxWindow *root = this;
@@ -282,13 +284,13 @@ void QQnxWindow::setVisible(bool visible)
window()->requestActivate();
- if (window()->isTopLevel()) {
- QWindowSystemInterface::handleExposeEvent(window(), window()->geometry());
+ QWindowSystemInterface::handleExposeEvent(window(), window()->geometry());
- if (!visible) {
- // Flush the context, otherwise it won't disappear immediately
- screen_flush_context(m_screenContext, 0);
- }
+ if (visible) {
+ applyWindowState();
+ } else {
+ // Flush the context, otherwise it won't disappear immediately
+ screen_flush_context(m_screenContext, 0);
}
}
@@ -625,35 +627,10 @@ void QQnxWindow::setWindowState(Qt::WindowState state)
if (m_windowState == state)
return;
- switch (state) {
-
- // WindowActive is not an accepted parameter according to the docs
- case Qt::WindowActive:
- return;
-
- case Qt::WindowMinimized:
- minimize();
-
- if (m_unmaximizedGeometry.isValid())
- setGeometry(m_unmaximizedGeometry);
- else
- setGeometry(m_screen->geometry());
-
- break;
-
- case Qt::WindowMaximized:
- case Qt::WindowFullScreen:
- m_unmaximizedGeometry = geometry();
- setGeometry(state == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry());
- break;
-
- case Qt::WindowNoState:
- if (m_unmaximizedGeometry.isValid())
- setGeometry(m_unmaximizedGeometry);
- break;
- }
-
m_windowState = state;
+
+ if (m_visible)
+ applyWindowState();
}
void QQnxWindow::gainedFocus()
@@ -734,6 +711,37 @@ void QQnxWindow::updateZorder(int &topZorder)
childWindow->updateZorder(topZorder);
}
+void QQnxWindow::applyWindowState()
+{
+ switch (m_windowState) {
+
+ // WindowActive is not an accepted parameter according to the docs
+ case Qt::WindowActive:
+ return;
+
+ case Qt::WindowMinimized:
+ minimize();
+
+ if (m_unmaximizedGeometry.isValid())
+ setGeometry(m_unmaximizedGeometry);
+ else
+ setGeometry(m_screen->geometry());
+
+ break;
+
+ case Qt::WindowMaximized:
+ case Qt::WindowFullScreen:
+ m_unmaximizedGeometry = geometry();
+ setGeometry(m_windowState == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry());
+ break;
+
+ case Qt::WindowNoState:
+ if (m_unmaximizedGeometry.isValid())
+ setGeometry(m_unmaximizedGeometry);
+ break;
+ }
+}
+
void QQnxWindow::blitHelper(QQnxBuffer &source, QQnxBuffer &target, const QPoint &sourceOffset,
const QPoint &targetOffset, const QRegion &region, bool flush)
{
diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h
index 4a327fd54b..63d5dc0979 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.h
+++ b/src/plugins/platforms/qnx/qqnxwindow.h
@@ -124,6 +124,7 @@ private:
void setOffset(const QPoint &setOffset);
void updateVisibility(bool parentVisible);
void updateZorder(int &topZorder);
+ void applyWindowState();
void fetchBuffers();