Commit 7c51e98a authored by Erwan Tulou's avatar Erwan Tulou

skins2: add support for --[no]-video-on-top (fix #685)

parent 46020239
...@@ -31,3 +31,8 @@ void CmdOnTop::execute() ...@@ -31,3 +31,8 @@ void CmdOnTop::execute()
{ {
getIntf()->p_sys->p_theme->getWindowManager().toggleOnTop(); getIntf()->p_sys->p_theme->getWindowManager().toggleOnTop();
} }
void CmdSetOnTop::execute()
{
getIntf()->p_sys->p_theme->getWindowManager().setOnTop( m_ontop );
}
...@@ -31,4 +31,18 @@ ...@@ -31,4 +31,18 @@
/// "Always on top" command /// "Always on top" command
DEFINE_COMMAND( OnTop, "always on top" ) DEFINE_COMMAND( OnTop, "always on top" )
class CmdSetOnTop: public CmdGeneric
{
public:
CmdSetOnTop( intf_thread_t *pIntf, bool b_ontop )
: CmdGeneric( pIntf ), m_ontop( b_ontop ) { }
virtual ~CmdSetOnTop() { }
virtual void execute();
virtual string getType() const { return "set on top"; }
private:
bool m_ontop;
};
#endif #endif
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#endif #endif
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_vout_display.h>
#include "vout_manager.hpp" #include "vout_manager.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
#include "../commands/cmd_show_window.hpp" #include "../commands/cmd_show_window.hpp"
#include "../commands/cmd_resize.hpp" #include "../commands/cmd_resize.hpp"
#include "../commands/cmd_voutwindow.hpp" #include "../commands/cmd_voutwindow.hpp"
#include "../commands/cmd_on_top.hpp"
...@@ -375,6 +377,22 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd, ...@@ -375,6 +377,22 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
case VOUT_WINDOW_SET_STATE:
{
unsigned i_arg = va_arg( args, unsigned );
unsigned on_top = i_arg & VOUT_WINDOW_STATE_ABOVE;
// Post a SetOnTop command
CmdSetOnTop* pCmd =
new CmdSetOnTop( pThis->getIntf(), on_top );
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
pQueue->push( CmdGenericPtr( pCmd ) );
return VLC_SUCCESS;
}
default: default:
msg_Dbg( pWnd, "control query not supported" ); msg_Dbg( pWnd, "control query not supported" );
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -439,21 +439,29 @@ void WindowManager::hideAll() const ...@@ -439,21 +439,29 @@ void WindowManager::hideAll() const
} }
void WindowManager::toggleOnTop() void WindowManager::setOnTop( bool b_ontop )
{ {
// Update the boolean variable // Update the boolean variable
VarBoolImpl *pVarOnTop = (VarBoolImpl*)m_cVarOnTop.get(); VarBoolImpl *pVarOnTop = (VarBoolImpl*)m_cVarOnTop.get();
pVarOnTop->set( !pVarOnTop->get() ); pVarOnTop->set( b_ontop );
// Toggle the "on top" status // set/unset the "on top" status
WinSet_t::const_iterator it; WinSet_t::const_iterator it;
for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ ) for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )
{ {
(*it)->toggleOnTop( pVarOnTop->get() ); (*it)->toggleOnTop( b_ontop );
} }
} }
void WindowManager::toggleOnTop()
{
VarBoolImpl *pVarOnTop = (VarBoolImpl*)m_cVarOnTop.get();
setOnTop( !pVarOnTop->get() );
}
void WindowManager::buildDependSet( WinSet_t &rWinSet, void WindowManager::buildDependSet( WinSet_t &rWinSet,
TopWindow *pWindow ) TopWindow *pWindow )
{ {
......
...@@ -126,6 +126,9 @@ public: ...@@ -126,6 +126,9 @@ public:
/// Hide the given window /// Hide the given window
void hide( TopWindow &rWindow ) const { rWindow.hide(); } void hide( TopWindow &rWindow ) const { rWindow.hide(); }
/// Set/unset all the windows on top
void setOnTop( bool b_ontop );
/// Toggle all the windows on top /// Toggle all the windows on top
void toggleOnTop(); void toggleOnTop();
......
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