[gtk+] gadget: Warn if for_size is too small
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gadget: Warn if for_size is too small
- Date: Fri, 4 Mar 2016 18:45:32 +0000 (UTC)
commit 51b83c43898d8ca534b0ee213a8a0f396d976a0a
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Mar 4 13:43:19 2016 -0500
gadget: Warn if for_size is too small
It does not make sense to pass a for_size into the size allocation
machinery that is smaller than the min-size in that direction.
Warn if it happens, so we can track it down when it occurs.
gtk/gtkcssgadget.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssgadget.c b/gtk/gtkcssgadget.c
index d93075d..c31da16 100644
--- a/gtk/gtkcssgadget.c
+++ b/gtk/gtkcssgadget.c
@@ -615,6 +615,7 @@ gtk_css_gadget_get_preferred_size (GtkCssGadget *gadget,
int min_size, extra_size, extra_opposite, extra_baseline;
int unused_minimum, unused_natural;
int forced_minimum, forced_natural;
+ int min_for_size;
if (minimum == NULL)
minimum = &unused_minimum;
@@ -642,6 +643,7 @@ gtk_css_gadget_get_preferred_size (GtkCssGadget *gadget,
extra_opposite = margin.top + margin.bottom + border.top + border.bottom + padding.top +
padding.bottom;
extra_baseline = margin.left + border.left + padding.left;
min_size = get_number (style, GTK_CSS_PROPERTY_MIN_WIDTH);
+ min_for_size = get_number (style, GTK_CSS_PROPERTY_MIN_HEIGHT);
}
else
{
@@ -649,10 +651,16 @@ gtk_css_gadget_get_preferred_size (GtkCssGadget *gadget,
extra_opposite = margin.left + margin.right + border.left + border.right + padding.left +
padding.right;
extra_baseline = margin.top + border.top + padding.top;
min_size = get_number (style, GTK_CSS_PROPERTY_MIN_HEIGHT);
+ min_for_size = get_number (style, GTK_CSS_PROPERTY_MIN_WIDTH);
}
if (for_size > -1)
- for_size = MAX (0, for_size - extra_opposite);
+ {
+ if (for_size < min_for_size)
+ g_warning ("for_size smaller than min-size: %d < %d", for_size, min_for_size);
+
+ for_size = MAX (0, for_size - extra_opposite);
+ }
if (minimum_baseline)
*minimum_baseline = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]