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
AndroidLayout: prevent unnecessary measurements between two JavaWidgets
GTK sometimes calls widget_measure() from widget_allocate(). This is unnecessary if the parent and child are both JavaWidgets and these unexpected measurements can confuse Views.
This commit is contained in:
@@ -25,7 +25,8 @@ static void android_layout_measure(GtkLayoutManager *layout_manager, GtkWidget *
|
||||
AndroidLayout *layout = ATL_ANDROID_LAYOUT(layout_manager);
|
||||
JNIEnv *env = get_jni_env();
|
||||
|
||||
if (layout->width || layout->height) {
|
||||
// If the parent widget is also an AndroidLayout, the measurement will already have happened in Java
|
||||
if ((layout->width || layout->height) && !ATL_IS_ANDROID_LAYOUT(gtk_widget_get_layout_manager(gtk_widget_get_parent(gtk_widget_get_parent(widget))))) {
|
||||
widthMeasureSpec = make_measure_spec(layout->width, orientation == GTK_ORIENTATION_VERTICAL ? for_size : -1);
|
||||
heightMeasureSpec = make_measure_spec(layout->height, orientation == GTK_ORIENTATION_HORIZONTAL ? for_size : -1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user