Rémi Denis-Courmont pushed to branch 3.0.x at VideoLAN / VLC


Commits:
8924d194 by Rémi Denis-Courmont at 2022-06-24T20:03:50+00:00
qt: remove write-only field

- - - - -
958be95e by Rémi Denis-Courmont at 2022-06-24T20:03:50+00:00
qt: add flag to orphan the video

The video widget is normally released when the window provider is
closed. But it can also be released when the main UI is closed, even
though the window provider is still active.

- - - - -
327a9cf0 by Rémi Denis-Courmont at 2022-06-24T20:03:50+00:00
qt: do not normally reparent the video

When the video window is closed normally, there are no needs to
reparent it. In this case, we can retain the pre-3.0.13 behaviour
whence we simply close the video window as a children of the Qt UI.

This fixes a transient visual glitch when stopping playback or
disabling the video track. This also saves one full round-trip through
the X server at that time as XSync().

- - - - -


5 changed files:

- modules/gui/qt/components/interface_widgets.cpp
- modules/gui/qt/components/interface_widgets.hpp
- modules/gui/qt/main_interface.cpp
- modules/gui/qt/main_interface.hpp
- modules/gui/qt/qt.cpp


Changes:

=====================================
modules/gui/qt/components/interface_widgets.cpp
=====================================
@@ -231,7 +231,7 @@ QSize VideoWidget::physicalSize() const
 }
 
 void WindowResized(vout_window_t *, const QSize&);
-void WindowReleased(vout_window_t *);
+void WindowOrphaned(vout_window_t *);
 
 void VideoWidget::reportSize()
 {
@@ -402,13 +402,14 @@ void VideoWidget::mouseDoubleClickEvent( QMouseEvent 
*event )
 }
 
 
-void VideoWidget::release( void )
+void VideoWidget::release( bool forced )
 {
-    msg_Dbg( p_intf, "Video is not needed anymore" );
+    msg_Dbg( p_intf, "video widget is %s", forced ? "orphaned" : "released" );
 
     if( stable )
     {
-        WindowReleased(p_window);
+        if( forced )
+            WindowOrphaned(p_window);
         layout->removeWidget( stable );
         stable->deleteLater();
         stable = NULL;


=====================================
modules/gui/qt/components/interface_widgets.hpp
=====================================
@@ -60,7 +60,7 @@ public:
     virtual ~VideoWidget();
 
     bool request( struct vout_window_t * );
-    void release( void );
+    void release( bool forced );
     void sync( void );
 
 protected:


=====================================
modules/gui/qt/main_interface.cpp
=====================================
@@ -205,8 +205,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : 
QVLCMW( _p_intf )
     connect( this, SIGNAL(askGetVideo(struct vout_window_t*, unsigned, 
unsigned, bool, bool*)),
              this, SLOT(getVideoSlot(struct vout_window_t*, unsigned, 
unsigned, bool, bool*)),
              Qt::BlockingQueuedConnection );
-    connect( this, SIGNAL(askReleaseVideo( void )),
-             this, SLOT(releaseVideoSlot( void )),
+    connect( this, SIGNAL(askReleaseVideo( bool )),
+             this, SLOT(releaseVideoSlot( bool )),
              Qt::BlockingQueuedConnection );
     CONNECT( this, askVideoOnTop(bool), this, setVideoOnTop(bool));
 
@@ -274,7 +274,7 @@ MainInterface::~MainInterface()
         showTab( bgWidget );
 
     if( videoWidget )
-        releaseVideoSlot();
+        releaseVideoSlot(true);
 
     /* Be sure to kill the actionsManager... Only used in the MI and control */
     ActionsManager::killInstance();
@@ -771,17 +771,17 @@ void MainInterface::getVideoSlot( struct vout_window_t 
*p_wnd,
 /* Asynchronous call from the WindowClose function */
 void MainInterface::releaseVideo( void )
 {
-    emit askReleaseVideo();
+    emit askReleaseVideo(false);
 }
 
 /* Function that is CONNECTED to the previous emit */
-void MainInterface::releaseVideoSlot( void )
+void MainInterface::releaseVideoSlot( bool forced )
 {
     /* This function is called when the embedded video window is destroyed,
      * or in the rare case that the embedded window is still here but the
      * Qt interface exits. */
     assert( videoWidget );
-    videoWidget->release();
+    videoWidget->release( forced );
     setVideoOnTop( false );
     setVideoFullScreen( false );
     hideResumePanel();
@@ -1674,7 +1674,7 @@ void MainInterface::closeEvent( QCloseEvent *e )
     if ( b_minimalView )
         setMinimalView( false );
     if( videoWidget )
-        releaseVideoSlot();
+        releaseVideoSlot( true );
     emit askToQuit(); /* ask THEDP to quit, so we have a unique method */
     /* Accept session quit. Otherwise we break the desktop mamager. */
     e->accept();


=====================================
modules/gui/qt/main_interface.hpp
=====================================
@@ -217,7 +217,7 @@ public slots:
     /* Manage the Video Functions from the vout threads */
     void getVideoSlot( struct vout_window_t *,
                        unsigned i_width, unsigned i_height, bool, bool * );
-    void releaseVideoSlot( void );
+    void releaseVideoSlot( bool forced );
 
     void emitBoss();
     void emitRaise();
@@ -270,7 +270,7 @@ protected slots:
 signals:
     void askGetVideo( struct vout_window_t *, unsigned, unsigned, bool,
                       bool * );
-    void askReleaseVideo( );
+    void askReleaseVideo( bool );
     void askVideoToResize( unsigned int, unsigned int );
     void askVideoSetFullScreen( bool );
     void askHideMouse( bool );


=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -714,7 +714,6 @@ typedef struct {
 #ifdef QT5_HAS_X11
     Display *dpy;
 #endif
-    bool orphaned;
     QMutex lock;
 } vout_window_qt_t;
 
@@ -750,7 +749,6 @@ static int WindowOpen( vout_window_t *p_wnd, const 
vout_window_cfg_t *cfg )
     vout_window_qt_t *sys = new vout_window_qt_t;
 
     sys->mi = p_intf->p_sys->p_mi;
-    sys->orphaned = false;
     p_wnd->sys = (vout_window_sys_t *)sys;
     msg_Dbg( p_wnd, "requesting video window..." );
 
@@ -828,13 +826,12 @@ static int WindowControl( vout_window_t *p_wnd, int 
i_query, va_list args )
     return sys->mi->controlVideo(i_query, args);
 }
 
-void WindowReleased(vout_window_t *wnd)
+void WindowOrphaned(vout_window_t *wnd)
 {
     vout_window_qt_t *sys = (vout_window_qt_t *)wnd->sys;
     QMutexLocker locker(&sys->lock);
 
     msg_Warn(wnd, "orphaned video window");
-    sys->orphaned = true;
 #if defined (QT5_HAS_X11)
     if (QX11Info::isPlatformX11())
     {   /* In the unlikely event that WindowOpen() has not yet reparented the



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/68e5d977277f874861916286b4dcc58535a9f7a0...327a9cf0300232d298be89887fa321b883f27a67

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/68e5d977277f874861916286b4dcc58535a9f7a0...327a9cf0300232d298be89887fa321b883f27a67
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to