[Android] Add a way to send the X/Y mouse position

Jean-Baptiste Kempf git at videolan.org
Wed May 14 10:33:23 CEST 2014


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue May 13 01:46:16 2014 +0200| [517095345f2a25452e37691f9030343988fce49f] | committer: Jean-Baptiste Kempf

Add a way to send the X/Y mouse position

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=517095345f2a25452e37691f9030343988fce49f
---

 vlc-android/jni/vout.c                          |   20 ++++++++++++++++++++
 vlc-android/src/org/videolan/libvlc/LibVLC.java |    2 ++
 2 files changed, 22 insertions(+)

diff --git a/vlc-android/jni/vout.c b/vlc-android/jni/vout.c
index 3fed2b9..06d72ae 100644
--- a/vlc-android/jni/vout.c
+++ b/vlc-android/jni/vout.c
@@ -165,3 +165,23 @@ void Java_org_videolan_libvlc_LibVLC_detachSubtitlesSurface(JNIEnv *env, jobject
     vout_android_subtitles_surf = NULL;
     pthread_mutex_unlock(&vout_android_lock);
 }
+
+static int mouse_x = -1;
+static int mouse_y = -1;
+static int mouse_button = -1;
+
+void Java_org_videolan_libvlc_LibVLC_sendMouseEvent(JNIEnv* env, jobject thiz, jint button, jint x, jint y)
+{
+    mouse_x = x;
+    mouse_y = y;
+    mouse_button = button;
+}
+
+void jni_getMouseCoordinates( int *button, int *x, int *y)
+{
+    *x = mouse_x;
+    *y = mouse_y;
+    *button = mouse_button;
+
+    mouse_button = mouse_x = mouse_y = -1;
+}
diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
index e386566..5f3d79a 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
@@ -638,6 +638,8 @@ public class LibVLC {
     public native int getSpuTracksCount();
 
     public static native String nativeToURI(String path);
+    
+    public native static void sendMouseEvent( int button, int x, int y);
 
     /**
      * Quickly converts path to URIs, which are mandatory in libVLC.



More information about the Android mailing list