[Xfce4-commits] [xfce/gtk-xfce-engine] 05/08: Use parent background for smooth edges.

noreply at xfce.org noreply at xfce.org
Fri Feb 6 22:24:21 CET 2015


This is an automated email from the git hooks/post-receive script.

peter pushed a commit to branch peter/refresh-gtk2
in repository xfce/gtk-xfce-engine.

commit 8debac71ec8834f6ddb33af8617f2128ab792864
Author: Peter de Ridder <peter at xfce.org>
Date:   Sun Jan 5 14:00:38 2014 +0100

    Use parent background for smooth edges.
---
 src/xfce_theme_draw.c |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/xfce_theme_draw.c b/src/xfce_theme_draw.c
index 1e0c0db..f2a4abd 100644
--- a/src/xfce_theme_draw.c
+++ b/src/xfce_theme_draw.c
@@ -383,6 +383,9 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
 {
     gint xt, yt;
     cairo_t *cr;
+    GtkWidget *parent;
+    GtkStyle *pstyle;
+    GdkColor *pbg;
 
     CHECK_ARGS;
 
@@ -391,6 +394,17 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
 
     SANITIZE_SIZE;
 
+    parent = gtk_widget_get_parent(widget);
+    if (parent)
+    {
+        pstyle = gtk_widget_get_style(widget);
+        pbg = &pstyle->bg[gtk_widget_get_state(parent)];
+    }
+    else
+    {
+        pbg = &style->mid[state_type];
+    }
+
     /* Spin buttons are a special case */
     if (widget && GTK_IS_SPIN_BUTTON (widget))
     {
@@ -465,7 +479,7 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
                             state_type = GTK_STATE_NORMAL;
                         }
 
-                        gdk_cairo_set_source_color(cr, &style->mid[state_type]);
+                        gdk_cairo_set_source_color(cr, pbg);
                         cairo_rectangle(cr, x, y, 1, 1);
                         cairo_rectangle(cr, x + width - 1, y, 1, 1);
                         cairo_rectangle(cr, x, y + height - 1, 1, 1);
@@ -559,7 +573,7 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
                         cairo_rectangle(cr, x + 0.5, y + 0.5, width - 1, height - 1);
                         cairo_stroke(cr);
 
-                        gdk_cairo_set_source_color(cr, &style->mid[GTK_STATE_NORMAL]);
+                        gdk_cairo_set_source_color(cr, pbg);
                         cairo_rectangle(cr, x, y, 1, 1);
                         cairo_rectangle(cr, x + width - 1, y, 1, 1);
                         cairo_rectangle(cr, x, y + height - 1, 1, 1);
@@ -592,7 +606,7 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
                         cairo_line_to(cr, x + width - 1.5, y + 2.5);
                         cairo_stroke(cr);
 
-                        gdk_cairo_set_source_color(cr, &style->mid[state_type]);
+                        gdk_cairo_set_source_color(cr, pbg);
                         cairo_rectangle(cr, x, y, 1, 1);
                         cairo_rectangle(cr, x + width - 1, y, 1, 1);
                         cairo_rectangle(cr, x, y + height - 1, 1, 1);
@@ -614,7 +628,7 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
                         cairo_line_to(cr, x + width - 0.5, y + 1.5);
                         cairo_stroke(cr);
 
-                        gdk_cairo_set_source_color(cr, &style->mid[state_type]);
+                        gdk_cairo_set_source_color(cr, pbg);
                         cairo_rectangle(cr, x, y, 1, 1);
                         cairo_rectangle(cr, x + width - 1, y, 1, 1);
                         cairo_rectangle(cr, x, y + height - 1, 1, 1);
@@ -685,7 +699,7 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
                         cairo_rectangle(cr, x + 0.5, y + 0.5, width - 1, height - 1);
                         cairo_stroke(cr);
 
-                        gdk_cairo_set_source_color(cr, &style->mid[GTK_STATE_NORMAL]);
+                        gdk_cairo_set_source_color(cr, pbg);
                         cairo_rectangle(cr, x, y, 1, 1);
                         cairo_rectangle(cr, x + width - 1, y, 1, 1);
                         cairo_rectangle(cr, x, y + height - 1, 1, 1);
@@ -865,7 +879,7 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
                             cairo_line_to(cr, x + width - 1.5, y + 1.5);
                             cairo_stroke(cr);
 
-                            gdk_cairo_set_source_color(cr, &style->mid[state_type]);
+                            gdk_cairo_set_source_color(cr, pbg);
                             cairo_rectangle(cr, x, y, 1, 1);
                             cairo_rectangle(cr, x + width - 1, y, 1, 1);
                             cairo_rectangle(cr, x, y + height - 1, 1, 1);
@@ -887,7 +901,7 @@ static void draw_shadow(GtkStyle * style, GdkWindow * window, GtkStateType state
                             cairo_line_to(cr, x + width - 0.5, y + 1.5);
                             cairo_stroke(cr);
 
-                            gdk_cairo_set_source_color(cr, &style->mid[state_type]);
+                            gdk_cairo_set_source_color(cr, pbg);
                             cairo_rectangle(cr, x, y, 1, 1);
                             cairo_rectangle(cr, x + width - 1, y, 1, 1);
                             cairo_rectangle(cr, x, y + height - 1, 1, 1);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list