[gtk+/wip/baedert/drawing: 199/306] 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: 199/306] widget: Consider css margins when setting clip
- Date: Fri, 23 Jun 2017 20:13:39 +0000 (UTC)
commit 79fd63464e5895c059a315c9cacff56eca4c5ea2
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 43c8b0c..f45a398 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13447,6 +13447,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));
@@ -13480,13 +13481,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]