[gtk+/wip/csoriano/pathbar-bin-view-window] gtkrevealer: take into account min size of child
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/csoriano/pathbar-bin-view-window] gtkrevealer: take into account min size of child
- Date: Wed, 15 Jun 2016 17:08:30 +0000 (UTC)
commit 9e5ecf304e4db74d484bd355d35aaeb4ed6100f9
Author: Carlos Soriano <csoriano gnome org>
Date: Wed Jun 15 18:22:32 2016 +0200
gtkrevealer: take into account min size of child
gtk/gtkrevealer.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index b23f66a..c5994dd 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -310,6 +310,7 @@ gtk_revealer_get_child_allocation (GtkRevealer *revealer,
GtkWidget *child;
GtkRevealerTransitionType transition;
GtkBorder padding;
+ GtkAllocation child_min_allocation;
gint vertical_padding, horizontal_padding;
g_return_if_fail (revealer != NULL);
@@ -331,15 +332,28 @@ gtk_revealer_get_child_allocation (GtkRevealer *revealer,
transition = effective_transition (revealer);
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
- gtk_widget_get_preferred_width_for_height (child, MAX (0, allocation->height - vertical_padding),
NULL,
+ gtk_widget_get_preferred_width_for_height (child, MAX (0, allocation->height - vertical_padding),
+ &child_min_allocation.width,
&child_allocation->width);
else
- gtk_widget_get_preferred_height_for_width (child, MAX (0, allocation->width - horizontal_padding),
NULL,
+ gtk_widget_get_preferred_height_for_width (child, MAX (0, allocation->width - horizontal_padding),
+ &child_min_allocation.height,
&child_allocation->height);
}
- child_allocation->width = MAX (child_allocation->width, allocation->width - horizontal_padding);
- child_allocation->height = MAX (child_allocation->height, allocation->height - vertical_padding);
+ if (child_allocation->width > allocation->width - horizontal_padding)
+ child_allocation->width = CLAMP (allocation->width - horizontal_padding,
+ child_min_allocation.width,
+ child_allocation->width);
+ else
+ child_allocation->width = allocation->width - horizontal_padding;
+
+ if (child_allocation->height > allocation->height - vertical_padding)
+ child_allocation->height = CLAMP (allocation->height - vertical_padding,
+ child_min_allocation.height,
+ child_allocation->height);
+ else
+ child_allocation->height = allocation->height - vertical_padding;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]