diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-11-13 11:21:50 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-11-16 11:40:49 +0100 |
commit | 8cb1b07aea12d50b4fecc45c903705dfd368022a (patch) | |
tree | 577f12316d5dfd1aa37930980019703d4d875643 | |
parent | 9a8285d303ba290009637734afc9507b557c6f43 (diff) | |
download | qtwayland-8cb1b07aea12d50b4fecc45c903705dfd368022a.tar.gz |
Make setting QT_SCALE_FACTOR work on Wayland
QWindow geometry accessors return geometry in device
independent pixels. Normally this coordinate system
is equivalent to the Wayland native coordinate system,
but this is not the case when QT_SCALE_FACTOR is set.
Replace QWindow geometry calls with the helpers from
QPlatformWindow which return geometry in the native
coordinate system:
QWindow::geometry() -> QPlatformWindow::windowGeometry()
QWindow::frameGeometry() -> QPlatformWindow::windowFrameGeometry()
Task-number: QTBUG-87762
Fixes: QTBUG-88064
Change-Id: I8c96237b49c754bb978f1739d090962be770c271
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
4 files changed, 7 insertions, 6 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 130dbab3..c7e715b6 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -192,10 +192,11 @@ void QWaylandWindow::initWindow() mSurface->set_buffer_scale(scale()); setWindowFlags(window()->flags()); - if (window()->geometry().isEmpty()) + QRect geometry = windowGeometry(); + if (geometry.isEmpty()) setGeometry_helper(QRect(QPoint(), QSize(500,500))); else - setGeometry_helper(window()->geometry()); + setGeometry_helper(geometry); setMask(window()->mask()); if (mShellSurface) mShellSurface->requestWindowStates(window()->windowStates()); @@ -427,7 +428,7 @@ void QWaylandWindow::setVisible(bool visible) initWindow(); mDisplay->flushRequests(); - setGeometry(window()->geometry()); + setGeometry(windowGeometry()); // Don't flush the events here, or else the newly visible window may start drawing, but since // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). diff --git a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp index ea725ac3..5571682b 100644 --- a/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp +++ b/src/plugins/shellintegration/ivi-shell/qwaylandivishellintegration.cpp @@ -149,7 +149,7 @@ QWaylandShellSurface *QWaylandIviShellIntegration::createShellSurface(QWaylandWi transientPos.setX(transientPos.x() + parent->decoration()->margins().left()); transientPos.setY(transientPos.y() + parent->decoration()->margins().top()); } - QSize size = window->window()->geometry().size(); + QSize size = window->windowGeometry().size(); iviSurface->ivi_controller_surface::set_destination_rectangle(transientPos.x(), transientPos.y(), size.width(), diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp index 245fec19..8f41118d 100644 --- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp @@ -134,7 +134,7 @@ void QWaylandWlShellSurface::applyConfigure() { if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)) && !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) { - m_normalSize = m_window->window()->frameGeometry().size(); + m_normalSize = m_window->windowFrameGeometry().size(); } if (m_pending.states != m_applied.states) diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 43360ede..b7253de2 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -83,7 +83,7 @@ QWaylandXdgSurface::Toplevel::~Toplevel() void QWaylandXdgSurface::Toplevel::applyConfigure() { if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) - m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); + m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size(); if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); |