Commit 3b671854 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Android vout: support the mouse events from jni

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent d4485d3f
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
}
}
......@@ -20,9 +20,16 @@
* 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 *);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment