[libhandy] clamp: Measure even without a child
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] clamp: Measure even without a child
- Date: Tue, 9 Feb 2021 15:40:19 +0000 (UTC)
commit d1dbaf1d0b4e8af3fd928368be8c43de4bb1b231
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Feb 9 15:48:00 2021 +0100
clamp: Measure even without a child
The clamp itself can have margins, etc.
src/hdy-clamp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/hdy-clamp.c b/src/hdy-clamp.c
index b03af19c..d0e96400 100644
--- a/src/hdy-clamp.c
+++ b/src/hdy-clamp.c
@@ -204,7 +204,7 @@ hdy_clamp_measure (GtkWidget *widget,
HdyClamp *self = HDY_CLAMP (widget);
GtkBin *bin = GTK_BIN (widget);
GtkWidget *child;
- gint child_size;
+ gint child_size = 0;
if (minimum)
*minimum = 0;
@@ -216,12 +216,11 @@ hdy_clamp_measure (GtkWidget *widget,
*natural_baseline = -1;
child = gtk_bin_get_child (bin);
- if (!(child && gtk_widget_get_visible (child)))
- return;
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
if (self->orientation == orientation) {
- gtk_widget_get_preferred_width (child, minimum, natural);
+ if (child && gtk_widget_get_visible (child))
+ gtk_widget_get_preferred_width (child, minimum, natural);
return;
}
@@ -234,7 +233,8 @@ hdy_clamp_measure (GtkWidget *widget,
natural);
} else {
if (self->orientation == orientation) {
- gtk_widget_get_preferred_height (child, minimum, natural);
+ if (child && gtk_widget_get_visible (child))
+ gtk_widget_get_preferred_height (child, minimum, natural);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]