Commit 0dd0534c authored by Erwan Tulou's avatar Erwan Tulou

skins2(x11): report mouse events to vlc core

This fixes mouse on video widget not functioning with skins on Linux.
parent 4bc6943b
......@@ -29,6 +29,8 @@
#include "os_graphics.hpp"
#include "os_window.hpp"
#include "../events/evt_key.hpp"
#include "../events/evt_motion.hpp"
#include "../events/evt_mouse.hpp"
#include <vlc_actions.h>
......@@ -115,3 +117,29 @@ void VoutWindow::processEvent( EvtKey &rEvtKey )
getIntf()->p_sys->p_dialogs->sendKey( rEvtKey.getModKey() );
}
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 );
}
void VoutWindow::processEvent( EvtMouse &rEvtMouse )
{
int button = -1;
if( rEvtMouse.getButton() == EvtMouse::kLeft )
button = 0;
else if( rEvtMouse.getButton() == EvtMouse::kMiddle )
button = 1;
else if( rEvtMouse.getButton() == EvtMouse::kRight )
button = 2;
if( rEvtMouse.getAction() == EvtMouse::kDown )
vout_window_ReportMousePressed( m_pWnd, button );
else if( rEvtMouse.getAction() == EvtMouse::kUp )
vout_window_ReportMouseReleased( m_pWnd, button );
else if( rEvtMouse.getAction() == EvtMouse::kDblClick )
vout_window_ReportMouseDoubleClick( m_pWnd, button );
}
......@@ -56,6 +56,8 @@ public:
/// hotkeys processing
virtual void processEvent( EvtKey &rEvtKey );
virtual void processEvent( EvtMotion &rEvtMotion );
virtual void processEvent( EvtMouse &rEvtMouse );
/// set and get Video Control for VoutWindow
virtual void setCtrlVideo( CtrlVideo* pCtrlVideo );
......
......@@ -115,18 +115,9 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
}
// Select events received by the window
long event_mask;
if( type == GenericWindow::VoutWindow )
{
event_mask = ExposureMask|KeyPressMask|
LeaveWindowMask|FocusChangeMask;
}
else
{
event_mask = ExposureMask|KeyPressMask|
long event_mask = ExposureMask|KeyPressMask|
PointerMotionMask|ButtonPressMask|ButtonReleaseMask|
LeaveWindowMask|FocusChangeMask;
}
XSelectInput( XDISPLAY, m_wnd, event_mask );
// Store a pointer on the generic window in a map
......
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