[gtk+/gtk-style-context: 140/347] GtkThemingEngine: Improve background rendering.



commit c8b0cf1e51bd03d12a18e1db152787a0e593606c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Aug 2 15:46:08 2010 +0200

    GtkThemingEngine: Improve background rendering.
    
    Now active and selected states are taken into account, and GtkSpinButton
    buttons are special cased.

 gtk/gtkthemingengine.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 547f373..972722e 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -865,7 +865,11 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
   cairo_save (cr);
   flags = gtk_theming_engine_get_state (engine);
 
-  if (flags & GTK_STATE_FLAG_PRELIGHT)
+  if (flags & GTK_STATE_FLAG_ACTIVE)
+    state = GTK_STATE_ACTIVE;
+  else if (flags & GTK_STATE_FLAG_SELECTED)
+    state = GTK_STATE_SELECTED;
+  else if (flags & GTK_STATE_FLAG_PRELIGHT)
     state = GTK_STATE_PRELIGHT;
   else if (flags & GTK_STATE_FLAG_INSENSITIVE)
     state = GTK_STATE_INSENSITIVE;
@@ -882,7 +886,12 @@ gtk_theming_engine_render_background (GtkThemingEngine *engine,
                             NULL);
 
   gdk_cairo_set_source_color (cr, color);
-  cairo_rectangle (cr, x, y, width, height);
+
+  if (gtk_theming_engine_has_class (engine, "spinbutton") &&
+      gtk_theming_engine_has_class (engine, "button"))
+    cairo_rectangle (cr, x + 2, y + 2, width - 4, height - 4);
+  else
+    cairo_rectangle (cr, x, y, width, height);
 
   if (gtk_theming_engine_has_class (engine, "tooltip"))
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]