[vlc-commits] vout: inline mouse events

Rémi Denis-Courmont git at videolan.org
Thu May 31 20:45:46 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 31 21:21:31 2018 +0300| [b9dc6404aaf192be4197d38c48fe00b48c9c6e37] | committer: Rémi Denis-Courmont

vout: inline mouse events

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

 src/video_output/display.c | 22 ++++++++++++++++------
 src/video_output/event.h   | 25 -------------------------
 2 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 1e7dacddf4..eba0e0e3c2 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -1295,6 +1295,7 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
  * TODO move out
  *****************************************************************************/
 #include "vout_internal.h"
+
 void vout_SendDisplayEventMouse(vout_thread_t *vout, const vlc_mouse_t *m)
 {
     vlc_mouse_t tmp1, tmp2;
@@ -1312,18 +1313,27 @@ void vout_SendDisplayEventMouse(vout_thread_t *vout, const vlc_mouse_t *m)
     }
     vlc_mutex_unlock( &vout->p->filter.lock );
 
-    if (vlc_mouse_HasMoved(&vout->p->mouse, m)) {
-        vout_SendEventMouseMoved(vout, m->i_x, m->i_y);
-    }
+    if (vlc_mouse_HasMoved(&vout->p->mouse, m))
+        var_SetCoords(vout, "mouse-moved", m->i_x, m->i_y);
+
     if (vlc_mouse_HasButton(&vout->p->mouse, m)) {
         for (unsigned button = 0; button < MOUSE_BUTTON_MAX; button++) {
             if (vlc_mouse_HasPressed(&vout->p->mouse, m, button))
-                vout_SendEventMousePressed(vout, button);
+                var_OrInteger(vout, "mouse-button-down", 1 << button);
             else if (vlc_mouse_HasReleased(&vout->p->mouse, m, button))
-                vout_SendEventMouseReleased(vout, button);
+                var_NAndInteger(vout, "mouse-button-down", 1 << button);
+        }
+
+        if (vlc_mouse_HasPressed(&vout->p->mouse, m, MOUSE_BUTTON_LEFT)) {
+            /* FIXME? */
+            int x, y;
+
+            var_GetCoords(vout, "mouse-moved", &x, &y);
+            var_SetCoords(vout, "mouse-clicked", x, y);
         }
     }
+
     if (m->b_double_click)
-        vout_SendEventMouseDoubleClick(vout);
+        var_ToggleBool(vout, "fullscreen");
     vout->p->mouse = *m;
 }
diff --git a/src/video_output/event.h b/src/video_output/event.h
index 985052a45f..1e237d7142 100644
--- a/src/video_output/event.h
+++ b/src/video_output/event.h
@@ -41,10 +41,6 @@ static inline void vout_SendEventKey(vout_thread_t *vout, int key)
 {
     var_SetInteger(vout->obj.libvlc, "key-pressed", key);
 }
-static inline void vout_SendEventMouseMoved(vout_thread_t *vout, int x, int y)
-{
-    var_SetCoords(vout, "mouse-moved", x, y);
-}
 static inline void vout_SendEventViewpointMoved(vout_thread_t *vout,
                                                 const vlc_viewpoint_t *p_viewpoint)
 {
@@ -53,27 +49,6 @@ static inline void vout_SendEventViewpointMoved(vout_thread_t *vout,
     var_Change(vout, "viewpoint-moved", VLC_VAR_SETVALUE,
                &(vlc_value_t) { .p_address = NULL }, NULL);
 }
-static inline void vout_SendEventMousePressed(vout_thread_t *vout, int button)
-{
-    var_OrInteger(vout, "mouse-button-down", 1 << button);
-
-    if (button == MOUSE_BUTTON_LEFT)
-    {
-        /* FIXME? */
-        int x, y;
-        var_GetCoords(vout, "mouse-moved", &x, &y);
-        var_SetCoords(vout, "mouse-clicked", x, y);
-    }
-}
-static inline void vout_SendEventMouseReleased(vout_thread_t *vout, int button)
-{
-    var_NAndInteger(vout, "mouse-button-down", 1 << button);
-}
-static inline void vout_SendEventMouseDoubleClick(vout_thread_t *vout)
-{
-    //vout_ControlSetFullscreen(vout, !var_GetBool(vout, "fullscreen"));
-    var_ToggleBool(vout, "fullscreen");
-}
 static inline void vout_SendEventViewpointChangeable(vout_thread_t *vout,
                                                      bool b_can_change)
 {



More information about the vlc-commits mailing list