[vlc-devel] commit: Fixed fullscreen on exit ( the embedded video can live longer than QT (Laurent Aimar )

git version control git at videolan.org
Sat Aug 2 17:02:06 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Aug  2 17:02:20 2008 +0200| [bc83685c2acc7181e7f49bc9b4c2ec17655c789c] | committer: Laurent Aimar 

Fixed fullscreen on exit (the embedded video can live longer than QT
interface.)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bc83685c2acc7181e7f49bc9b4c2ec17655c789c
---

 modules/gui/qt4/components/interface_widgets.cpp |   23 ++++++++++++++-------
 modules/gui/qt4/components/interface_widgets.hpp |    4 ++-
 modules/gui/qt4/input_manager.cpp                |    1 +
 modules/gui/qt4/main_interface.cpp               |    2 +-
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 6ce1adb..fa5bbc2 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -911,7 +911,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
         : ControlsWidget( _p_i, _p_mi, b_advControls, b_shiny, true ),
           i_mouse_last_x( -1 ), i_mouse_last_y( -1 ), b_mouse_over(false),
           b_slow_hide_begin(false), i_slow_hide_timeout(1),
-          b_fullscreen( false ), i_hide_timeout( 1 )
+          b_fullscreen( false ), i_hide_timeout( 1 ), p_vout(NULL)
 {
     setWindowFlags( Qt::ToolTip );
 
@@ -970,6 +970,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,
 
 FullscreenControllerWidget::~FullscreenControllerWidget()
 {
+    detachVout();
     vlc_mutex_destroy( &lock );
 }
 
@@ -1197,9 +1198,11 @@ static int FullscreenControllerWidgetMouseMoved( vlc_object_t *vlc_object, const
 /**
  * It is called when video start
  */
-void FullscreenControllerWidget::attachVout( vout_thread_t *p_vout )
+void FullscreenControllerWidget::attachVout( vout_thread_t *p_nvout )
 {
-    assert( p_vout );
+    assert( p_nvout && !p_vout );
+
+    p_vout = p_nvout;
 
     vlc_mutex_lock( &lock );
     var_AddCallback( p_vout, "fullscreen", FullscreenControllerWidgetFullscreenChanged, this ); /* I miss a add and fire */
@@ -1209,14 +1212,18 @@ void FullscreenControllerWidget::attachVout( vout_thread_t *p_vout )
 /**
  * It is called after turn off video.
  */
-void FullscreenControllerWidget::detachVout( vout_thread_t *p_vout )
+void FullscreenControllerWidget::detachVout()
 {
     assert( p_vout );
 
-    var_DelCallback( p_vout, "fullscreen", FullscreenControllerWidgetFullscreenChanged, this );
-    vlc_mutex_lock( &lock );
-    fullscreenChanged( p_vout, false, 0 );
-    vlc_mutex_unlock( &lock );
+    if( p_vout )
+    {
+        var_DelCallback( p_vout, "fullscreen", FullscreenControllerWidgetFullscreenChanged, this );
+        vlc_mutex_lock( &lock );
+        fullscreenChanged( p_vout, false, 0 );
+        vlc_mutex_unlock( &lock );
+        p_vout = NULL;
+    }
 }
 
 /**
diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp
index 3c0a880..30613f0 100644
--- a/modules/gui/qt4/components/interface_widgets.hpp
+++ b/modules/gui/qt4/components/interface_widgets.hpp
@@ -247,7 +247,7 @@ public:
 
     /* */
     void attachVout( vout_thread_t *p_vout );
-    void detachVout( vout_thread_t *p_vout );
+    void detachVout();
     void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
 
 protected:
@@ -288,6 +288,8 @@ private:
 
     virtual void customEvent( QEvent *event );
 
+    vout_thread_t *p_vout;
+
     /* Shared variable between FSC and VLC (protected by a lock) */
     vlc_mutex_t lock;
     bool        b_fullscreen;
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 880f8ce..defd89d 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -414,6 +414,7 @@ void InputManager::sectionMenu()
 {
     if( hasInput() )
     {
+        // FIXME we should not assume that but probably find the entry named "Root" in "title 0"
         vlc_value_t val; val.i_int = 2;
         var_Set( p_input, "title  0", val );
     }
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 0ee6864..8ac5ed5 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -692,7 +692,7 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
 
 void MainInterface::releaseVideo( vout_thread_t *p_vout, void *p_win )
 {
-    if( fullscreenControls ) fullscreenControls->detachVout( p_vout );
+    if( fullscreenControls ) fullscreenControls->detachVout();
     emit askReleaseVideo( p_win );
 }
 




More information about the vlc-devel mailing list