You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
OnTouchListener: attach event controllers to WrapperWidget
otherwise, the touch event positions would depend on the scroll offset. This fixes the glitchy vertical scrolling in ViewPager
This commit is contained in:
@@ -171,7 +171,7 @@ void _setOnTouchListener(JNIEnv *env, jobject this, GtkWidget *widget, jobject o
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_view_View_setOnTouchListener(JNIEnv *env, jobject this, jobject on_touch_listener)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET(_PTR(_GET_LONG_FIELD(this, "widget")));
|
||||
GtkWidget *widget = gtk_widget_get_parent(GTK_WIDGET(_PTR(_GET_LONG_FIELD(this, "widget"))));
|
||||
|
||||
_setOnTouchListener(env, this, widget, on_touch_listener);
|
||||
}
|
||||
|
||||
@@ -170,8 +170,7 @@ void wrapper_widget_set_jobject(WrapperWidget *wrapper, JNIEnv *env, jobject job
|
||||
|
||||
jmethodID ontouchevent_method = _METHOD(_CLASS(jobj), "onTouchEvent", "(Landroid/view/MotionEvent;)Z");
|
||||
if (ontouchevent_method != handle_cache.view.onTouchEvent) {
|
||||
/* use wrapper->child since the jobject may not have the "widget" variable set yet */
|
||||
_setOnTouchListener(env, jobj, wrapper->child, NULL);
|
||||
_setOnTouchListener(env, jobj, GTK_WIDGET(wrapper), NULL);
|
||||
}
|
||||
|
||||
jmethodID computeScroll_method = _METHOD(_CLASS(jobj), "computeScroll", "()V");
|
||||
|
||||
Reference in New Issue
Block a user