Simplify native interface of widget implementations

Makes it easier to overwrite behavior in subclasses. Have a fallback
implementation for ViewGroup.
Save some _GET_LONG_FIELD / _SET_LONG_FIELD calls by directly passing
the native pointers to and from native methods.
This commit is contained in:
Julian Winkler
2023-08-17 12:59:37 +02:00
parent 82744e9e5e
commit 4d90002ec6
33 changed files with 403 additions and 553 deletions

View File

@@ -174,7 +174,7 @@ gboolean tick_callback(GtkWidget* widget, GdkFrameClock* frame_clock, gpointer u
return G_SOURCE_CONTINUE;
}
JNIEXPORT void JNICALL Java_android_view_View_native_1constructor(JNIEnv *env, jobject this, jobject Context)
JNIEXPORT jlong JNICALL Java_android_view_View_native_1constructor(JNIEnv *env, jobject this, jobject context, jobject attrs)
{
GtkWidget *wrapper = wrapper_widget_new();
GtkWidget *area = gtk_drawing_area_new();
@@ -183,7 +183,7 @@ JNIEXPORT void JNICALL Java_android_view_View_native_1constructor(JNIEnv *env, j
gtk_widget_add_tick_callback(area, tick_callback, NULL, NULL);
_SET_LONG_FIELD(this, "widget", (long)area);
return _INTPTR(area);
}
JNIEXPORT void JNICALL Java_android_view_View_nativeInvalidate(JNIEnv *env, jclass, jlong widget_ptr) {