[vlc-devel] commit: skins2: add support for --[no]-video-on-top (fix #685) ( Erwan Tulou )

git version control git at videolan.org
Wed Feb 24 10:50:54 CET 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Feb 24 10:36:45 2010 +0100| [7c51e98a6b685f6d172ef817b47ff672ce73056e] | committer: Erwan Tulou 

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7c51e98a6b685f6d172ef817b47ff672ce73056e
---

 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 7783426..54cc640 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 6537370..458ae3c 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 02ed43c..5e6eeaa 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -26,6 +26,7 @@
 #endif
 
 #include <vlc_vout.h>
+#include <vlc_vout_display.h>
 
 #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 ed01b06..d2c8b8e 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 6a689f1..8f1ba64 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();
 




More information about the vlc-devel mailing list