Blame SOURCES/0041-Client-set-constraint-adjustments-for-popups-in-xdg.patch

93bb3c
From 48b9dbb4d9d508895f7568531d8f0a7e63261b75 Mon Sep 17 00:00:00 2001
93bb3c
From: Liang Qi <liang.qi@qt.io>
93bb3c
Date: Tue, 4 Jan 2022 12:30:36 +0100
93bb3c
Subject: [PATCH] client: set_constraint_adjustment() for popups in xdg
93bb3c
93bb3c
See also https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml#n234 .
93bb3c
93bb3c
Kudos to Greg V for his original patch in jira.
93bb3c
93bb3c
Fixes: QTBUG-87303
93bb3c
Pick-to: 5.15 6.2 6.3
93bb3c
Done-with: Greg V <greg@unrelenting.technology>
93bb3c
Change-Id: I57df9aedea7cc6f0b6fa142a6fc6c3bdc98324c8
93bb3c
Reviewed-by: David Edmundson <davidedmundson@kde.org>
93bb3c
(cherry picked from commit 59a5fe99e1569421b920d99c5b20cdafcdcf43a9)
93bb3c
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
93bb3c
index 1c76294..3b99c4b 100644
93bb3c
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
93bb3c
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
93bb3c
@@ -410,6 +410,13 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
93bb3c
     positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left);
93bb3c
     positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right);
93bb3c
     positioner->set_size(m_window->geometry().width(), m_window->geometry().height());
93bb3c
+    const QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP");
93bb3c
+    if (currentDesktop != QByteArray("KDE")) {
93bb3c
+        positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x
93bb3c
+            | QtWayland::xdg_positioner::constraint_adjustment_slide_y
93bb3c
+            | QtWayland::xdg_positioner::constraint_adjustment_flip_x
93bb3c
+            | QtWayland::xdg_positioner::constraint_adjustment_flip_y);
93bb3c
+    }
93bb3c
     m_popup = new Popup(this, parentXdgSurface, positioner);
93bb3c
     positioner->destroy();
93bb3c
     delete positioner;