From 7c51e98a6b685f6d172ef817b47ff672ce73056e Mon Sep 17 00:00:00 2001 From: Erwan Tulou Date: Wed, 24 Feb 2010 10:36:45 +0100 Subject: [PATCH] skins2: add support for --[no]-video-on-top (fix #685) --- modules/gui/skins2/commands/cmd_on_top.cpp | 5 +++++ modules/gui/skins2/commands/cmd_on_top.hpp | 14 ++++++++++++++ modules/gui/skins2/src/vout_manager.cpp | 18 ++++++++++++++++++ modules/gui/skins2/src/window_manager.cpp | 16 ++++++++++++---- modules/gui/skins2/src/window_manager.hpp | 3 +++ 5 files changed, 52 insertions(+), 4 deletions(-) diff --git a/modules/gui/skins2/commands/cmd_on_top.cpp b/modules/gui/skins2/commands/cmd_on_top.cpp index 7783426a5c..54cc640129 100644 --- a/modules/gui/skins2/commands/cmd_on_top.cpp +++ b/modules/gui/skins2/commands/cmd_on_top.cpp @@ -31,3 +31,8 @@ void CmdOnTop::execute() { getIntf()->p_sys->p_theme->getWindowManager().toggleOnTop(); } + +void CmdSetOnTop::execute() +{ + getIntf()->p_sys->p_theme->getWindowManager().setOnTop( m_ontop ); +} diff --git a/modules/gui/skins2/commands/cmd_on_top.hpp b/modules/gui/skins2/commands/cmd_on_top.hpp index 6537370559..458ae3cff9 100644 --- a/modules/gui/skins2/commands/cmd_on_top.hpp +++ b/modules/gui/skins2/commands/cmd_on_top.hpp @@ -31,4 +31,18 @@ /// "Always on top" command 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 diff --git a/modules/gui/skins2/src/vout_manager.cpp b/modules/gui/skins2/src/vout_manager.cpp index 02ed43ca88..5e6eeaad81 100644 --- a/modules/gui/skins2/src/vout_manager.cpp +++ b/modules/gui/skins2/src/vout_manager.cpp @@ -26,6 +26,7 @@ #endif #include +#include #include "vout_manager.hpp" #include "window_manager.hpp" @@ -34,6 +35,7 @@ #include "../commands/cmd_show_window.hpp" #include "../commands/cmd_resize.hpp" #include "../commands/cmd_voutwindow.hpp" +#include "../commands/cmd_on_top.hpp" @@ -375,6 +377,22 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd, 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: msg_Dbg( pWnd, "control query not supported" ); return VLC_EGENERIC; diff --git a/modules/gui/skins2/src/window_manager.cpp b/modules/gui/skins2/src/window_manager.cpp index ed01b0612b..d2c8b8ea43 100644 --- a/modules/gui/skins2/src/window_manager.cpp +++ b/modules/gui/skins2/src/window_manager.cpp @@ -439,21 +439,29 @@ void WindowManager::hideAll() const } -void WindowManager::toggleOnTop() +void WindowManager::setOnTop( bool b_ontop ) { // Update the boolean variable 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; 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, TopWindow *pWindow ) { diff --git a/modules/gui/skins2/src/window_manager.hpp b/modules/gui/skins2/src/window_manager.hpp index 6a689f199e..8f1ba64bbf 100644 --- a/modules/gui/skins2/src/window_manager.hpp +++ b/modules/gui/skins2/src/window_manager.hpp @@ -126,6 +126,9 @@ public: /// Hide the given window 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 void toggleOnTop(); -- 2.39.2