[gtk/wip/exalm/color-scales: 2/3] range: Support border-radius for GtkColorScale troughs
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/exalm/color-scales: 2/3] range: Support border-radius for GtkColorScale troughs
- Date: Wed, 11 May 2022 22:23:57 +0000 (UTC)
commit aee4475c0fb547f32de8f4d4b707346ce22c44c5
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Thu May 12 02:21:51 2022 +0400
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) -
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]