[gtk+] frame: Don't overlap label and child
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] frame: Don't overlap label and child
- Date: Sat, 16 Jan 2016 00:16:41 +0000 (UTC)
commit 2cf810c4c9169519768cea96696dd89116c34cb1
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 15 19:11:03 2016 -0500
frame: Don't overlap label and child
We didn't do this previously, so don't start now.
https://bugzilla.gnome.org/show_bug.cgi?id=760528
gtk/gtkframe.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index ac5af4a..d3f9fc3 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -797,7 +797,8 @@ gtk_frame_allocate (GtkCssGadget *gadget,
gtk_frame_compute_child_allocation (frame, &new_allocation);
priv->child_allocation = new_allocation;
- if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
+ if (priv->label_widget &&
+ gtk_widget_get_visible (priv->label_widget))
{
gint nat_width, width, height;
gfloat xalign;
@@ -845,13 +846,27 @@ gtk_frame_allocate_border (GtkCssGadget *gadget,
gpointer data)
{
GtkWidget *widget;
+ GtkFramePrivate *priv;
GtkWidget *child;
+ GtkAllocation child_allocation;
+ gint height_extra;
widget = gtk_css_gadget_get_owner (gadget);
+ priv = GTK_FRAME (widget)->priv;
+
+ if (priv->label_widget &&
+ gtk_widget_get_visible (priv->label_widget))
+ height_extra = priv->label_allocation.height * priv->label_yalign;
+ else
+ height_extra = 0;
+
+ child_allocation = *allocation;
+ child_allocation.y += height_extra;
+ child_allocation.height -= height_extra;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
- gtk_widget_size_allocate (child, (GtkAllocation *)allocation);
+ gtk_widget_size_allocate (child, &child_allocation);
*out_clip = *allocation;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]