]> git.sesse.net Git - vlc/commitdiff
skins2: new fullscreen implementation (currently intended for Linux)
authorErwan Tulou <erwan10@videolan.org>
Tue, 15 Dec 2009 08:32:31 +0000 (09:32 +0100)
committerErwan Tulou <erwan10@videolan.org>
Tue, 15 Dec 2009 17:08:08 +0000 (18:08 +0100)
modules/gui/skins2/controls/ctrl_video.cpp
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vlcproc.hpp
modules/gui/skins2/src/vout_manager.cpp
modules/gui/skins2/src/vout_window.cpp

index cd346c03022b1bab0afe95c13e6a6f191b412c0f..3fe0fd8b4c0c39a4bd02025f8a8ab9556a216b16 100644 (file)
@@ -45,6 +45,9 @@ CtrlVideo::CtrlVideo( intf_thread_t *pIntf, GenericLayout &rLayout,
         VarBox &rVoutSize = VlcProc::instance( pIntf )->getVoutSizeVar();
         rVoutSize.addObserver( this );
     }
+
+    VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+    rFullscreen.addObserver( this );
 }
 
 
@@ -53,6 +56,9 @@ CtrlVideo::~CtrlVideo()
     VarBox &rVoutSize = VlcProc::instance( getIntf() )->getVoutSizeVar();
     rVoutSize.delObserver( this );
 
+    VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+    rFullscreen.delObserver( this );
+
     //m_pLayout->getActiveVar().delObserver( this );
 }
 
@@ -167,7 +173,16 @@ void CtrlVideo::onUpdate( Subject<VarBool> &rVariable, void *arg  )
                       m_pLayout->getActiveVar().get() );
     }
 
-    m_bIsUseable = isVisible() && m_pLayout->getActiveVar().get();
+    VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+    if( &rVariable == &rFullscreen )
+    {
+        msg_Dbg( getIntf(), "VideoCtrl : fullscreen toggled (fullscreen = %d)",
+                      rFullscreen.get() );
+    }
+
+    m_bIsUseable = isVisible() &&
+                   m_pLayout->getActiveVar().get() &&
+                   !rFullscreen.get();
 
     if( m_bIsUseable && !isUsed() )
     {
index c8dacf7108ae78557281bd6a49cb35a2ea431b5c..daf6d96f7302447420cc6d27f74d79ddc4badcaa 100644 (file)
@@ -770,6 +770,11 @@ void VlcProc::update_equalizer()
     SET_BOOL( m_cVarEqualizer, b_equalizer );
 }
 
+void VlcProc::setFullscreenVar( bool b_fullscreen )
+{
+    SET_BOOL( m_cVarFullscreen, b_fullscreen );
+}
+
 #undef  SET_BOOL
 #undef  SET_STREAMTIME
 #undef  SET_TEXT
index fd4caa4ec5925553d02eae8ef493344710b0048f..ff849d2138739a90ad27f773d7e1ba1f9b30caaf 100644 (file)
@@ -84,6 +84,10 @@ public:
     /// Getter for the vout size variable
     VarBox &getVoutSizeVar() { return m_varVoutSize; }
 
+    /// Getter/Setter for the fullscreen variable
+    VarBool &getFullscreenVar() { return *((VarBool*)(m_cVarFullscreen.get())); }
+    void setFullscreenVar( bool );
+
     /// Indicate whether the embedded video output is currently used
     bool isVoutUsed() const { return m_pVout != NULL; }
 
index 12cbf176534f8e424f46df93f9717b58228fd03e..3ff078d53e09a5176ef940525ecd91d1607f7b4a 100644 (file)
@@ -60,6 +60,13 @@ VoutManager::VoutManager( intf_thread_t *pIntf ): SkinObject( pIntf ),
      m_pCtrlVideoVecBackup(), m_SavedWndVec()
 {
     m_pVoutMainWindow = new VoutMainWindow( getIntf() );
+
+    OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+    int width = pOsFactory->getScreenWidth();
+    int height = pOsFactory->getScreenHeight();
+
+    m_pVoutMainWindow->move( 0, 0 );
+    m_pVoutMainWindow->resize( width, height );
 }
 
 
@@ -256,19 +263,18 @@ 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 (%d) received from vout thread",
+                    b_fullscreen ? 1 : 0 );
 
-   vector<SavedWnd>::iterator it;
-   for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
-   {
-       if( (*it).pWnd == pWnd )
-       {
-           VoutWindow* pVoutWindow = (*it).pVoutWindow;
+    VlcProc::instance( getIntf() )->setFullscreenVar( b_fullscreen );
 
-           pVoutWindow->setFullscreen( b_fullscreen );
-           break;
-       }
+    if( b_fullscreen )
+    {
+        m_pVoutMainWindow->show();
+    }
+    else
+    {
+        m_pVoutMainWindow->hide();
     }
 }
 
index 0bb52354b71c4f117e1f6bb6cbccf68efa21edc0..fab916b314a79796258392386baba161c131361a 100644 (file)
@@ -77,9 +77,11 @@ void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
     }
     else
     {
-        hide();
+        int w = VoutManager::instance( getIntf() )->getVoutMainWindow()->getWidth();
+        int h = VoutManager::instance( getIntf() )->getVoutMainWindow()->getHeight();
+
         setParent( VoutManager::instance( getIntf() )->getVoutMainWindow(),
-                   0, 0, 0, 0 );
+                   0, 0, w, h );
         m_pParentWindow =
                   VoutManager::instance( getIntf() )->getVoutMainWindow();
     }