[gnome-builder] GbScrolledWindow: take GtkBorder into account
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] GbScrolledWindow: take GtkBorder into account
- Date: Thu, 18 Dec 2014 01:48:40 +0000 (UTC)
commit 1f44f8dc086345e92e9bfb848e5d3b12c860f17e
Author: Christian Hergert <christian hergert me>
Date: Wed Dec 17 17:48:22 2014 -0800
GbScrolledWindow: take GtkBorder into account
src/scrolledwindow/gb-scrolled-window.c | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/scrolledwindow/gb-scrolled-window.c b/src/scrolledwindow/gb-scrolled-window.c
index f0bee11..822b3b2 100644
--- a/src/scrolledwindow/gb-scrolled-window.c
+++ b/src/scrolledwindow/gb-scrolled-window.c
@@ -127,20 +127,29 @@ gb_scrolled_window_get_preferred_height (GtkWidget *widget,
if (self->priv->max_content_height > -1)
{
GtkWidget *child;
+ GtkStyleContext *style;
+ GtkBorder border;
gint child_min_height;
gint child_nat_height;
+ gint additional;
child = gtk_bin_get_child (GTK_BIN (widget));
if (!child)
return;
+ style = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_border (style,
+ gtk_widget_get_state_flags (widget),
+ &border);
+ additional = border.top + border.bottom;
+
gtk_widget_get_preferred_height (child, &child_min_height,
&child_nat_height);
if ((child_nat_height > *natural_height) &&
(self->priv->max_content_height > *natural_height))
*natural_height = MIN (self->priv->max_content_height,
- child_nat_height);
+ child_nat_height) + additional;
}
}
}
@@ -162,20 +171,29 @@ gb_scrolled_window_get_preferred_width (GtkWidget *widget,
if (self->priv->max_content_width > -1)
{
GtkWidget *child;
+ GtkStyleContext *style;
+ GtkBorder border;
gint child_min_width;
gint child_nat_width;
+ gint additional;
child = gtk_bin_get_child (GTK_BIN (widget));
if (!child)
return;
+ style = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_border (style,
+ gtk_widget_get_state_flags (widget),
+ &border);
+ additional = border.left = border.right;
+
gtk_widget_get_preferred_width (child, &child_min_width,
&child_nat_width);
if ((child_nat_width > *natural_width) &&
(self->priv->max_content_width > *natural_width))
*natural_width = MIN (self->priv->max_content_width,
- child_nat_width);
+ child_nat_width) + additional;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]