[gtk+] scrolledwindow: Bug 766569 - Report child natural size unconditionally
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] scrolledwindow: Bug 766569 - Report child natural size unconditionally
- Date: Mon, 6 Jun 2016 02:49:58 +0000 (UTC)
commit 0943c9f6b2c3ad5827ae5d8f3742f75e72782e41
Author: Tristan Van Berkom <tristan vanberkom codethink co uk>
Date: Sat Jun 4 20:57:23 2016 +0900
scrolledwindow: Bug 766569 - Report child natural size unconditionally
This patch causes the scrolled window default behavior to change in
such a way that the natural size request of the child is unconditionally
reported, which probably should have been the case since day 1.
This should not cause significant fallout since a scrolled window is
normally used to expand/fill, eating up remaining space for scrollable
content - it will however cause the scrolled window to compete for
additional space with siblings, proportionally to the size of the
scrolled window's content.
gtk/gtkscrolledwindow.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 1ef826b..c6a9ca4 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1781,17 +1781,18 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget,
&min_child_size,
&nat_child_size);
+ natural_req.width += nat_child_size;
+
if (priv->hscrollbar_policy == GTK_POLICY_NEVER)
{
minimum_req.width += min_child_size;
- natural_req.width += nat_child_size;
}
else
{
if (priv->min_content_width >= 0)
{
minimum_req.width += priv->min_content_width;
- natural_req.width += priv->min_content_width;
+ natural_req.width = MAX (priv->min_content_width, natural_req.width);
extra_width = -1;
}
@@ -1822,17 +1823,18 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget,
&min_child_size,
&nat_child_size);
+ natural_req.height += nat_child_size;
+
if (priv->vscrollbar_policy == GTK_POLICY_NEVER)
{
minimum_req.height += min_child_size;
- natural_req.height += nat_child_size;
}
else
{
if (priv->min_content_height >= 0)
{
minimum_req.height += priv->min_content_height;
- natural_req.height += priv->min_content_height;
+ natural_req.height = MAX (priv->min_content_height, natural_req.height);
extra_height = -1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]