Commit a21fc097 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

skins2: handle cursor internally (refs #18661)

parent 624939fa
......@@ -64,14 +64,3 @@ void CmdSetFullscreen::execute()
{
getIntf()->p_sys->p_voutManager->setFullscreenWnd( m_pWnd, m_bFullscreen );
}
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 );
}
......@@ -83,20 +83,4 @@ private:
vout_window_t* m_pWnd;
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
......@@ -475,16 +475,6 @@ 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;
......
......@@ -27,6 +27,7 @@
#include "theme.hpp"
#include "os_factory.hpp"
#include "os_graphics.hpp"
#include "os_timer.hpp"
#include "os_window.hpp"
#include "../events/evt_key.hpp"
#include "../events/evt_motion.hpp"
......@@ -40,8 +41,12 @@ VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
GenericWindow( pIntf, 0, 0, false, false, pParent,
GenericWindow::VoutWindow ),
m_pWnd( pWnd ), original_width( width ), original_height( height ),
m_pCtrlVideo( NULL ), m_pParentWindow( pParent )
m_pCtrlVideo( NULL ), m_pParentWindow( pParent ),
mouse_hide_timeout( var_InheritInteger( pWnd, "mouse-hide-timeout" ) ),
m_cmdHideMouse( this )
{
OSFactory *pOsFactory = OSFactory::instance( pIntf );
if( m_pWnd )
{
vlc_object_hold( m_pWnd );
......@@ -52,6 +57,8 @@ VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
#else
m_pWnd->handle.hwnd = getOSHandle();
#endif
m_pTimer = pOsFactory->createOSTimer( m_cmdHideMouse );
}
}
......@@ -60,6 +67,7 @@ VoutWindow::~VoutWindow()
{
if( m_pWnd )
{
delete m_pTimer;
vlc_object_release( m_pWnd );
}
}
......@@ -125,7 +133,9 @@ void VoutWindow::processEvent( EvtMotion &rEvtMotion )
{
int x = rEvtMotion.getXPos() - m_pParentWindow->getLeft() - getLeft();
int y = rEvtMotion.getYPos() - m_pParentWindow->getTop() - getTop();
vout_window_ReportMouseMoved( m_pWnd, x, y );
showMouse();
}
......@@ -145,4 +155,24 @@ void VoutWindow::processEvent( EvtMouse &rEvtMouse )
vout_window_ReportMouseReleased( m_pWnd, button );
else if( rEvtMouse.getAction() == EvtMouse::kDblClick )
vout_window_ReportMouseDoubleClick( m_pWnd, button );
showMouse();
}
void VoutWindow::showMouse()
{
m_pTimer->start( mouse_hide_timeout, true );
hideMouse( false );
}
void VoutWindow::hideMouse( bool hide )
{
VoutManager::instance( getIntf() )->hideMouseWnd( m_pWnd, hide );
}
void VoutWindow::CmdHideMouse::execute()
{
m_pParent->hideMouse( true );
}
......@@ -26,9 +26,11 @@
#include "generic_window.hpp"
#include "dialogs.hpp"
#include "../commands/cmd_generic.hpp"
#include <vlc_vout_window.h>
class OSGraphics;
class OSTimer;
class CtrlVideo;
......@@ -75,6 +77,10 @@ public:
/// Resize the window
virtual void resize( int width, int height );
// Hide/show cursor
void showMouse( );
void hideMouse( bool );
virtual std::string getType() const { return "Vout"; }
private:
......@@ -91,6 +97,11 @@ private:
/// Parent Window
GenericWindow* m_pParentWindow;
// Cursor timer
OSTimer *m_pTimer;
int mouse_hide_timeout;
DEFINE_CALLBACK( VoutWindow, HideMouse );
};
typedef CountedPtr<VoutWindow> VoutWindowPtr;
......
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