8716ee1
From 36a552fa530be57091e986ebd1468d75d3061743 Mon Sep 17 00:00:00 2001
8716ee1
From: David Edmundson <davidedmundson@kde.org>
8716ee1
Date: Mon, 3 May 2021 23:01:53 +0100
3895c6d
Subject: [PATCH 25/36] Client: Set XdgShell size hints before the first commit
8716ee1
8716ee1
propagateSizeHints is only called in QWindow we have platform window and
8716ee1
minimumSizeHint is then sent. We also need to send existing hints when
8716ee1
we create the shell window.
8716ee1
8716ee1
Sending them when we apply configure is too late, we need these hints
8716ee1
available for the compositor to correctly configure the window.
8716ee1
8716ee1
Change-Id: I6cbb294b11db06ecd87535fa4816bb8ad34a29c6
8716ee1
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
8716ee1
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
8716ee1
(cherry picked from commit d6e074d0d35221b0fac14c94fc79c98363f2f6c3)
8716ee1
---
8716ee1
 src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 3 +--
8716ee1
 tests/auto/client/xdgshell/tst_xdgshell.cpp                 | 2 +-
8716ee1
 2 files changed, 2 insertions(+), 3 deletions(-)
8716ee1
8716ee1
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
8716ee1
index 3a1569f7..7d33dabd 100644
8716ee1
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
8716ee1
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
8716ee1
@@ -105,8 +105,6 @@ void QWaylandXdgSurface::Toplevel::applyConfigure()
8716ee1
         m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size);
8716ee1
     }
8716ee1
 
8716ee1
-    m_xdgSurface->setSizeHints();
8716ee1
-
8716ee1
     m_applied = m_pending;
8716ee1
     qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states;
8716ee1
 }
8716ee1
@@ -257,6 +255,7 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, ::xdg_surface *s
8716ee1
                 m_toplevel->set_parent(parentXdgSurface->m_toplevel->object());
8716ee1
         }
8716ee1
     }
8716ee1
+    setSizeHints();
8716ee1
 }
8716ee1
 
8716ee1
 QWaylandXdgSurface::~QWaylandXdgSurface()
8716ee1
diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp
8716ee1
index 2277bbb8..2fdd0a7c 100644
8716ee1
--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp
8716ee1
+++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp
8716ee1
@@ -505,7 +505,7 @@ void tst_xdgshell::minMaxSize()
8716ee1
     window.show();
8716ee1
     QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
8716ee1
 
8716ee1
-    exec([=] { xdgToplevel()->sendCompleteConfigure(); });
8716ee1
+    // we don't roundtrip with our configuration the initial commit should be correct
8716ee1
 
8716ee1
     QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(100, 100));
8716ee1
     QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000));
8716ee1
-- 
3895c6d
2.33.1
8716ee1