Commit 88fa0c4b authored by Erwan Tulou's avatar Erwan Tulou

skins2: fix a video control that fails to show up

This fixes a regression in vlc2.2. It is described on the forum at :
https://forum.videolan.org/viewtopic.php?f=15&t=125790&sid=05f4d8a32853034ce6d497ca15bab1e8

(cherry picked from commit 7a00bd9b966fe6eb615d7df1b5ff6afdd92b2d36)
Signed-off-by: default avatarErwan Tulou <erwan10@videolan.org>
parent e2c4691e
...@@ -113,6 +113,7 @@ void CtrlVideo::setLayout( GenericLayout *pLayout, ...@@ -113,6 +113,7 @@ void CtrlVideo::setLayout( GenericLayout *pLayout,
{ {
CtrlGeneric::setLayout( pLayout, rPosition ); CtrlGeneric::setLayout( pLayout, rPosition );
m_pLayout->getActiveVar().addObserver( this ); m_pLayout->getActiveVar().addObserver( this );
getWindow()->getVisibleVar().addObserver( this );
// register Video Control // register Video Control
VoutManager::instance( getIntf() )->registerCtrlVideo( this ); VoutManager::instance( getIntf() )->registerCtrlVideo( this );
...@@ -125,6 +126,7 @@ void CtrlVideo::setLayout( GenericLayout *pLayout, ...@@ -125,6 +126,7 @@ void CtrlVideo::setLayout( GenericLayout *pLayout,
void CtrlVideo::unsetLayout() void CtrlVideo::unsetLayout()
{ {
m_pLayout->getActiveVar().delObserver( this ); m_pLayout->getActiveVar().delObserver( this );
getWindow()->getVisibleVar().delObserver( this );
CtrlGeneric::unsetLayout(); CtrlGeneric::unsetLayout();
} }
...@@ -162,27 +164,28 @@ void CtrlVideo::resizeControl( int width, int height ) ...@@ -162,27 +164,28 @@ void CtrlVideo::resizeControl( int width, int height )
void CtrlVideo::onUpdate( Subject<VarBool> &rVariable, void *arg ) void CtrlVideo::onUpdate( Subject<VarBool> &rVariable, void *arg )
{ {
(void)arg; (void)arg;
VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
// Visibility changed
if( &rVariable == m_pVisible ) if( &rVariable == m_pVisible )
{ {
msg_Dbg( getIntf(), "VideoCtrl : Visibility changed (visible=%d)", msg_Dbg( getIntf(), "VideoCtrl(%p) : control visibility changed (%i)",
isVisible() ); this, isVisible() );
notifyLayout(); notifyLayout();
} }
else if( &rVariable == &m_pLayout->getActiveVar() )
// Active Layout changed
if( &rVariable == &m_pLayout->getActiveVar() )
{ {
msg_Dbg( getIntf(), "VideoCtrl : Active Layout changed (isActive=%d)", msg_Dbg( getIntf(), "VideoCtrl(%p) : Active Layout changed (%i)",
m_pLayout->getActiveVar().get() ); this, m_pLayout->getActiveVar().get() );
} }
else if( &rVariable == &getWindow()->getVisibleVar() )
VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar(); {
if( &rVariable == &rFullscreen ) msg_Dbg( getIntf(), "VideoCtrl(%p) : Window visibility changed (%i)",
this, getWindow()->getVisibleVar().get() );
}
else if( &rVariable == &rFullscreen )
{ {
msg_Dbg( getIntf(), "VideoCtrl : fullscreen toggled (fullscreen = %d)", msg_Dbg( getIntf(), "VideoCtrl(%p) : fullscreen toggled (%i)",
rFullscreen.get() ); this, rFullscreen.get() );
} }
if( isUseable() && !isUsed() ) if( isUseable() && !isUsed() )
...@@ -232,9 +235,10 @@ bool CtrlVideo::isUseable( ) const ...@@ -232,9 +235,10 @@ bool CtrlVideo::isUseable( ) const
{ {
VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar(); VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
return isVisible() && // video control is visible return isVisible() // video control is visible
m_pLayout->isVisible() && // layout is visible && m_pLayout->getActiveVar().get() // layout is active
!rFullscreen.get(); // fullscreen is off && getWindow()->getVisibleVar().get() // window is visible
&& !rFullscreen.get(); // fullscreen is off
} }
......
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