@@ -28,11 +28,11 @@ void gtk_custom_root_widget_measure(
28
28
switch (orientation ) {
29
29
case GTK_ORIENTATION_HORIZONTAL :
30
30
* minimum = root_widget -> minimum_width ;
31
- * natural = root_widget -> natural_width ;
31
+ * natural = 0 ;
32
32
break ;
33
33
case GTK_ORIENTATION_VERTICAL :
34
34
* minimum = root_widget -> minimum_height ;
35
- * natural = root_widget -> natural_height ;
35
+ * natural = 0 ;
36
36
break ;
37
37
}
38
38
}
@@ -46,19 +46,14 @@ void gtk_custom_root_widget_allocate(
46
46
GtkCustomRootWidget * root_widget = GTK_CUSTOM_ROOT_WIDGET (widget );
47
47
gtk_widget_allocate (root_widget -> child , width , height , 0 , NULL );
48
48
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 ) {
56
52
return ;
57
53
}
58
54
59
55
root_widget -> allocated_width = width ;
60
56
root_widget -> allocated_height = height ;
61
- root_widget -> has_been_allocated = true;
62
57
63
58
if (root_widget -> resize_callback != NULL ) {
64
59
Size size = { .width = width , .height = height };
@@ -73,8 +68,6 @@ GtkWidget *gtk_custom_root_widget_new(void) {
73
68
widget -> resize_callback_data = NULL ;
74
69
widget -> minimum_width = 0 ;
75
70
widget -> minimum_height = 0 ;
76
- widget -> natural_width = 0 ;
77
- widget -> natural_height = 0 ;
78
71
widget -> allocated_width = 0 ;
79
72
widget -> allocated_height = 0 ;
80
73
widget -> has_been_allocated = false;
@@ -88,12 +81,12 @@ void gtk_custom_root_widget_set_child(GtkCustomRootWidget *self, GtkWidget *chil
88
81
}
89
82
90
83
void 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 ) {
92
85
* width = widget -> allocated_width ;
93
86
* height = widget -> allocated_height ;
94
87
} else {
95
- * width = widget -> natural_width ;
96
- * height = widget -> natural_height ;
88
+ * width = 0 ;
89
+ * height = 0 ;
97
90
}
98
91
}
99
92
0 commit comments