[vlc-commits] skins2(x11): report mouse events to vlc core

Erwan Tulou git at videolan.org
Fri Jan 12 00:30:07 CET 2018


vlc/vlc-3.0 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Jan 11 04:14:45 2018 +0100| [23db4ef530efdd5c605e41f7ab02b72fbef90191] | committer: Erwan Tulou

skins2(x11): report mouse events to vlc core

This fixes mouse on video widget not functioning with skins on Linux.

(cherry picked from commit 0dd0534c363d7ba07cb77c705ac9147d37c92bfb)
Signed-off-by: Erwan Tulou <erwan10 at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=23db4ef530efdd5c605e41f7ab02b72fbef90191
---

 modules/gui/skins2/src/vout_window.cpp | 28 ++++++++++++++++++++++++++++
 modules/gui/skins2/src/vout_window.hpp |  2 ++
 modules/gui/skins2/x11/x11_window.cpp  | 11 +----------
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/modules/gui/skins2/src/vout_window.cpp b/modules/gui/skins2/src/vout_window.cpp
index e50683f410..d683e6a974 100644
--- a/modules/gui/skins2/src/vout_window.cpp
+++ b/modules/gui/skins2/src/vout_window.cpp
@@ -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 );
+}
diff --git a/modules/gui/skins2/src/vout_window.hpp b/modules/gui/skins2/src/vout_window.hpp
index ada0447338..ef971ae7d5 100644
--- a/modules/gui/skins2/src/vout_window.hpp
+++ b/modules/gui/skins2/src/vout_window.hpp
@@ -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 );
diff --git a/modules/gui/skins2/x11/x11_window.cpp b/modules/gui/skins2/x11/x11_window.cpp
index c38202fde1..57850299c4 100644
--- a/modules/gui/skins2/x11/x11_window.cpp
+++ b/modules/gui/skins2/x11/x11_window.cpp
@@ -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



More information about the vlc-commits mailing list