@@ -28,11 +28,11 @@ void gtk_custom_root_widget_measure(
2828 switch (orientation ) {
2929 case GTK_ORIENTATION_HORIZONTAL :
3030 * minimum = root_widget -> minimum_width ;
31- * natural = root_widget -> natural_width ;
31+ * natural = 0 ;
3232 break ;
3333 case GTK_ORIENTATION_VERTICAL :
3434 * minimum = root_widget -> minimum_height ;
35- * natural = root_widget -> natural_height ;
35+ * natural = 0 ;
3636 break ;
3737 }
3838}
@@ -46,19 +46,14 @@ void gtk_custom_root_widget_allocate(
4646 GtkCustomRootWidget * root_widget = GTK_CUSTOM_ROOT_WIDGET (widget );
4747 gtk_widget_allocate (root_widget -> child , width , height , 0 , NULL );
4848
49- if (!root_widget -> has_been_allocated ) {
50- if (width == root_widget -> natural_width && height == root_widget -> natural_height ) {
51- root_widget -> allocated_width = width ;
52- root_widget -> allocated_height = height ;
53- return ;
54- }
55- } else if (width == root_widget -> allocated_width && height == root_widget -> allocated_height ) {
49+ root_widget -> has_been_allocated = true;
50+
51+ if (width == root_widget -> allocated_width && height == root_widget -> allocated_height ) {
5652 return ;
5753 }
5854
5955 root_widget -> allocated_width = width ;
6056 root_widget -> allocated_height = height ;
61- root_widget -> has_been_allocated = true;
6257
6358 if (root_widget -> resize_callback != NULL ) {
6459 Size size = { .width = width , .height = height };
@@ -73,8 +68,6 @@ GtkWidget *gtk_custom_root_widget_new(void) {
7368 widget -> resize_callback_data = NULL ;
7469 widget -> minimum_width = 0 ;
7570 widget -> minimum_height = 0 ;
76- widget -> natural_width = 0 ;
77- widget -> natural_height = 0 ;
7871 widget -> allocated_width = 0 ;
7972 widget -> allocated_height = 0 ;
8073 widget -> has_been_allocated = false;
@@ -88,12 +81,12 @@ void gtk_custom_root_widget_set_child(GtkCustomRootWidget *self, GtkWidget *chil
8881}
8982
9083void gtk_custom_root_widget_get_size (GtkCustomRootWidget * widget , gint * width , gint * height ) {
91- if (widget -> has_been_allocated || widget -> natural_width == 0 || widget -> natural_height == 0 ) {
84+ if (widget -> has_been_allocated ) {
9285 * width = widget -> allocated_width ;
9386 * height = widget -> allocated_height ;
9487 } else {
95- * width = widget -> natural_width ;
96- * height = widget -> natural_height ;
88+ * width = 0 ;
89+ * height = 0 ;
9790 }
9891}
9992
0 commit comments