[gtk+/gtk-style-context: 144/191] GtkThemingEngine: Improve background rendering.



commit 331f0f3eaaaa7df2a8fd8d8eae9dab15deaf3265
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]