From e33b56ebf1d74a2a8a3890a4f9cbd38d72fa0ba9 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 27 Jun 2023 17:52:53 -0700 Subject: [PATCH] libsysprof-gtk: use color from CSS --- src/libsysprof-gtk/sysprof-time-ruler.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libsysprof-gtk/sysprof-time-ruler.c b/src/libsysprof-gtk/sysprof-time-ruler.c index 7622077d..9fc2a092 100644 --- a/src/libsysprof-gtk/sysprof-time-ruler.c +++ b/src/libsysprof-gtk/sysprof-time-ruler.c @@ -103,6 +103,7 @@ sysprof_time_ruler_snapshot (GtkWidget *widget, guint n_groups; int width; int height; + GdkRGBA color; g_assert (SYSPROF_IS_TIME_RULER (self)); g_assert (GTK_IS_SNAPSHOT (snapshot)); @@ -114,6 +115,13 @@ sysprof_time_ruler_snapshot (GtkWidget *widget, if (self->session == NULL || width == 0 || height == 0) return; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + { + GtkStyleContext *style_context = gtk_widget_get_style_context (widget); + gtk_style_context_get_color (style_context, &color); + } + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + visible_time = sysprof_session_get_visible_time (self->session); n_groups = MAX (width / GROUP_SIZE, 1); time_range = visible_time->end_nsec - visible_time->begin_nsec; @@ -125,7 +133,6 @@ sysprof_time_ruler_snapshot (GtkWidget *widget, t < visible_time->end_nsec; t += tick_interval) { - static const GdkRGBA black = {0,0,0,1}; gint64 o = t - visible_time->begin_nsec; double x = (o / (double)time_range) * width; int pw, ph; @@ -148,11 +155,11 @@ sysprof_time_ruler_snapshot (GtkWidget *widget, gtk_snapshot_save (snapshot); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x-pw-6, (height-ph)/2)); - gtk_snapshot_append_layout (snapshot, layout, &black); + gtk_snapshot_append_layout (snapshot, layout, &color); gtk_snapshot_restore (snapshot); gtk_snapshot_append_color (snapshot, - &black, + &color, &GRAPHENE_RECT_INIT (x, 0, 1, height)); }