[vlc-commits] skins2: fix video not properly tied to the right video control
Erwan Tulou
git at videolan.org
Mon Apr 1 23:40:47 CEST 2013
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Apr 1 22:33:23 2013 +0200| [2f0e36e709a09d3e2476538262169721eaac0715] | committer: 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)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2f0e36e709a09d3e2476538262169721eaac0715
---
modules/gui/skins2/controls/ctrl_video.cpp | 31 ++++++++++++++++++----------
modules/gui/skins2/controls/ctrl_video.hpp | 9 +++-----
modules/gui/skins2/src/generic_layout.hpp | 3 +++
modules/gui/skins2/src/vout_manager.cpp | 13 ++++++++++--
4 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/modules/gui/skins2/controls/ctrl_video.cpp b/modules/gui/skins2/controls/ctrl_video.cpp
index 2ed026b..7c9dcae 100644
--- a/modules/gui/skins2/controls/ctrl_video.cpp
+++ b/modules/gui/skins2/controls/ctrl_video.cpp
@@ -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;
+}
diff --git a/modules/gui/skins2/controls/ctrl_video.hpp b/modules/gui/skins2/controls/ctrl_video.hpp
index 1b5d37d..03e34d9 100644
--- a/modules/gui/skins2/controls/ctrl_video.hpp
+++ b/modules/gui/skins2/controls/ctrl_video.hpp
@@ -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;
};
diff --git a/modules/gui/skins2/src/generic_layout.hpp b/modules/gui/skins2/src/generic_layout.hpp
index fb83d69..745dfae 100644
--- a/modules/gui/skins2/src/generic_layout.hpp
+++ b/modules/gui/skins2/src/generic_layout.hpp
@@ -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
diff --git a/modules/gui/skins2/src/vout_manager.cpp b/modules/gui/skins2/src/vout_manager.cpp
index 23cb909..301731b 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -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;
}
More information about the vlc-commits
mailing list