Commit 2f0e36e7 authored by Erwan Tulou's avatar Erwan Tulou

skins2: fix video not properly tied to the right video control

Certain skins like wmp12 may fail to deal with video controls in some
corner cases. For this skin, no window was set visible and the skin
engine eventually fell back to force the first window to become visible.

This patch is expected to fix trac #8368 (need to be tested on windows)
parent d782b421
......@@ -36,8 +36,8 @@ CtrlVideo::CtrlVideo( intf_thread_t *pIntf, GenericLayout &rLayout,
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 );
......@@ -114,13 +114,11 @@ void CtrlVideo::setLayout( GenericLayout *pLayout,
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" );
}
......@@ -187,15 +185,11 @@ void CtrlVideo::onUpdate( Subject<VarBool> &rVariable, void *arg )
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 );
}
......@@ -233,3 +227,18 @@ void CtrlVideo::detachVoutWindow( )
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;
}
......@@ -80,11 +80,11 @@ public:
// 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
......@@ -96,9 +96,6 @@ private:
/// 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;
};
......
......@@ -115,6 +115,9 @@ public:
m_original_height == otherLayout.m_original_height;
}
// getter for layout visibility
virtual bool isVisible( ) const { return m_visible; }
/**
* Add a control in the layout at the given position, and
* the optional given layer
......
......@@ -171,9 +171,9 @@ void VoutManager::requestVout( CtrlVideo* pCtrlVideo )
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() )
......@@ -182,6 +182,15 @@ CtrlVideo* VoutManager::getBestCtrlVideo( )
}
}
// 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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment