|
|
0cfe39 |
From 10005185e06857ce119c50fe710f9eedde06ec5e Mon Sep 17 00:00:00 2001
|
|
|
0cfe39 |
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@qt.io>
|
|
|
0cfe39 |
Date: Fri, 13 Nov 2020 11:21:50 +0100
|
|
|
0cfe39 |
Subject: [PATCH 08/19] Make setting QT_SCALE_FACTOR work on Wayland
|
|
|
0cfe39 |
|
|
|
0cfe39 |
QWindow geometry accessors return geometry in device
|
|
|
0cfe39 |
independent pixels. Normally this coordinate system
|
|
|
0cfe39 |
is equivalent to the Wayland native coordinate system,
|
|
|
0cfe39 |
but this is not the case when QT_SCALE_FACTOR is set.
|
|
|
0cfe39 |
|
|
|
0cfe39 |
Replace QWindow geometry calls with the helpers from
|
|
|
0cfe39 |
QPlatformWindow which return geometry in the native
|
|
|
0cfe39 |
coordinate system:
|
|
|
0cfe39 |
|
|
|
0cfe39 |
QWindow::geometry() -> QPlatformWindow::windowGeometry()
|
|
|
0cfe39 |
QWindow::frameGeometry() -> QPlatformWindow::windowFrameGeometry()
|
|
|
0cfe39 |
|
|
|
0cfe39 |
Task-number: QTBUG-87762
|
|
|
0cfe39 |
Fixes: QTBUG-88064
|
|
|
0cfe39 |
(cherry-picked from commit 8cb1b07aea12d50b4fecc45c903705dfd368022a)
|
|
|
0cfe39 |
Change-Id: I6e2029bc6210f12441ae7c9d8b678271e9922dde
|
|
|
0cfe39 |
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
|
|
|
0cfe39 |
---
|
|
|
0cfe39 |
src/client/qwaylandwindow.cpp | 7 ++++---
|
|
|
0cfe39 |
.../shellintegration/wl-shell/qwaylandwlshellsurface.cpp | 2 +-
|
|
|
0cfe39 |
.../shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 2 +-
|
|
|
0cfe39 |
.../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 2 +-
|
|
|
0cfe39 |
.../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +-
|
|
|
0cfe39 |
5 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
0cfe39 |
|
|
|
0cfe39 |
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
|
|
|
0cfe39 |
index eb053406..9b343702 100644
|
|
|
0cfe39 |
--- a/src/client/qwaylandwindow.cpp
|
|
|
0cfe39 |
+++ b/src/client/qwaylandwindow.cpp
|
|
|
0cfe39 |
@@ -194,10 +194,11 @@ void QWaylandWindow::initWindow()
|
|
|
0cfe39 |
if (QScreen *s = window()->screen())
|
|
|
0cfe39 |
setOrientationMask(s->orientationUpdateMask());
|
|
|
0cfe39 |
setWindowFlags(window()->flags());
|
|
|
0cfe39 |
- if (window()->geometry().isEmpty())
|
|
|
0cfe39 |
+ QRect geometry = windowGeometry();
|
|
|
0cfe39 |
+ if (geometry.isEmpty())
|
|
|
0cfe39 |
setGeometry_helper(QRect(QPoint(), QSize(500,500)));
|
|
|
0cfe39 |
else
|
|
|
0cfe39 |
- setGeometry_helper(window()->geometry());
|
|
|
0cfe39 |
+ setGeometry_helper(geometry);
|
|
|
0cfe39 |
setMask(window()->mask());
|
|
|
0cfe39 |
if (mShellSurface)
|
|
|
0cfe39 |
mShellSurface->requestWindowStates(window()->windowStates());
|
|
|
0cfe39 |
@@ -431,7 +432,7 @@ void QWaylandWindow::setVisible(bool visible)
|
|
|
0cfe39 |
initWindow();
|
|
|
0cfe39 |
mDisplay->flushRequests();
|
|
|
0cfe39 |
|
|
|
0cfe39 |
- setGeometry(window()->geometry());
|
|
|
0cfe39 |
+ setGeometry(windowGeometry());
|
|
|
0cfe39 |
// Don't flush the events here, or else the newly visible window may start drawing, but since
|
|
|
0cfe39 |
// there was no frame before it will be stuck at the waitForFrameSync() in
|
|
|
0cfe39 |
// QWaylandShmBackingStore::beginPaint().
|
|
|
0cfe39 |
diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp
|
|
|
0cfe39 |
index 245fec19..8f41118d 100644
|
|
|
0cfe39 |
--- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp
|
|
|
0cfe39 |
+++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp
|
|
|
0cfe39 |
@@ -134,7 +134,7 @@ void QWaylandWlShellSurface::applyConfigure()
|
|
|
0cfe39 |
{
|
|
|
0cfe39 |
if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen))
|
|
|
0cfe39 |
&& !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) {
|
|
|
0cfe39 |
- m_normalSize = m_window->window()->frameGeometry().size();
|
|
|
0cfe39 |
+ m_normalSize = m_window->windowFrameGeometry().size();
|
|
|
0cfe39 |
}
|
|
|
0cfe39 |
|
|
|
0cfe39 |
if (m_pending.states != m_applied.states)
|
|
|
0cfe39 |
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp
|
|
|
0cfe39 |
index 770fad7e..73aba1ee 100644
|
|
|
0cfe39 |
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp
|
|
|
0cfe39 |
+++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp
|
|
|
0cfe39 |
@@ -157,7 +157,7 @@ void QWaylandXdgSurfaceV5::applyConfigure()
|
|
|
0cfe39 |
if (m_pending.isResizing)
|
|
|
0cfe39 |
m_normalSize = m_pending.size;
|
|
|
0cfe39 |
else if (!(m_acked.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
|
|
|
0cfe39 |
- m_normalSize = m_window->window()->frameGeometry().size();
|
|
|
0cfe39 |
+ m_normalSize = m_window->windowFrameGeometry().size();
|
|
|
0cfe39 |
|
|
|
0cfe39 |
if ((m_pending.states & Qt::WindowActive) && !(m_acked.states & Qt::WindowActive))
|
|
|
0cfe39 |
m_window->display()->handleWindowActivated(m_window);
|
|
|
0cfe39 |
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
|
|
|
0cfe39 |
index c137b308..8c371661 100644
|
|
|
0cfe39 |
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
|
|
|
0cfe39 |
+++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
|
|
|
0cfe39 |
@@ -72,7 +72,7 @@ QWaylandXdgSurfaceV6::Toplevel::~Toplevel()
|
|
|
0cfe39 |
void QWaylandXdgSurfaceV6::Toplevel::applyConfigure()
|
|
|
0cfe39 |
{
|
|
|
0cfe39 |
if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
|
|
|
0cfe39 |
- m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size();
|
|
|
0cfe39 |
+ m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size();
|
|
|
0cfe39 |
|
|
|
0cfe39 |
if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive))
|
|
|
0cfe39 |
m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window);
|
|
|
0cfe39 |
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
|
|
|
0cfe39 |
index b6d23ac1..1c762944 100644
|
|
|
0cfe39 |
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
|
|
|
0cfe39 |
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
|
|
|
0cfe39 |
@@ -83,7 +83,7 @@ QWaylandXdgSurface::Toplevel::~Toplevel()
|
|
|
0cfe39 |
void QWaylandXdgSurface::Toplevel::applyConfigure()
|
|
|
0cfe39 |
{
|
|
|
0cfe39 |
if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
|
|
|
0cfe39 |
- m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size();
|
|
|
0cfe39 |
+ m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size();
|
|
|
0cfe39 |
|
|
|
0cfe39 |
if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive))
|
|
|
0cfe39 |
m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window);
|
|
|
0cfe39 |
--
|
|
|
0cfe39 |
2.31.1
|
|
|
0cfe39 |
|