Window: fix issue with multi Activity support

each Activity has its own Window object. Therefore the check if the
contentView has changed needs to be in the common native window
This commit is contained in:
Julian Winkler
2023-10-28 09:21:04 +02:00
parent a2381f4721
commit 469d47091c
2 changed files with 8 additions and 6 deletions

View File

@@ -7,7 +7,11 @@
JNIEXPORT void JNICALL Java_android_view_Window_set_1widget_1as_1root(JNIEnv *env, jobject this, jlong window, jlong widget)
{
gtk_window_set_child(GTK_WINDOW(_PTR(window)), gtk_widget_get_parent(GTK_WIDGET(_PTR(widget))));
GtkWindow *gtk_window = GTK_WINDOW(_PTR(window));
GtkWidget *gtk_widget = gtk_widget_get_parent(GTK_WIDGET(_PTR(widget)));
if (gtk_widget != gtk_window_get_child(gtk_window)) {
gtk_window_set_child(gtk_window, gtk_widget);
}
}
// FIXME put this in a header file

View File

@@ -41,11 +41,9 @@ public class Window {
}
public void setContentView(View view) {
if (view != contentView) {
contentView = view;
view.onAttachedToWindow();
set_widget_as_root(native_window, view.widget);
}
contentView = view;
view.onAttachedToWindow();
set_widget_as_root(native_window, view.widget);
}
public View getDecorView() {