[gtk+/wip/baedert/gtkimageview: 154/156] frame: Fix horizontal size request
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/gtkimageview: 154/156] frame: Fix horizontal size request
- Date: Fri, 26 Feb 2016 17:29:58 +0000 (UTC)
commit 50eb26fc9b212fd302322be6185fa392ec48a2c3
Author: Timm Bäder <mail baedert org>
Date: Fri Feb 26 14:07:49 2016 +0100
frame: Fix horizontal size request
We were adding the border gadget size and the label widget size in any
case, but when calculating the width, we want the maximum of those two,
not the sum.
https://bugzilla.gnome.org/show_bug.cgi?id=760482
gtk/gtkframe.c | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index d363d41..799abdf 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -938,13 +938,23 @@ gtk_frame_measure (GtkCssGadget *gadget,
frame = GTK_FRAME (widget);
priv = frame->priv;
+ gtk_css_gadget_get_preferred_size (priv->border_gadget,
+ orientation,
+ for_size,
+ &child_min,
+ &child_nat,
+ NULL, NULL);
+
+ *minimum = child_min;
+ *natural = child_nat;
+
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_widget_get_preferred_width (priv->label_widget, &child_min, &child_nat);
- *minimum = child_min;
- *natural = child_nat;
+ *minimum = MAX (child_min, *minimum);
+ *natural = MAX (child_nat, *natural);
}
else
{
@@ -954,25 +964,10 @@ gtk_frame_measure (GtkCssGadget *gadget,
else
gtk_widget_get_preferred_height (priv->label_widget, &child_min, &child_nat);
- *minimum = child_min;
- *natural = child_nat;
+ *minimum += child_min;
+ *natural += child_nat;
}
}
- else
- {
- *minimum = 0;
- *natural = 0;
- }
-
- gtk_css_gadget_get_preferred_size (priv->border_gadget,
- orientation,
- for_size,
- &child_min,
- &child_nat,
- NULL, NULL);
-
- *minimum += child_min;
- *natural += child_nat;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]