[aisleriot] sol: Use gtk style context to render the background



commit 4fe1693667f0f2d96ed23515066eb9be0c84fff4
Author: Christian Persch <chpe gnome org>
Date:   Sun Dec 4 14:38:01 2011 +0100

    sol: Use gtk style context to render the background
    
    This means that the background is now under theme control, ie. you can
    use either a colour or an image to draw it. E.g.:
    
    background-color: #005000;
    
    or:
    
    background-image: url('baize.png');
    background-repeat: repeat;
    
    https://bugzilla.gnome.org/show_bug.cgi?id=425959

 src/ar-style-gtk.c    |    5 +++++
 src/board-noclutter.c |   15 +++++----------
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/ar-style-gtk.c b/src/ar-style-gtk.c
index a8422f3..068781b 100644
--- a/src/ar-style-gtk.c
+++ b/src/ar-style-gtk.c
@@ -53,7 +53,12 @@ ar_style_provider_new (void)
     "" NAME "{\n"
     "-" NAME "-selection-color: " DEFAULT_SELECTION_COLOR_STRING ";\n"
     "-" NAME "-baize-color: " DEFAULT_BAIZE_COLOR_STRING ";\n"
+    "background-color: " DEFAULT_BAIZE_COLOR_STRING ";\n"
   "}\n";
+#if 0
+    "background-image: url('baize.png');\n"
+    "background-repeat: repeat;\n"
+#endif
 #undef NAME
 
   GtkCssProvider *provider;
diff --git a/src/board-noclutter.c b/src/board-noclutter.c
index d658b29..1b7634d 100644
--- a/src/board-noclutter.c
+++ b/src/board-noclutter.c
@@ -2951,16 +2951,11 @@ aisleriot_board_draw (GtkWidget *widget,
 
   /* First paint the background */
 
-  ar_style_get_baize_color (priv->style, &color);
-  gdk_cairo_set_source_rgba (cr, &color);
-
-#ifdef OPTIMISED_EXPOSE
-  gdk_cairo_region (cr, region);
-#else
-  gdk_cairo_rectangle (cr, &clip_rect);
-#endif
-
-  cairo_fill (cr);
+  gtk_render_background (gtk_widget_get_style_context (widget),
+                         cr, 
+                         0, 0,
+                         gtk_widget_get_allocated_width (widget),
+                         gtk_widget_get_allocated_height (widget));
 
   /* Only draw the the cards when the geometry is set, and we're in a resize */
   if (!priv->geometry_set) {



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