]> git.sesse.net Git - vlc/commitdiff
skins2: add support for --[no]-video-on-top (fix #685)
authorErwan Tulou <erwan10@videolan.org>
Wed, 24 Feb 2010 09:36:45 +0000 (10:36 +0100)
committerErwan Tulou <erwan10@videolan.org>
Wed, 24 Feb 2010 09:47:22 +0000 (10:47 +0100)
modules/gui/skins2/commands/cmd_on_top.cpp
modules/gui/skins2/commands/cmd_on_top.hpp
modules/gui/skins2/src/vout_manager.cpp
modules/gui/skins2/src/window_manager.cpp
modules/gui/skins2/src/window_manager.hpp

index 7783426a5c17c569d88a19aafd14f90bc1e5c21c..54cc640129563cbe7416f900e6ecd068580ab487 100644 (file)
@@ -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 );
+}
index 6537370559cf1a03c8636bbe63ac4bd84e621118..458ae3cff9821f69e52caeadef329b9d8f8f893c 100644 (file)
 /// "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
index 02ed43ca8827e4284166fce76c64193e925a7e0d..5e6eeaad81cf9b2f26f93a38e2bafff928b5d534 100644 (file)
@@ -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;
index ed01b0612b1895d5f801e3f236e09a6450905ece..d2c8b8ea437c45d4c82e5179bb457786d1648ffb 100644 (file)
@@ -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 )
 {
index 6a689f199e6be69ff4db96d1fc8367754da5f360..8f1ba64bbfd309ca0ce361d1d02b9c85e787234c 100644 (file)
@@ -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();