[vlc-commits] display: reroute legacy mouse events through window

Rémi Denis-Courmont git at videolan.org
Mon Dec 31 18:48:09 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 31 15:59:58 2018 +0200| [ee5c22239334f09dff9f371697a6718d4c56021a] | committer: Rémi Denis-Courmont

display: reroute legacy mouse events through window

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

 include/vlc_vout_display.h |  6 ++---
 src/video_output/display.c | 55 +---------------------------------------------
 2 files changed, 4 insertions(+), 57 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index ac58b44cfb..c6d6e60c63 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -374,15 +374,15 @@ static inline void vout_display_SendEventMouseMoved(vout_display_t *vd, int x, i
 }
 static inline void vout_display_SendEventMousePressed(vout_display_t *vd, int button)
 {
-    vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_PRESSED, button);
+    vout_window_ReportMousePressed(vd->cfg->window, button);
 }
 static inline void vout_display_SendEventMouseReleased(vout_display_t *vd, int button)
 {
-    vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_RELEASED, button);
+    vout_window_ReportMouseReleased(vd->cfg->window, button);
 }
 static inline void vout_display_SendEventMouseDoubleClick(vout_display_t *vd)
 {
-    vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK);
+    vout_window_ReportMouseDoubleClick(vd->cfg->window, MOUSE_BUTTON_LEFT);
 }
 static inline void vout_display_SendEventViewpointMoved(vout_display_t *vd,
                                                         const vlc_viewpoint_t *vp)
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 35a442eef7..f8a25bdf48 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -269,60 +269,7 @@ void vout_display_TranslateMouseState(vout_display_t *vd, vlc_mouse_t *video,
 
 void vout_display_SendMouseMovedDisplayCoordinates(vout_display_t *vd, int m_x, int m_y)
 {
-    video_format_t source_rot = vd->source;
-    vout_display_place_t *place = &(vout_display_place_t) { };
-
-    vout_display_PlacePicture(place, &vd->source, vd->cfg);
-
-    if (place->width > 0 && place->height > 0) {
-
-        int x = (int)(source_rot.i_x_offset +
-                            (int64_t)(m_x - place->x) * source_rot.i_visible_width / place->width);
-        int y = (int)(source_rot.i_y_offset +
-                            (int64_t)(m_y - place->y) * source_rot.i_visible_height/ place->height);
-
-        video_transform_t transform = video_format_GetTransform(vd->source.orientation, ORIENT_NORMAL);
-
-        int store;
-
-        switch (transform) {
-
-            case TRANSFORM_R90:
-                store = x;
-                x = y;
-                y = vd->source.i_visible_height - store;
-                break;
-            case TRANSFORM_R180:
-                x = vd->source.i_visible_width - x;
-                y = vd->source.i_visible_height - y;
-                break;
-            case TRANSFORM_R270:
-                store = x;
-                x = vd->source.i_visible_width - y;
-                y = store;
-                break;
-            case TRANSFORM_HFLIP:
-                x = vd->source.i_visible_width - x;
-                break;
-            case TRANSFORM_VFLIP:
-                y = vd->source.i_visible_height - y;
-                break;
-            case TRANSFORM_TRANSPOSE:
-                store = x;
-                x = y;
-                y = store;
-                break;
-            case TRANSFORM_ANTI_TRANSPOSE:
-                store = x;
-                x = vd->source.i_visible_width - y;
-                y = vd->source.i_visible_height - store;
-                break;
-            default:
-                break;
-        }
-
-        vout_display_SendEventMouseMoved (vd, x, y);
-    }
+    vout_window_ReportMouseMoved(vd->cfg->window, m_x, m_y);
 }
 
 typedef struct {



More information about the vlc-commits mailing list