]> git.sesse.net Git - vlc/commitdiff
skins2: fix fullscreen issue (black screen when video terminates).
authorErwan Tulou <erwan10@videolan.org>
Sun, 18 Jul 2010 18:27:13 +0000 (20:27 +0200)
committerErwan Tulou <erwan10@videolan.org>
Sun, 18 Jul 2010 20:59:51 +0000 (22:59 +0200)
fullscreen is now managed (activation and deactivation) in skins2
 exactly as it is done in qt4.
    - activation when a VOUT_WINDOW_SETFULLSCREEN is received
    - deactivation when (and only when) a vout_window release is received.

modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vout_manager.cpp
modules/gui/skins2/src/vout_manager.hpp

index bdbeb49c832b92507ad49297e58c279848821a99..78f58c7f399c45761b62c6e36771871a7a9be0a3 100644 (file)
@@ -486,11 +486,7 @@ void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
             vout_thread_t* pVout = input_GetVout( pInput );
             SET_BOOL( m_cVarHasVout, pVout != NULL );
             if( pVout )
-            {
-                SET_BOOL( m_cVarFullscreen,
-                                         var_GetBool( pVout, "fullscreen" ) );
                 vlc_object_release( pVout );
-            }
             break;
         }
 
@@ -700,7 +696,6 @@ void VlcProc::reset_input()
     SET_BOOL( m_cVarRecordable, false );
     SET_BOOL( m_cVarRecording, false );
     SET_BOOL( m_cVarDvdActive, false );
-    SET_BOOL( m_cVarFullscreen, false );
     SET_BOOL( m_cVarHasAudio, false );
     SET_BOOL( m_cVarHasVout, false );
     SET_BOOL( m_cVarStopped, true );
index 86bd5e1e9c530ab7eaabb993e77c5927239db6f4..fd38c846dbbc581390772ea12e37112630b8296b 100644 (file)
@@ -69,11 +69,17 @@ VoutManager::VoutManager( intf_thread_t *pIntf ): SkinObject( pIntf ),
 
     m_pVoutMainWindow->move( 0, 0 );
     m_pVoutMainWindow->resize( width, height );
+
+    VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+    rFullscreen.addObserver( this );
 }
 
 
 VoutManager::~VoutManager( )
 {
+    VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+    rFullscreen.delObserver( this );
+
     delete m_pVoutMainWindow;
 }
 
@@ -249,6 +255,9 @@ void VoutManager::releaseWnd( vout_window_t *pWnd )
             break;
         }
     }
+
+    // force fullscreen to false so that user regains control
+    VlcProc::instance( getIntf() )->setFullscreenVar( false );
 }
 
 
@@ -277,23 +286,29 @@ void VoutManager::setSizeWnd( vout_window_t *pWnd, int width, int height )
    }
 }
 
+
 void VoutManager::setFullscreenWnd( vout_window_t *pWnd, bool b_fullscreen )
 {
-    msg_Dbg( pWnd, "setFullscreen (%d) received from vout thread",
-                    b_fullscreen ? 1 : 0 );
+    msg_Dbg( pWnd, "setFullscreen (%i) received from vout thread",
+                   b_fullscreen );
 
     VlcProc::instance( getIntf() )->setFullscreenVar( b_fullscreen );
+}
 
-    if( b_fullscreen )
-    {
-        m_pVoutMainWindow->show();
-    }
-    else
+
+void VoutManager::onUpdate( Subject<VarBool> &rVariable, void *arg  )
+{
+    VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+    if( &rVariable == &rFullscreen )
     {
-        m_pVoutMainWindow->hide();
+        if( rFullscreen.get() )
+            m_pVoutMainWindow->show();
+        else
+            m_pVoutMainWindow->hide();
     }
 }
 
+
 // Functions called by window provider
 // ///////////////////////////////////
 
index 095f25c2d522aad27dda50dce68a5923ee4696fa..643af52cd8d9451db696d942f55a1951ccc48027 100644 (file)
@@ -91,7 +91,7 @@ public:
 
 
 /// Singleton object handling VLC internal state and playlist
-class VoutManager: public SkinObject
+class VoutManager: public SkinObject, public Observer<VarBool>
 {
 public:
     /// Get the instance of VoutManager
@@ -146,6 +146,9 @@ public:
     // test if vout are running
     bool hasVout() { return ( m_SavedWndVec.size() != 0 ) ; }
 
+    /// called when fullscreen variable changed
+    virtual void onUpdate( Subject<VarBool> &rVariable , void* );
+
 protected:
     // Protected because it is a singleton
     VoutManager( intf_thread_t *pIntf );