bool autoResize, const UString &rHelp,
VarBool *pVisible ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_rLayout( rLayout ),
- m_bAutoResize( autoResize), m_xShift( 0 ), m_yShift( 0 ),
- m_bIsUseable( false), m_pVoutWindow( NULL )
+ m_bAutoResize( autoResize ), m_xShift( 0 ), m_yShift( 0 ),
+ m_pVoutWindow( NULL )
{
VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
rFullscreen.addObserver( this );
CtrlGeneric::setLayout( pLayout, rPosition );
m_pLayout->getActiveVar().addObserver( this );
- m_bIsUseable = isVisible() && m_pLayout->getActiveVar().get();
-
// register Video Control
VoutManager::instance( getIntf() )->registerCtrlVideo( this );
msg_Dbg( getIntf(),"New VideoControl detected(%p), useability=%s",
- this, m_bIsUseable ? "true" : "false" );
+ this, isUseable() ? "true" : "false" );
}
rFullscreen.get() );
}
- m_bIsUseable = isVisible() &&
- m_pLayout->getActiveVar().get() &&
- !rFullscreen.get();
-
- if( m_bIsUseable && !isUsed() )
+ if( isUseable() && !isUsed() )
{
VoutManager::instance( getIntf() )->requestVout( this );
}
- else if( !m_bIsUseable && isUsed() )
+ else if( !isUseable() && isUsed() )
{
VoutManager::instance( getIntf() )->discardVout( this );
}
m_pVoutWindow = NULL;
}
+
+bool CtrlVideo::isUseable( ) const
+{
+ VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+
+ return isVisible() && // video control is visible
+ m_pLayout->isVisible() && // layout is visible
+ !rFullscreen.get(); // fullscreen is off
+}
+
+
+bool CtrlVideo::isUsed( ) const
+{
+ return m_pVoutWindow ? true : false;
+}
// resize the video Control
virtual void resizeControl( int width, int height );
- // Is this control useable (visibility requirements)
- virtual bool isUseable() { return m_bIsUseable; }
+ // Is this control usable (visibility requirements)
+ virtual bool isUseable() const;
// Is this control used
- virtual bool isUsed() { return m_pVoutWindow ? true : false; }
+ virtual bool isUsed() const;
private:
/// Associated layout
/// Difference between layout size and video size
int m_xShift, m_yShift;
- /// Is the video Control useable
- bool m_bIsUseable;
-
/// Vout window
VoutWindow *m_pVoutWindow;
};
CtrlVideo* VoutManager::getBestCtrlVideo( )
{
- // try to find an unused useable VideoControl
-
vector<CtrlVideo*>::const_iterator it;
+
+ // first, look up a video control that is visible and unused
for( it = m_pCtrlVideoVec.begin(); it != m_pCtrlVideoVec.end(); ++it )
{
if( (*it)->isUseable() && !(*it)->isUsed() )
}
}
+ // as a fallback, look up any video control that is unused
+ for( it = m_pCtrlVideoVec.begin(); it != m_pCtrlVideoVec.end(); ++it )
+ {
+ if( !(*it)->isUsed() )
+ {
+ return (*it);
+ }
+ }
+
return NULL;
}