File 0001-Client-Ensure-that-guessed-popup-parent-has-a-shell-.patch of Package qt6-wayland

From 92bcb8f6b7a852c7a5d662fc34de561692a7a454 Mon Sep 17 00:00:00 2001
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Date: Thu, 20 Jun 2024 11:25:06 +0300
Subject: [PATCH] Client: Ensure that guessed popup parent has a shell surface

The last input window may not have a shell surface if it is a subsurface
or that window has been just made invisible.

Change-Id: Iad11c68659579429ddc5d9ba0038975b25da8e0d
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit 52c406cec149634680489faeeaf06bb1258cd12f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7d04c18531276c94bfdf2f9a955d6f02554b28b2)
---
 src/client/qwaylandwindow.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 22aeba10..c3725ffc 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -1157,8 +1157,10 @@ QWaylandWindow *QWaylandWindow::guessTransientParent() const
             return mTopPopup;
     }
 
-    if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)
-        return display()->lastInputWindow();
+    if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup) {
+        if (auto lastInputWindow = display()->lastInputWindow())
+            return closestShellSurfaceWindow(lastInputWindow->window());
+    }
 
     return nullptr;
 }
-- 
2.45.2

openSUSE Build Service is sponsored by