qpa: Geometry handling fixes

We don't need to emit {x,y,width,height}Changed signals ourselves. We
also need to send an expose event otherwise the window can be rendered
incorrectly if it's resized. The logic follows QtWayland implementation.
This commit is contained in:
Vlad Zahorodnii 2022-10-28 00:50:28 +03:00
parent 9774eacbbe
commit fd978838cc

View file

@ -60,29 +60,22 @@ void Window::requestActivateWindow()
void Window::setGeometry(const QRect &rect)
{
const QRect &oldRect = geometry();
const QRect oldGeometry = geometry();
QPlatformWindow::setGeometry(rect);
if (rect.x() != oldRect.x()) {
Q_EMIT window()->xChanged(rect.x());
}
if (rect.y() != oldRect.y()) {
Q_EMIT window()->yChanged(rect.y());
}
if (rect.width() != oldRect.width()) {
Q_EMIT window()->widthChanged(rect.width());
}
if (rect.height() != oldRect.height()) {
Q_EMIT window()->heightChanged(rect.height());
}
const QSize nativeSize = rect.size() * m_scale;
if (m_contentFBO) {
if (m_contentFBO->size() != nativeSize) {
m_resized = true;
if (window()->isVisible() && rect.isValid()) {
const QSize nativeSize = rect.size() * m_scale;
if (m_contentFBO) {
if (m_contentFBO->size() != nativeSize) {
m_resized = true;
}
}
QWindowSystemInterface::handleGeometryChange(window(), geometry());
}
if (isExposed() && oldGeometry.size() != rect.size()) {
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), rect.size()));
}
QWindowSystemInterface::handleGeometryChange(window(), geometry());
}
WId Window::winId() const