[vlc-commits] [Git][videolan/vlc][master] qt: do not hide window on close on Wayland

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Mar 2 14:00:29 UTC 2025



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
84e7e017 by Fatih Uzunoglu at 2025-03-02T13:46:34+00:00
qt: do not hide window on close on Wayland

`QWindow`'s `wl_surface` gets deleted when `QWindow::hide()`
is called.

This is an exceptional behavior, and can be considered
a bug because destroying the window resources is tied to
`QWindow::destroy()`, calling `QWindow::hide()` should not
destroy the window's resources.

- - - - -


1 changed file:

- modules/gui/qt/maininterface/interface_window_handler.cpp


Changes:

=====================================
modules/gui/qt/maininterface/interface_window_handler.cpp
=====================================
@@ -246,7 +246,18 @@ bool InterfaceWindowHandler::eventFilter(QObject*, QEvent* event)
     }
     case QEvent::Close:
     {
+#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
+        // Before Qt 6.9.0, `QWindow`'s `wl_surface` gets deleted when `QWindow::hide()` is called.
+        static bool platformIsWayland = []() {
+            assert(qGuiApp);
+            return qGuiApp->platformName().startsWith(QLatin1String("wayland"));
+        }();
+
+        if (!platformIsWayland)
+            setInterfaceHiden();
+#else
         setInterfaceHiden();
+#endif
 
         if (var_InheritBool(p_intf, "qt-close-to-system-tray"))
         {
@@ -254,6 +265,10 @@ bool InterfaceWindowHandler::eventFilter(QObject*, QEvent* event)
             {
                 if (sysTrayIcon->isSystemTrayAvailable() && sysTrayIcon->isVisible())
                 {
+#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
+                    if (platformIsWayland)
+                        setInterfaceHiden();
+#endif
                     event->ignore();
                     return true;
                 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/84e7e01704733e380ff077011e5e428c9e0aee24

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/84e7e01704733e380ff077011e5e428c9e0aee24
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list