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>bb10
parent
16eea84aa8
commit
60df445d3b
|
|
@ -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 ®ion, bool flush)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ private:
|
|||
void setOffset(const QPoint &setOffset);
|
||||
void updateVisibility(bool parentVisible);
|
||||
void updateZorder(int &topZorder);
|
||||
void applyWindowState();
|
||||
|
||||
void fetchBuffers();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue