[gtk/new-style-menu] box layout: Handle native children
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/new-style-menu] box layout: Handle native children
- Date: Fri, 7 Jun 2019 03:22:44 +0000 (UTC)
commit e82ff98893e72f011341995af064155d1c12db75
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 7 03:20:45 2019 +0000
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.
gtk/gtkboxlayout.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
---
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]