[vlc-commits] caopengllayer: add implicit API to handle mouse events

Felix Paul Kühne git at videolan.org
Wed Apr 23 16:50:36 CEST 2014


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Apr 23 16:46:29 2014 +0200| [3bda2242f4f26ba22e66ce6740221e91daf75291] | committer: Felix Paul Kühne

caopengllayer: add implicit API to handle mouse events

Since CALayer doesn't have access to the mouse, it is the container view's duty to feed this info if desired

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

 modules/video_output/caopengllayer.m |   41 ++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 8213bf0..0f307e5 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -474,4 +474,45 @@ static void *OurGetProcAddress (vlc_gl_t *gl, const char *name)
     // do not release anything here, we do that when closing the module
 }
 
+- (void)mouseButtonDown:(int)buttonNumber
+{
+    @synchronized (self) {
+        if (_vd) {
+            if (buttonNumber == 0)
+                vout_display_SendEventMousePressed (_vd, MOUSE_BUTTON_LEFT);
+            else if (buttonNumber == 1)
+                vout_display_SendEventMousePressed (_vd, MOUSE_BUTTON_RIGHT);
+            else
+                vout_display_SendEventMousePressed (_vd, MOUSE_BUTTON_CENTER);
+        }
+    }
+}
+
+- (void)mouseButtonUp:(int)buttonNumber
+{
+    @synchronized (self) {
+        if (_vd) {
+            if (buttonNumber == 0)
+                vout_display_SendEventMouseReleased (_vd, MOUSE_BUTTON_LEFT);
+            else if (buttonNumber == 1)
+                vout_display_SendEventMouseReleased (_vd, MOUSE_BUTTON_RIGHT);
+            else
+                vout_display_SendEventMouseReleased (_vd, MOUSE_BUTTON_CENTER);
+        }
+    }
+}
+
+- (void)mouseMovedToX:(double)xValue Y:(double)yValue
+{
+    @synchronized (self) {
+        if (_vd) {
+            vout_display_SendMouseMovedDisplayCoordinates (_vd,
+                                                           ORIENT_NORMAL,
+                                                           xValue,
+                                                           yValue,
+                                                           &_vd->sys->place);
+        }
+    }
+}
+
 @end



More information about the vlc-commits mailing list