diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-12-11 15:23:54 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-12-11 15:37:49 -0500 |
commit | 0c076cc8828cd80f1f156a08569199675bf35165 (patch) | |
tree | 06b8861d9125b76c55034d75d2b9a0aa9899fe9e /gladeui/glade-design-view.c | |
parent | ed15bde7cd00c5a799ae6230b48448b3533493bd (diff) | |
download | glade-0c076cc8828cd80f1f156a08569199675bf35165.tar.gz |
Fix use of GTK+ style context APIs
Make sure to save the style context before querying
with other states. This stops GTK+ from warning, and
makes things work.
Diffstat (limited to 'gladeui/glade-design-view.c')
-rw-r--r-- | gladeui/glade-design-view.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gladeui/glade-design-view.c b/gladeui/glade-design-view.c index 598579b7..3dc18bf8 100644 --- a/gladeui/glade-design-view.c +++ b/gladeui/glade-design-view.c @@ -332,11 +332,12 @@ glade_design_view_draw (GtkWidget *widget, cairo_t *cr) GdkWindow *window = gtk_widget_get_window (widget); gboolean should_draw = gtk_cairo_should_draw_window (cr, window); gboolean sw_visible = gtk_widget_get_visible (priv->scrolled_window); + GtkStyleContext *context = gtk_widget_get_style_context (widget); if (should_draw) { if (sw_visible) - gtk_render_background (gtk_widget_get_style_context (widget), + gtk_render_background (context, cr, 0, 0, gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget)); @@ -348,11 +349,14 @@ glade_design_view_draw (GtkWidget *widget, cairo_t *cr) if (should_draw && sw_visible && priv->drag_highlight) { - GtkStyleContext *context = gtk_widget_get_style_context (widget); GdkRGBA c; - gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED | + gtk_style_context_save (context); + gtk_style_context_get_background_color (context, + gtk_style_context_get_state (context) | + GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED, &c); + gtk_style_context_restore (context); cairo_set_line_width (cr, 2); gdk_cairo_set_source_rgba (cr, &c); |