]> git.sesse.net Git - vlc/commitdiff
Android vout: support the mouse events from jni
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 13 May 2014 00:02:42 +0000 (02:02 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 22 May 2014 16:53:14 +0000 (18:53 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/video_output/android/opaque.c
modules/video_output/android/surface.c
modules/video_output/android/utils.c
modules/video_output/android/utils.h

index 4812e64a2e2f575183a3519a264f5f678b41e96f..a289004985777c591ed29da3913f05225f2af8dd 100644 (file)
@@ -235,7 +235,7 @@ static int Open(vlc_object_t *p_this)
     vd->display = Display;
     vd->control = Control;
     vd->prepare = NULL;
-    vd->manage  = NULL;
+    vd->manage  = Manage;
 
     /* Fix initial state */
     vout_display_SendEventFullscreen(vd, false);
index bc519132f72b9962d57c013b39e9412baac7071c..139511ddf39133106a4bf95e23b84bcfe7456c51 100644 (file)
@@ -274,7 +274,7 @@ static int Open(vlc_object_t *p_this)
     vd->display = Display;
     vd->control = Control;
     vd->prepare = NULL;
-    vd->manage  = NULL;
+    vd->manage  = Manage;
 
     /* Fix initial state */
     vout_display_SendEventFullscreen(vd, false);
index 027ba6d45cf6a2566978557e7f781df7914cf2ec..21a62b7da759bb3b5ea2c85ceefe15a9435413c4 100644 (file)
@@ -48,3 +48,26 @@ void *LoadNativeWindowAPI(native_window_api_t *native)
     dlclose(p_library);
     return NULL;
 }
+
+extern void jni_getMouseCoordinates(int *, int *, int *, int *);
+
+void Manage(vout_display_t *vd)
+{
+    int x, y, button, action;
+    jni_getMouseCoordinates(&action, &button, &x, &y);
+    if (x >= 0 && y >= 0)
+    {
+        switch( action )
+        {
+            case AMOTION_EVENT_ACTION_DOWN:
+                vout_display_SendEventMouseMoved(vd, x, y);
+                vout_display_SendEventMousePressed(vd, button); break;
+            case AMOTION_EVENT_ACTION_UP:
+                vout_display_SendEventMouseMoved(vd, x, y);
+                vout_display_SendEventMouseReleased(vd, button); break;
+            case AMOTION_EVENT_ACTION_MOVE:
+                vout_display_SendEventMouseMoved(vd, x, y); break;
+        }
+    }
+}
+
index cd36bc343bf3e8152e45207e9a448adc3e09dbc7..9a72df67bc41cc6728da3753210564d575a90cdc 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <android/native_window.h>
 #include <jni.h>
 #include <android/native_window_jni.h>
+#include <android/input.h>
+
+#include <vlc_vout_display.h>
 
 typedef ANativeWindow* (*ptr_ANativeWindow_fromSurface)(JNIEnv*, jobject);
 typedef void (*ptr_ANativeWindow_release)(ANativeWindow*);
@@ -40,3 +47,4 @@ typedef struct
 /* Fill the structure passed as parameter and return a library handle
    that should be destroyed with dlclose. */
 void *LoadNativeWindowAPI(native_window_api_t *native);
+void Manage(vout_display_t *);