[gtk+] widget: Draw debug nodes for widget margins too
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Draw debug nodes for widget margins too
- Date: Thu, 20 Jul 2017 01:57:14 +0000 (UTC)
commit 0726148ca5881855b32110044da4c785aaf808da
Author: Timm Bäder <mail baedert org>
Date: Tue Jul 4 15:06:18 2017 +0200
widget: Draw debug nodes for widget margins too
gtk/gtkwidget.c | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index bc716c3..dda4856 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -15134,20 +15134,43 @@ gtk_widget_maybe_add_debug_render_nodes (GtkWidget *widget,
GtkCssStyle *style;
GtkBorder margin, border, padding;
- /* We should be offset to the widget allocation at this point */
+ /* We should be offset to priv->allocation at this point */
if (GTK_DISPLAY_DEBUG_CHECK (display, LAYOUT))
{
graphene_rect_t bounds;
- GdkRGBA margin_color = {0.3, 0.3, 0, 0.6};
- GdkRGBA padding_color = {0.3, 0, 0.3, 0.6};
+ GdkRGBA widget_margin_color = {0.7, 0, 0, 0.6};
+ GdkRGBA margin_color = {0.7, 0.7, 0, 0.6};
+ GdkRGBA padding_color = {0.7, 0, 0.7, 0.6};
style = gtk_css_node_get_style (priv->cssnode);
get_box_margin (style, &margin);
get_box_border (style, &border);
get_box_padding (style, &padding);
- /* Margins */
+ /* Widget margins */
+ graphene_rect_init (&bounds,
+ 0, -priv->margin.top,
+ priv->allocation.width, priv->margin.top);
+ gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin top");
+
+ graphene_rect_init (&bounds,
+ 0, priv->allocation.height,
+ priv->allocation.width, priv->margin.bottom);
+ gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin bottom");
+
+ graphene_rect_init (&bounds,
+ -priv->margin.left, 0,
+ priv->margin.left, priv->allocation.height);
+ gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin left");
+
+ graphene_rect_init (&bounds,
+ priv->allocation.width, 0,
+ priv->margin.right, priv->allocation.height);
+ gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin right");
+
+
+ /* CSS Margins */
graphene_rect_init (&bounds,
0, 0,
priv->allocation.width, margin.top);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]