From aee4475c0fb547f32de8f4d4b707346ce22c44c5 Mon Sep 17 00:00:00 2001 From: Alexander Mikhaylenko Date: Thu, 12 May 2022 02:21:51 +0400 Subject: [PATCH] range: Support border-radius for GtkColorScale troughs With how this hack is organized, it's simpler to add more code here than to pass it to GtkColorScale itself. --- gtk/gtkrange.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index f185ab6763..fbb1d183d9 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -30,6 +30,7 @@ #include "gtkaccessible.h" #include "gtkadjustmentprivate.h" #include "gtkcolorscaleprivate.h" +#include "gtkcssboxesprivate.h" #include "gtkenums.h" #include "gtkeventcontrollerkey.h" #include "gtkeventcontrollerscroll.h" @@ -42,6 +43,7 @@ #include "gtkorientable.h" #include "gtkprivate.h" #include "gtkscale.h" +#include "gtksnapshot.h" #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" @@ -1670,9 +1672,15 @@ gtk_range_render_trough (GtkGizmo *gizmo, * so we let it... */ if (GTK_IS_COLOR_SCALE (widget)) - gtk_color_scale_snapshot_trough (GTK_COLOR_SCALE (widget), snapshot, - gtk_widget_get_width (GTK_WIDGET (gizmo)), - gtk_widget_get_height (GTK_WIDGET (gizmo))); + { + GtkCssBoxes boxes; + gtk_css_boxes_init (&boxes, GTK_WIDGET (gizmo)); + gtk_snapshot_push_rounded_clip (snapshot, gtk_css_boxes_get_padding_box (&boxes)); + gtk_color_scale_snapshot_trough (GTK_COLOR_SCALE (widget), snapshot, + gtk_widget_get_width (GTK_WIDGET (gizmo)), + gtk_widget_get_height (GTK_WIDGET (gizmo))); + gtk_snapshot_pop (snapshot); + } if (priv->show_fill_level && gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment) - -- 2.30.2