diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-06-07 03:20:45 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-06-09 17:38:53 +0000 |
commit | 59ed4da71723cfd1de386dff463a3e1c17f27e1b (patch) | |
tree | 5896f30c2a6998bfb3a52a7a65ac37df339d2200 /gtk/gtkboxlayout.c | |
parent | 640c7939ea6902a7bda21ae962e97c9ee65589f7 (diff) | |
download | gtk+-59ed4da71723cfd1de386dff463a3e1c17f27e1b.tar.gz |
box layout: Handle native children
These need to be skipped in measuring,
and we need to call gtk_native_check_resize
on them during allocation.
This was showing up as the new-style
context menu in widget-factory forcing
its relative-to box to grow when its
shown.
Diffstat (limited to 'gtk/gtkboxlayout.c')
-rw-r--r-- | gtk/gtkboxlayout.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gtk/gtkboxlayout.c b/gtk/gtkboxlayout.c index 6660dcafd4..98d87701eb 100644 --- a/gtk/gtkboxlayout.c +++ b/gtk/gtkboxlayout.c @@ -28,6 +28,7 @@ #include "gtkstylecontextprivate.h" #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" +#include "gtknative.h" /** * SECTION:gtkboxlayout @@ -173,6 +174,9 @@ count_expand_children (GtkWidget *widget, child != NULL; child = _gtk_widget_get_next_sibling (child)) { + if (GTK_IS_NATIVE (child)) + continue; + if (_gtk_widget_get_visible (child)) { *visible_children += 1; @@ -219,6 +223,9 @@ gtk_box_layout_compute_size (GtkBoxLayout *self, int child_min = 0; int child_nat = 0; + if (GTK_IS_NATIVE (child)) + continue; + if (!_gtk_widget_get_visible (child)) continue; @@ -293,6 +300,9 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self, child != NULL; child = _gtk_widget_get_next_sibling (child)) { + if (GTK_IS_NATIVE (child)) + continue; + if (_gtk_widget_get_visible (child)) { gtk_widget_measure (child, @@ -341,6 +351,9 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self, child != NULL; child = _gtk_widget_get_next_sibling (child)) { + if (GTK_IS_NATIVE (child)) + continue; + /* If widget is not visible, skip it. */ if (!_gtk_widget_get_visible (child)) continue; @@ -481,6 +494,15 @@ gtk_box_layout_allocate (GtkLayoutManager *layout_manager, gint child_size; gint spacing; + /* Handle native children first, and skip them in everything below */ + for (child = _gtk_widget_get_first_child (widget); + child != NULL; + child = _gtk_widget_get_next_sibling (child)) + { + if (GTK_IS_NATIVE (child)) + gtk_native_check_resize (GTK_NATIVE (child)); + } + count_expand_children (widget, self->orientation, &nvis_children, &nexpand_children); /* If there is no visible child, simply return. */ @@ -505,6 +527,9 @@ gtk_box_layout_allocate (GtkLayoutManager *layout_manager, child != NULL; child = _gtk_widget_get_next_sibling (child)) { + if (GTK_IS_NATIVE (child)) + continue; + if (!_gtk_widget_get_visible (child)) continue; @@ -556,6 +581,9 @@ gtk_box_layout_allocate (GtkLayoutManager *layout_manager, child != NULL; child = _gtk_widget_get_next_sibling (child)) { + if (GTK_IS_NATIVE (child)) + continue; + /* If widget is not visible, skip it. */ if (!_gtk_widget_get_visible (child)) continue; @@ -661,6 +689,9 @@ gtk_box_layout_allocate (GtkLayoutManager *layout_manager, child != NULL; child = _gtk_widget_get_next_sibling (child)) { + if (GTK_IS_NATIVE (child)) + continue; + /* If widget is not visible, skip it. */ if (!_gtk_widget_get_visible (child)) continue; |