api-impl{-jni}: make view.onTouchEvent work, misc stuff to make input work for Unity games

onTouchEvent was previously incorrectly handled in GLSurfaceView; move it
to View so that it works properly with any of it's descendants.

This is done by reusing the existing setOnTouchListener implementation
and changing it to use GtkEventControllerLegacy which provides motion
events.

Technically some of the code is in WrapperWidget.c since every widget
calls wrapper_widget_set_jobject and we already have related code
there.
This commit is contained in:
Mis012
2023-10-17 21:33:59 +02:00
parent 58fa4b5590
commit 4a0755c6e0
14 changed files with 154 additions and 127 deletions

View File

@@ -125,6 +125,7 @@ void set_up_handle_cache(JNIEnv *env)
handle_cache.view.getScrollX = _METHOD(handle_cache.view.class, "getScrollX", "()I");
handle_cache.view.getScrollY = _METHOD(handle_cache.view.class, "getScrollY", "()I");
handle_cache.view.performClick = _METHOD(handle_cache.view.class, "performClick", "()Z");
handle_cache.view.onTouchEvent = _METHOD(handle_cache.view.class, "onTouchEvent", "(Landroid/view/MotionEvent;)Z");
handle_cache.asset_manager.class = _REF((*env)->FindClass(env, "android/content/res/AssetManager"));
handle_cache.asset_manager.extractFromAPK = _STATIC_METHOD(handle_cache.asset_manager.class, "extractFromAPK", "(Ljava/lang/String;Ljava/lang/String;)V");