QNX: Fixed window positioning
Child windows have to keep their relative position when the parent is moved. Change-Id: I7d24d67578c9aaa332136d18ad9b478b120e4696 Reviewed-by: Roger Maclean <rmaclean@qnx.com> Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
This commit is contained in:
parent
8a9bd001c9
commit
9d4d18a3a8
@ -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
|
if (screen()->rootWindow() == this) //If this is the root window, it has to be shown fullscreen
|
||||||
newGeometry = screen()->geometry();
|
newGeometry = screen()->geometry();
|
||||||
|
|
||||||
const QRect oldGeometry = setGeometryHelper(newGeometry);
|
setGeometryHelper(newGeometry);
|
||||||
|
|
||||||
// Send a geometry change event to Qt (triggers resizeEvent() in QWindow/QWidget).
|
// 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::handleGeometryChange(window(), newGeometry);
|
||||||
QWindowSystemInterface::handleExposeEvent(window(), newGeometry);
|
QWindowSystemInterface::handleExposeEvent(window(), newGeometry);
|
||||||
QWindowSystemInterface::setSynchronousWindowsSystemEvents(false);
|
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()
|
qWindowDebug() << Q_FUNC_INFO << "window =" << window()
|
||||||
<< ", (" << rect.x() << "," << rect.y()
|
<< ", (" << rect.x() << "," << rect.y()
|
||||||
<< "," << rect.width() << "," << rect.height() << ")";
|
<< "," << rect.width() << "," << rect.height() << ")";
|
||||||
|
|
||||||
// Call base class method
|
// Call base class method
|
||||||
QRect oldGeometry = QPlatformWindow::geometry();
|
|
||||||
QPlatformWindow::setGeometry(rect);
|
QPlatformWindow::setGeometry(rect);
|
||||||
|
|
||||||
// Set window geometry equal to widget geometry
|
// Set window geometry equal to widget geometry
|
||||||
@ -181,30 +173,7 @@ QRect QQnxWindow::setGeometryHelper(const QRect &rect)
|
|||||||
if (result != 0)
|
if (result != 0)
|
||||||
qFatal("QQnxWindow: failed to set window source size, errno=%d", errno);
|
qFatal("QQnxWindow: failed to set window source size, errno=%d", errno);
|
||||||
|
|
||||||
return oldGeometry;
|
screen_flush_context(m_screenContext, 0);
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQnxWindow::setVisible(bool visible)
|
void QQnxWindow::setVisible(bool visible)
|
||||||
|
@ -125,9 +125,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void createWindowGroup();
|
void createWindowGroup();
|
||||||
QRect setGeometryHelper(const QRect &rect);
|
void setGeometryHelper(const QRect &rect);
|
||||||
void removeFromParent();
|
void removeFromParent();
|
||||||
void setOffset(const QPoint &setOffset);
|
|
||||||
void updateVisibility(bool parentVisible);
|
void updateVisibility(bool parentVisible);
|
||||||
void updateZorder(int &topZorder);
|
void updateZorder(int &topZorder);
|
||||||
void updateZorder(screen_window_t window, int &zOrder);
|
void updateZorder(screen_window_t window, int &zOrder);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user