Blame SOURCES/0008-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch

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