[vlc-devel] [PATCH 2/5] macosx: send the mouse events via the window

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 2 16:18:12 CET 2020


No need to lock the VLCOpenGLVideoView anymore.
---
 modules/video_output/macosx.m | 38 +++++++++--------------------------
 1 file changed, 9 insertions(+), 29 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index bcb71579d68..67844f4f4e0 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -726,13 +726,9 @@ static void OpenglSwap (vlc_gl_t *gl)
 
 - (void)mouseDown:(NSEvent *)o_event
 {
-    @synchronized (self) {
-        if (vd) {
-            if ([o_event type] == NSLeftMouseDown && !([o_event modifierFlags] &  NSControlKeyMask)) {
-                if ([o_event clickCount] <= 1)
-                    vout_display_SendEventMousePressed (vd, MOUSE_BUTTON_LEFT);
-            }
-        }
+    if ([o_event type] == NSLeftMouseDown && !([o_event modifierFlags] &  NSControlKeyMask)) {
+        if ([o_event clickCount] <= 1)
+            vout_window_ReportMousePressed (window, MOUSE_BUTTON_LEFT);
     }
 
     [super mouseDown:o_event];
@@ -740,32 +736,22 @@ static void OpenglSwap (vlc_gl_t *gl)
 
 - (void)otherMouseDown:(NSEvent *)o_event
 {
-    @synchronized (self) {
-        if (vd)
-            vout_display_SendEventMousePressed (vd, MOUSE_BUTTON_CENTER);
-    }
+    vout_window_ReportMousePressed (window, MOUSE_BUTTON_CENTER);
 
     [super otherMouseDown: o_event];
 }
 
 - (void)mouseUp:(NSEvent *)o_event
 {
-    @synchronized (self) {
-        if (vd) {
-            if ([o_event type] == NSLeftMouseUp)
-                vout_display_SendEventMouseReleased (vd, MOUSE_BUTTON_LEFT);
-        }
-    }
+    if ([o_event type] == NSLeftMouseUp)
+        vout_window_ReportMouseReleased (window, MOUSE_BUTTON_LEFT);
 
     [super mouseUp: o_event];
 }
 
 - (void)otherMouseUp:(NSEvent *)o_event
 {
-    @synchronized (self) {
-        if (vd)
-            vout_display_SendEventMouseReleased (vd, MOUSE_BUTTON_CENTER);
-    }
+    vout_window_ReportMouseReleased (window, MOUSE_BUTTON_CENTER);
 
     [super otherMouseUp: o_event];
 }
@@ -780,14 +766,8 @@ static void OpenglSwap (vlc_gl_t *gl)
     ml = [self convertPointToBacking: ml];
     videoRect = [self convertRectToBacking: videoRect];
 
-    if (b_inside) {
-        @synchronized (self) {
-            if (vd) {
-                vout_display_SendMouseMovedDisplayCoordinates(vd,
-                                                              (int)ml.x, videoRect.size.height - (int)ml.y);
-            }
-        }
-    }
+    if (b_inside)
+        vout_window_ReportMouseMoved(window, (int)ml.x, videoRect.size.height - (int)ml.y);
 
     [super mouseMoved: o_event];
 }
-- 
2.26.2



More information about the vlc-devel mailing list