[vlc-commits] skins2: implement VOUT_WINDOW_HIDE_MOUSE control

Erwan Tulou git at videolan.org
Fri Jan 12 23:22:26 CET 2018


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Fri Jan 12 11:35:45 2018 +0100| [93b9f3a346e4eb954d2029053686cb44f4a36efd] | committer: Erwan Tulou

skins2: implement VOUT_WINDOW_HIDE_MOUSE control

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

 modules/gui/skins2/commands/cmd_resize.cpp |  9 +++++++++
 modules/gui/skins2/commands/cmd_resize.hpp | 15 +++++++++++++++
 modules/gui/skins2/src/os_factory.hpp      |  3 ++-
 modules/gui/skins2/src/skin_main.cpp       | 10 ++++++++++
 modules/gui/skins2/src/vout_manager.cpp    | 11 +++++++++++
 modules/gui/skins2/src/vout_manager.hpp    |  3 +++
 6 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/modules/gui/skins2/commands/cmd_resize.cpp b/modules/gui/skins2/commands/cmd_resize.cpp
index 5903b46241..6b8b378f06 100644
--- a/modules/gui/skins2/commands/cmd_resize.cpp
+++ b/modules/gui/skins2/commands/cmd_resize.cpp
@@ -66,3 +66,12 @@ void CmdSetFullscreen::execute()
 }
 
 
+CmdHideMouse::CmdHideMouse( intf_thread_t *pIntf,
+			    vout_window_t * pWnd, bool hide )
+    : CmdGeneric( pIntf ), m_pWnd( pWnd ), m_bHide( hide ) { }
+
+
+void CmdHideMouse::execute()
+{
+    getIntf()->p_sys->p_voutManager->hideMouseWnd( m_pWnd, m_bHide );
+}
diff --git a/modules/gui/skins2/commands/cmd_resize.hpp b/modules/gui/skins2/commands/cmd_resize.hpp
index c0b988b8cc..9a9d76b731 100644
--- a/modules/gui/skins2/commands/cmd_resize.hpp
+++ b/modules/gui/skins2/commands/cmd_resize.hpp
@@ -84,4 +84,19 @@ private:
     bool m_bFullscreen;
 };
 
+
+/// Command to hide mouse
+class CmdHideMouse: public CmdGeneric
+{
+public:
+    /// hide the mouse
+    CmdHideMouse( intf_thread_t *pIntf, vout_window_t* pWnd, bool hide );
+    virtual ~CmdHideMouse() { }
+    virtual void execute();
+    virtual std::string getType() const { return "hide mouse"; }
+
+private:
+    vout_window_t* m_pWnd;
+    bool m_bHide;
+};
 #endif
diff --git a/modules/gui/skins2/src/os_factory.hpp b/modules/gui/skins2/src/os_factory.hpp
index 5095a4e515..3aff7ba2c3 100644
--- a/modules/gui/skins2/src/os_factory.hpp
+++ b/modules/gui/skins2/src/os_factory.hpp
@@ -51,7 +51,8 @@ public:
         kResizeNS,
         kResizeWE,
         kResizeNWSE,
-        kResizeNESW
+        kResizeNESW,
+        kNoCursor,
     };
 
     /**
diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index cc93d603ce..69bbf0fd44 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -472,6 +472,16 @@ static int WindowControl( vout_window_t *pWnd, int query, va_list args )
             return VLC_SUCCESS;
         }
 
+        case VOUT_WINDOW_HIDE_MOUSE:
+        {
+            bool hide = va_arg( args, int );
+            // Post a HideMouse command
+            CmdHideMouse* pCmd =
+                new CmdHideMouse( pIntf, pWnd, hide );
+            pQueue->push( CmdGenericPtr( pCmd ) );
+            return VLC_SUCCESS;
+        }
+
         default:
             msg_Dbg( pIntf, "control query not supported" );
             return VLC_EGENERIC;
diff --git a/modules/gui/skins2/src/vout_manager.cpp b/modules/gui/skins2/src/vout_manager.cpp
index 5b3c6af780..442c9b265e 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -297,6 +297,17 @@ void VoutManager::setFullscreenWnd( vout_window_t *pWnd, bool b_fullscreen )
 }
 
 
+void VoutManager::hideMouseWnd( vout_window_t *pWnd, bool hide )
+{
+    msg_Dbg( pWnd, "hide mouse (%i) received from vout thread", hide );
+    OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+    if( hide )
+        pOsFactory->changeCursor( OSFactory::kNoCursor );
+    else
+        pOsFactory->changeCursor( OSFactory::kDefaultArrow );
+}
+
+
 void VoutManager::onUpdate( Subject<VarBool> &rVariable, void *arg )
 {
     (void)arg;
diff --git a/modules/gui/skins2/src/vout_manager.hpp b/modules/gui/skins2/src/vout_manager.hpp
index 60c2713aef..4cf3522b40 100644
--- a/modules/gui/skins2/src/vout_manager.hpp
+++ b/modules/gui/skins2/src/vout_manager.hpp
@@ -118,6 +118,9 @@ public:
     /// set fullscreen mode (vout window provider)
     void setFullscreenWnd( vout_window_t* pWnd, bool b_fullscreen );
 
+    /// hide mouse (vout window provider)
+    void hideMouseWnd( vout_window_t* pWnd, bool hide );
+
     // Register Video Controls (when building theme)
     void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
 



More information about the vlc-commits mailing list