[gtk+] frame: Measure border gadget separately
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] frame: Measure border gadget separately
- Date: Thu, 25 Feb 2016 19:46:25 +0000 (UTC)
commit 77594be976d3835ced3b583dd314e286892e168c
Author: Timm Bäder <mail baedert org>
Date: Thu Feb 25 18:41:24 2016 +0100
frame: Measure border gadget separately
https://bugzilla.gnome.org/show_bug.cgi?id=760482
gtk/gtkframe.c | 51 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 43 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 44bce31..6f48802 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -175,6 +175,14 @@ static void gtk_frame_measure (GtkCssGadget *gadget,
gint *minimum_baseline,
gint *natural_baseline,
gpointer data);
+static void gtk_frame_measure_border (GtkCssGadget *gadget,
+ GtkOrientation orientation,
+ gint for_size,
+ gint *minimum_size,
+ gint *natural_size,
+ gint *minimum_baseline,
+ gint *natural_baseline,
+ gpointer data);
static void gtk_frame_allocate (GtkCssGadget *gadget,
const GtkAllocation *allocation,
int baseline,
@@ -319,7 +327,7 @@ gtk_frame_init (GtkFrame *frame)
GTK_WIDGET (frame),
priv->gadget,
NULL,
- NULL,
+ gtk_frame_measure_border,
gtk_frame_allocate_border,
NULL,
NULL,
@@ -925,7 +933,6 @@ gtk_frame_measure (GtkCssGadget *gadget,
GtkWidget *widget;
GtkFrame *frame;
GtkFramePrivate *priv;
- GtkWidget *child;
gint child_min, child_nat;
widget = gtk_css_gadget_get_owner (gadget);
@@ -958,14 +965,37 @@ gtk_frame_measure (GtkCssGadget *gadget,
*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
+gtk_frame_measure_border (GtkCssGadget *gadget,
+ GtkOrientation orientation,
+ int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline,
+ gpointer data)
+{
+ GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
+ GtkWidget *child;
+ int child_min, child_nat;
+
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
- *minimum = MAX (*minimum, child_min);
- *natural = MAX (*natural, child_nat);
}
else
{
@@ -973,14 +1003,19 @@ gtk_frame_measure (GtkCssGadget *gadget,
gtk_widget_get_preferred_height_for_width (child, for_size, &child_min, &child_nat);
else
gtk_widget_get_preferred_height (child, &child_min, &child_nat);
-
- *minimum += child_min;
- *natural += child_nat;
}
- }
+ *minimum = child_min;
+ *natural = child_nat;
+ }
+ else
+ {
+ *minimum = 0;
+ *natural = 0;
+ }
}
+
static void
gtk_frame_get_preferred_width (GtkWidget *widget,
gint *minimum,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]