summaryrefslogtreecommitdiff
path: root/gtk/gtkdrawingarea.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2015-06-03 17:59:45 -0700
committerCosimo Cecchi <cosimoc@gnome.org>2015-07-01 16:09:22 -0700
commit6786c9d724ad57ea30e169d2afcb4a314b2e56bb (patch)
treed29f33593dce18d1a03d8fe2592843dc553a3256 /gtk/gtkdrawingarea.c
parent9258b40c8b26f6d3c0591c61ad1bb7595d2273e5 (diff)
downloadgtk+-6786c9d724ad57ea30e169d2afcb4a314b2e56bb.tar.gz
drawingarea: don't call gtk_style_context_set_background()
Diffstat (limited to 'gtk/gtkdrawingarea.c')
-rw-r--r--gtk/gtkdrawingarea.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c
index a9b659ee1c..94034059e1 100644
--- a/gtk/gtkdrawingarea.c
+++ b/gtk/gtkdrawingarea.c
@@ -25,9 +25,9 @@
#include "config.h"
#include "gtkdrawingarea.h"
#include "gtkintl.h"
+#include "gtkrender.h"
#include "gtkstylecontext.h"
-
/**
* SECTION:gtkdrawingarea
* @Short_description: A widget for custom user interface elements
@@ -112,6 +112,8 @@
* gtk_render_focus() for one way to draw focus.
*/
+static gboolean gtk_drawing_area_draw (GtkWidget *widget,
+ cairo_t *cr);
static void gtk_drawing_area_realize (GtkWidget *widget);
static void gtk_drawing_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
@@ -126,6 +128,7 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class)
widget_class->realize = gtk_drawing_area_realize;
widget_class->size_allocate = gtk_drawing_area_size_allocate;
+ widget_class->draw = gtk_drawing_area_draw;
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_DRAWING_AREA);
}
@@ -181,9 +184,6 @@ gtk_drawing_area_realize (GtkWidget *widget)
&attributes, attributes_mask);
gtk_widget_register_window (widget, window);
gtk_widget_set_window (widget, window);
-
- gtk_style_context_set_background (gtk_widget_get_style_context (widget),
- window);
}
gtk_drawing_area_send_configure (GTK_DRAWING_AREA (widget));
@@ -209,6 +209,19 @@ gtk_drawing_area_size_allocate (GtkWidget *widget,
}
}
+static gboolean
+gtk_drawing_area_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ if (gtk_widget_get_has_window (widget))
+ gtk_render_background (gtk_widget_get_style_context (widget), cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+
+ return GTK_WIDGET_CLASS (gtk_drawing_area_parent_class)->draw (widget, cr);
+}
+
static void
gtk_drawing_area_send_configure (GtkDrawingArea *darea)
{