]> git.sesse.net Git - vlc/commitdiff
Fixed fullscreen on exit (the embedded video can live longer than QT
authorLaurent Aimar <fenrir@videolan.org>
Sat, 2 Aug 2008 15:02:20 +0000 (17:02 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 2 Aug 2008 15:02:20 +0000 (17:02 +0200)
interface.)

modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/main_interface.cpp

index 6ce1adbc6ab55e759b7c529e320a488cb39536b4..fa5bbc22bcd7815267f9f69d782fb504180f6c04 100644 (file)
@@ -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;
+    }
 }
 
 /**
index 3c0a880d7818a3e2a185af8dcb83af19f30bf83e..30613f0443580f9e4ce77457ebc4e72ee3d0477a 100644 (file)
@@ -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;
index 880f8ce8057dbf79d0cd03f714823f54c1094ad9..defd89d1100e05736a75fc656977127e35a40f95 100644 (file)
@@ -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 );
     }
index 0ee6864c308b03d84955c1c9fc91552e2b4fed1e..8ac5ed54626f68d5e7a0eab9bbdb9553ec79fe54 100644 (file)
@@ -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 );
 }