diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-02-28 00:24:33 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-02-28 00:25:01 +0200 |
commit | 3cf4f1a13b61592b1af8040692029216d9c90d4c (patch) | |
tree | 5d755fc646a0e4109402732da7396684a8347d43 /vcl/android | |
parent | e2e68b5c65911fa75ed5b3935e0cf1ca0fabc2d8 (diff) |
Handle touch events
Change-Id: I9c9d200731df9ba48ee61f7c97692ed9b9f06648
Diffstat (limited to 'vcl/android')
-rw-r--r-- | vcl/android/androidinst.cxx | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index b94855df1c75..2773cd390482 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -900,10 +900,10 @@ int AndroidSalSystem::ShowNativeDialog( const rtl::OUString& rTitle, return 0; } -// Render everything +// public static native void renderVCL(Bitmap bitmap); extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_experimental_desktop_Desktop_renderVCL(JNIEnv *env, - jobject /* dummy */, + jobject /* clazz */, jobject bitmap) { if (!bHitIdle) @@ -963,6 +963,7 @@ typedef struct ANativeWindow_Buffer { AndroidBitmap_unlockPixels(env, bitmap); } +// public static native void setViewSize(int width, int height); extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_experimental_desktop_Desktop_setViewSize(JNIEnv * /* env */, jobject /* clazz */, @@ -974,6 +975,7 @@ Java_org_libreoffice_experimental_desktop_Desktop_setViewSize(JNIEnv * /* env */ viewHeight = height; } +// public static native void key(char c, short timestamp); extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_experimental_desktop_Desktop_key(JNIEnv * /* env */, jobject /* clazz */, @@ -996,4 +998,41 @@ Java_org_libreoffice_experimental_desktop_Desktop_key(JNIEnv * /* env */, LOGW("No focused frame to emit event on"); } +// public static native void touch(int action, int x, int y, short timestamp); +extern "C" SAL_JNI_EXPORT void JNICALL +Java_org_libreoffice_experimental_desktop_Desktop_touch(JNIEnv * /* env */, + jobject /* clazz */, + jint action, + jint x, + jint y, + jshort timestamp) +{ + SalMouseEvent aEvent; + + aEvent.mnTime = timestamp; + aEvent.mnX = x; + aEvent.mnY = y; + aEvent.mnButton = MOUSE_LEFT; + aEvent.mnCode = 0; + + sal_uInt16 eventKind; + switch (action) { + case AMOTION_EVENT_ACTION_DOWN: + eventKind = SALEVENT_MOUSEBUTTONDOWN; + break; + case AMOTION_EVENT_ACTION_UP: + eventKind = SALEVENT_MOUSEBUTTONUP; + break; + case AMOTION_EVENT_ACTION_MOVE: + eventKind = SALEVENT_MOUSEMOVE; + break; + } + + SalFrame *pFocus = AndroidSalInstance::getInstance()->getFocusFrame(); + if (pFocus) + pFocus->CallCallback( eventKind, &aEvent ); + else + LOGW("No focused frame to emit event on"); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |