[gtk+/wip/baedert/drawing: 184/186] widget: Consider css margins when setting clip
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 184/186] widget: Consider css margins when setting clip
- Date: Tue, 16 May 2017 06:20:14 +0000 (UTC)
commit 484af08808b64b5dc96f507a33b57468c94f5dd2
Author: Timm Bäder <mail baedert org>
Date: Mon May 15 15:01:29 2017 +0200
widget: Consider css margins when setting clip
This is optional for positive margins as they just increase the widget
allocation. However, with negative css margins, the allocation is
smaller than the clip.
This fixes scale sliders leaving a small trail behind.
gtk/gtkwidget.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ae235f8..4ee2b58 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13656,6 +13656,7 @@ gtk_widget_set_clip (GtkWidget *widget,
GtkWidgetPrivate *priv;
GtkBorder shadow;
GtkAllocation allocation;
+ GtkBorder margin;
GtkCssStyle *style;
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -13689,13 +13690,14 @@ gtk_widget_set_clip (GtkWidget *widget,
/* Always untion the given clip with the widget allocation */
/* ... and with the box shadow size */
- allocation = priv->allocation;
style = gtk_css_node_get_style (priv->cssnode);
+ allocation = priv->allocation;
+ get_box_margin (style, &margin);
_gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
- allocation.x -= shadow.left;
- allocation.y -= shadow.top;
- allocation.width += shadow.left + shadow.right;
- allocation.height += shadow.top + shadow.bottom;
+ allocation.x += margin.left - shadow.left;
+ allocation.y += margin.top - shadow.top;
+ allocation.width += shadow.left + shadow.right - margin.left - margin.right;
+ allocation.height += shadow.top + shadow.bottom - margin.top - margin.bottom;
gdk_rectangle_union (&allocation, clip, &priv->clip);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]