[vlc-devel] [PATCH v2 3/4] macosx: send the mouse events via the window

Steve Lhomme robux4 at ycbcr.xyz
Tue Nov 3 08:46:46 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 7143c2528fd..a8e3f81eb9c 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -746,13 +746,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];
@@ -760,32 +756,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];
 }
@@ -800,14 +786,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