[gtk+] drawingarea: Update docs around background handling



commit 5a80a35757d38b1ae66a31155e87be3a68770650
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 21 00:46:54 2016 -0500

    drawingarea: Update docs around background handling
    
    The behavior changed this cycle. Update the docs to recommend
    an explicit gtk_render_background call.

 gtk/gtkdrawingarea.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c
index 36ec5b8..261bf34 100644
--- a/gtk/gtkdrawingarea.c
+++ b/gtk/gtkdrawingarea.c
@@ -56,9 +56,10 @@
  * area to display a circle in the normal widget foreground
  * color.
  *
- * Note that GDK automatically clears the exposed area to the
- * background color before sending the expose event, and that
- * drawing is implicitly clipped to the exposed area.
+ * Note that GDK automatically clears the exposed area before sending
+ * the expose event, and that drawing is implicitly clipped to the exposed
+ * area. If you want to have a theme-provided background, you need
+ * to call gtk_render_background() in your ::draw method.
  *
  * ## Simple GtkDrawingArea usage
  *
@@ -68,16 +69,22 @@
  * {
  *   guint width, height;
  *   GdkRGBA color;
+ *   GtkStyleContext *context;
+ *
+ *   context = gtk_widget_get_style_context (widget);
  *
  *   width = gtk_widget_get_allocated_width (widget);
  *   height = gtk_widget_get_allocated_height (widget);
+ *
+ *   gtk_render_background (context, cr, 0, 0, width, height);
+ *
  *   cairo_arc (cr,
  *              width / 2.0, height / 2.0,
  *              MIN (width, height) / 2.0,
  *              0, 2 * G_PI);
  *
- *   gtk_style_context_get_color (gtk_widget_get_style_context (widget),
- *                                0,
+ *   gtk_style_context_get_color (context,
+ *                                gtk_style_context_get_state (context),
  *                                &color);
  *   gdk_cairo_set_source_rgba (cr, &color);
  *


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