[gtk] {box,grid}layout: Access border spacing directly
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] {box,grid}layout: Access border spacing directly
- Date: Fri, 7 Feb 2020 18:22:10 +0000 (UTC)
commit b471158e3890e7d4ac530d67cc1fb9ca3c611dd3
Author: Timm Bäder <mail baedert org>
Date: Mon Feb 3 11:43:15 2020 +0100
{box,grid}layout: Access border spacing directly
Instead of going through the style context
gtk/gtkboxlayout.c | 11 ++++++-----
gtk/gtkgridlayout.c | 8 +++++---
2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkboxlayout.c b/gtk/gtkboxlayout.c
index 55ca7b481a..098375973b 100644
--- a/gtk/gtkboxlayout.c
+++ b/gtk/gtkboxlayout.c
@@ -186,12 +186,13 @@ count_expand_children (GtkWidget *widget,
static gint
get_spacing (GtkBoxLayout *self,
- GtkStyleContext *style_context)
+ GtkCssNode *node)
{
+ GtkCssStyle *style = gtk_css_node_get_style (node);
GtkCssValue *border_spacing;
gint css_spacing;
- border_spacing = _gtk_style_context_peek_property (style_context, GTK_CSS_PROPERTY_BORDER_SPACING);
+ border_spacing = style->size->border_spacing;
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
css_spacing = _gtk_css_position_value_get_x (border_spacing, 100);
else
@@ -211,7 +212,7 @@ gtk_box_layout_compute_size (GtkBoxLayout *self,
int n_visible_children = 0;
int required_min = 0, required_nat = 0;
int largest_min = 0, largest_nat = 0;
- int spacing = get_spacing (self, _gtk_widget_get_style_context (widget));
+ int spacing = get_spacing (self, gtk_widget_get_css_node (widget));
for (child = gtk_widget_get_first_child (widget);
child != NULL;
@@ -285,7 +286,7 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
if (nvis_children <= 0)
return;
- spacing = get_spacing (self, _gtk_widget_get_style_context (widget));
+ spacing = get_spacing (self, gtk_widget_get_css_node (widget));
sizes = g_newa (GtkRequestedSize, nvis_children);
extra_space = MAX (0, for_size - (nvis_children - 1) * spacing);
@@ -489,7 +490,7 @@ gtk_box_layout_allocate (GtkLayoutManager *layout_manager,
direction = _gtk_widget_get_direction (widget);
sizes = g_newa (GtkRequestedSize, nvis_children);
- spacing = get_spacing (self, _gtk_widget_get_style_context (widget));
+ spacing = get_spacing (self, gtk_widget_get_css_node (widget));
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
extra_space = width - (nvis_children - 1) * spacing;
diff --git a/gtk/gtkgridlayout.c b/gtk/gtkgridlayout.c
index aac06e1709..f913490741 100644
--- a/gtk/gtkgridlayout.c
+++ b/gtk/gtkgridlayout.c
@@ -470,11 +470,13 @@ get_spacing (GtkGridLayout *self,
GtkWidget *widget,
GtkOrientation orientation)
{
+ GtkCssNode *node = gtk_widget_get_css_node (widget);
+ GtkCssStyle *style = gtk_css_node_get_style (node);
GtkCssValue *border_spacing;
- gint css_spacing;
+ int css_spacing;
+
+ border_spacing = style->size->border_spacing;
- border_spacing = _gtk_style_context_peek_property (gtk_widget_get_style_context (widget),
- GTK_CSS_PROPERTY_BORDER_SPACING);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
css_spacing = _gtk_css_position_value_get_x (border_spacing, 100);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]