[gtk+/wip/otte/gadget: 5/8] gadget: Fix clip computation
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/gadget: 5/8] gadget: Fix clip computation
- Date: Wed, 18 Nov 2015 05:33:15 +0000 (UTC)
commit 5f754a6101f76dcd0dcb56fb83ddf6db2b52ce68
Author: Benjamin Otte <otte redhat com>
Date: Mon Nov 16 02:58:21 2015 +0100
gadget: Fix clip computation
Previously we forgot to set the background + border area of the gadget
and just used the content area to compute the clip.
gtk/gtkcssgadget.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcssgadget.c b/gtk/gtkcssgadget.c
index e556382..2c40fba 100644
--- a/gtk/gtkcssgadget.c
+++ b/gtk/gtkcssgadget.c
@@ -432,7 +432,7 @@ gtk_css_gadget_allocate (GtkCssGadget *gadget,
int baseline,
GtkAllocation *out_clip)
{
- GtkAllocation content_allocation;
+ GtkAllocation content_allocation, content_clip;
GtkBorder margin, border, padding, shadow, extents;
GtkCssStyle *style;
@@ -457,13 +457,14 @@ gtk_css_gadget_allocate (GtkCssGadget *gadget,
g_assert (content_allocation.width >= 0);
g_assert (content_allocation.height >= 0);
- GTK_CSS_GADGET_GET_CLASS (gadget)->allocate (gadget, &content_allocation, baseline, out_clip);
+ GTK_CSS_GADGET_GET_CLASS (gadget)->allocate (gadget, &content_allocation, baseline, &content_clip);
_gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
- out_clip->x -= extents.left + shadow.left - margin.left;
- out_clip->y -= extents.top + shadow.top - margin.top;
- out_clip->width += extents.left + extents.right + shadow.left + shadow.right - margin.left - margin.right;
- out_clip->height += extents.top + extents.bottom + shadow.top + shadow.bottom - margin.top - margin.bottom;
+ out_clip->x = allocation->x + margin.left - shadow.left;
+ out_clip->y = allocation->y + margin.top - shadow.top;
+ out_clip->width = allocation->width - margin.left - margin.right + shadow.left + shadow.right;
+ out_clip->height = allocation->height - margin.top - margin.bottom + shadow.top + shadow.bottom;
+ gdk_rectangle_union (&content_clip, out_clip, out_clip);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]