diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-03-08 08:13:56 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-03-08 08:14:36 -0500 |
commit | fdd3c912a0b08573bd8efefe6d40fa00d805196b (patch) | |
tree | 498da6b1e88d60d43757ad60b82036e1bae093fe /demos | |
parent | 1f3c93583a4fc3db1f8d9d085c7f2214365843c5 (diff) | |
download | gtk+-fdd3c912a0b08573bd8efefe6d40fa00d805196b.tar.gz |
gtk-demo: Try to fix foreigndrawing scrollbars
The node hierarchy and sizing has changed with the gadgetization
of range widgets.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/foreigndrawing.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/demos/gtk-demo/foreigndrawing.c b/demos/gtk-demo/foreigndrawing.c index 5488fce2d7..0b45ebd19f 100644 --- a/demos/gtk-demo/foreigndrawing.c +++ b/demos/gtk-demo/foreigndrawing.c @@ -313,24 +313,33 @@ draw_horizontal_scrollbar (GtkWidget *widget, GtkStateFlags state) { GtkStyleContext *scrollbar_context; + GtkStyleContext *contents_context; GtkStyleContext *trough_context; GtkStyleContext *slider_context; /* This information is taken from the GtkScrollbar docs, see "CSS nodes" */ scrollbar_context = get_style (NULL, "scrollbar.horizontal"); - trough_context = get_style (scrollbar_context, "trough"); + contents_context = get_style (scrollbar_context, "contents"); + trough_context = get_style (contents_context, "trough"); slider_context = get_style (trough_context, "slider"); gtk_style_context_set_state (scrollbar_context, state); + gtk_style_context_set_state (contents_context, state); gtk_style_context_set_state (trough_context, state); gtk_style_context_set_state (slider_context, state); + gtk_render_background (scrollbar_context, cr, x, y, width, height); + gtk_render_frame (scrollbar_context, cr, x, y, width, height); + gtk_render_background (contents_context, cr, x, y, width, height); + gtk_render_frame (contents_context, cr, x, y, width, height); gtk_render_background (trough_context, cr, x, y, width, height); gtk_render_frame (trough_context, cr, x, y, width, height); - gtk_render_slider (slider_context, cr, x + position, y + 1, 30, height - 2, GTK_ORIENTATION_HORIZONTAL); + gtk_render_background (slider_context, cr, x + position, y - 2, 30, height + 4); + gtk_render_frame (slider_context, cr, x + position, y, 30, height); g_object_unref (slider_context); g_object_unref (trough_context); + g_object_unref (contents_context); g_object_unref (scrollbar_context); } |