[vlc-devel] [PATCH] qt(wayland): more patches to fix video display issues

erwan.tulou at gmail.com erwan.tulou at gmail.com
Tue Dec 12 15:37:32 CET 2017


Hello,

    In addition to previously sent patches, please find attached two 
more patches to fix crash issues regarding the qt video widget.
    These patches are meant to circumvent current qt limitations in a 
Wayland context.

   - patch 1: fix crash when undocking the playlist
   - patch 2: fix crash when toggling between playlist and full video 
within the main window.

    Questions:
      - is it OK to apply them in master ?
      - is it OK to backport them in vlc 3.0 ?

Rgds
Erwan Tulou



---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
-------------- next part --------------
From 91a562449576b373e1658158dbdf1416673dde4c Mon Sep 17 00:00:00 2001
From: Erwan Tulou <erwan10 at videolan.org>
Date: Tue, 12 Dec 2017 14:06:10 +0100
Subject: [PATCH 4/5] qt(wayland): fix crash when undocking playlist

On Wayland, the native window cannot be reparented (qt destroys it)
Yet, as of today, the video widget is always kept in the main interface anyway
So just ensure relocation of the video widget occurs before exporting
the playlist widget. no functional change
---
 modules/gui/qt/main_interface.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 96591fe4f8..14587a4122 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1063,12 +1063,12 @@ void MainInterface::dockPlaylist( bool p_docked )
     if( !p_docked ) /* Previously docked */
     {
         playlistVisible = playlistWidget->isVisible();
-        stackCentralW->removeWidget( playlistWidget );
-        dialog->importPlaylistWidget( playlistWidget );
         if ( videoWidget && THEMIM->getIM()->hasVideo() )
             showTab(videoWidget);
         else
             showTab(bgWidget);
+        stackCentralW->removeWidget( playlistWidget );
+        dialog->importPlaylistWidget( playlistWidget );
         if ( playlistVisible ) dialog->show();
     }
     else /* Previously undocked */
-- 
2.15.1

-------------- next part --------------
From c5c132016e0a4cbc4d41f7d39d3c45e57278a98d Mon Sep 17 00:00:00 2001
From: Erwan Tulou <erwan10 at videolan.org>
Date: Tue, 12 Dec 2017 14:14:02 +0100
Subject: [PATCH 5/5] qt(wayland): fix crash when toggling between playlist and
 full video

On wayland, the native window cannot be hidden (qt destroys it)
So, add a hack to make sure it is never hidden.
This hack does the trick without any visible side effect.
---
 modules/gui/qt/components/interface_widgets.cpp | 19 +++++++++++++++++++
 modules/gui/qt/components/interface_widgets.hpp |  1 +
 2 files changed, 20 insertions(+)

diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp
index 98dfdebfbe..b3ce2d6ab8 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -98,6 +98,25 @@ VideoWidget::~VideoWidget()
     assert( !p_window );
 }
 
+void VideoWidget::setVisible( bool visible )
+{
+#ifdef QT5_HAS_WAYLAND
+
+    /*  On Wayland, qt destroys the stable widget native
+        window when setVisible(false) or hide() is called.
+        So, just never hide if a video is running */
+
+    if( p_window && p_window->type == VOUT_WINDOW_TYPE_WAYLAND)
+        if( !visible )
+        {
+            msg_Dbg(p_intf,"VideoWidget don't hide on Wayland");
+            return;
+        }
+#endif
+
+    QFrame::setVisible( visible );
+}
+
 void VideoWidget::sync( void )
 {
     /* Make sure the X server has processed all requests.
diff --git a/modules/gui/qt/components/interface_widgets.hpp b/modules/gui/qt/components/interface_widgets.hpp
index e56b828021..dc2cc5d36f 100644
--- a/modules/gui/qt/components/interface_widgets.hpp
+++ b/modules/gui/qt/components/interface_widgets.hpp
@@ -75,6 +75,7 @@ protected:
     void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
     void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
     void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+    void setVisible(bool) Q_DECL_OVERRIDE;
     QSize physicalSize() const;
 
 private:
-- 
2.15.1



More information about the vlc-devel mailing list