Button/ImageButton: consume touch events

Androids button consumes touch events, while GTKs button lets touch
events propagate to the parent. This previously caused some glitches
with buttons inside a CoordinatorLayout.
This commit is contained in:
Julian Winkler
2024-07-19 14:06:52 +02:00
parent c7f64cd24b
commit 23e7d32924
4 changed files with 27 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ JNIEXPORT jlong JNICALL Java_android_widget_ImageButton_native_1constructor(JNIE
GtkWidget *image = gtk_picture_new_for_resource("/org/gtk/libgtk/icons/16x16/status/image-missing.png"); // show "broken image" icon
gtk_button_set_child(GTK_BUTTON(button), image);
wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), button);
wrapper_widget_consume_touch_events(WRAPPER_WIDGET(wrapper)); // Android button consumes touch events
wrapper_widget_set_jobject(WRAPPER_WIDGET(wrapper), env, this);
return _INTPTR(button);