From e1369ec7b36472a0cdc15a93b010cccb3ab32378 Mon Sep 17 00:00:00 2001
From: Fatih Uzunoglu <fuzun54@outlook.com>
Date: Thu, 3 Apr 2025 17:58:35 +0300
Subject: [PATCH 1/3] qml: make tracks menu popup non-modal

---
 modules/gui/qt/player/qml/TracksMenu.qml | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/modules/gui/qt/player/qml/TracksMenu.qml b/modules/gui/qt/player/qml/TracksMenu.qml
index 25511cda95d8..a98beebc492f 100644
--- a/modules/gui/qt/player/qml/TracksMenu.qml
+++ b/modules/gui/qt/player/qml/TracksMenu.qml
@@ -40,10 +40,6 @@ T.Popup {
 
     height: VLCStyle.dp(296, VLCStyle.scale)
 
-    // Popup.CloseOnPressOutside doesn't work with non-model Popup on Qt < 5.15
-    closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
-    modal: true
-
     // Animations
 
     Behavior on width {
@@ -60,8 +56,6 @@ T.Popup {
         colorSet: ColorContext.Window
     }
 
-    T.Overlay.modal: null
-
     background: Rectangle {
         // NOTE: The opacity should be stronger on a light background for readability.
         color: popupTheme.bg.primary.alpha(popupTheme.palette.isDark ? 0.8 : 0.96)
-- 
GitLab


From 88efbb182156d39b2da83542212127f148a41757 Mon Sep 17 00:00:00 2001
From: Fatih Uzunoglu <fuzun54@outlook.com>
Date: Thu, 3 Apr 2025 17:59:03 +0300
Subject: [PATCH 2/3] qml: make icon tool button popup non-modal

---
 modules/gui/qt/widgets/qml/PopupIconToolButton.qml | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/modules/gui/qt/widgets/qml/PopupIconToolButton.qml b/modules/gui/qt/widgets/qml/PopupIconToolButton.qml
index b0f1be904acd..95dacd3c3f12 100644
--- a/modules/gui/qt/widgets/qml/PopupIconToolButton.qml
+++ b/modules/gui/qt/widgets/qml/PopupIconToolButton.qml
@@ -77,13 +77,6 @@ Widgets.IconToolButton {
         // Setting margins to >=0 makes it sure that this is satisfied.
         margins: MainCtx.windowExtendedMargin
 
-        modal: true
-
-        // NOTE: Popup.CloseOnPressOutside doesn't work with non-model Popup on Qt < 5.15.
-        closePolicy: (Popup.CloseOnPressOutside | Popup.CloseOnEscape)
-
-        Overlay.modal: null
-
         // Events
 
         onOpened: {
-- 
GitLab


From 9785fcdc0b72043d8df84920d1c793a511b08036 Mon Sep 17 00:00:00 2001
From: Fatih Uzunoglu <fuzun54@outlook.com>
Date: Thu, 3 Apr 2025 18:01:46 +0300
Subject: [PATCH 3/3] qt: fix popups do not close on press outside with
 `CompositorX11`

---
 .../compositor_x11_uisurface.cpp              | 24 ++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/maininterface/compositor_x11_uisurface.cpp b/modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
index a3b9b3f0a723..50827d985ecc 100644
--- a/modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
+++ b/modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
@@ -326,7 +326,29 @@ static void remapInputMethodQueryEvent(QObject *object, QInputMethodQueryEvent *
 
 bool CompositorX11UISurface::eventFilter(QObject*, QEvent *event)
 {
-    switch (event->type())
+    assert(event);
+    const auto type = event->type();
+    switch (type)
+    {
+    case QEvent::TouchBegin:
+    case QEvent::TouchCancel:
+    case QEvent::TouchEnd:
+    // case QEvent::TouchUpdate:
+    // case QEvent::MouseMove:
+    case QEvent::MouseButtonPress:
+    case QEvent::MouseButtonDblClick:
+    case QEvent::MouseButtonRelease:
+    {
+        // FIXME: This is not nice, but offscreen window is not nice anyway and without it
+        //        popups do not close with press outside.
+        const auto overlay = m_uiWindow->property("_q_QQuickOverlay").value<QQuickItem*>();
+        if (overlay && overlay->isVisible())
+            QCoreApplication::sendEvent(overlay, event);
+    }
+    default: break;
+    }
+
+    switch (type)
     {
 
     case QEvent::Move:
-- 
GitLab