[recipes/chef-bio: 4/5] timer-widget: set color from context
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/chef-bio: 4/5] timer-widget: set color from context
- Date: Mon, 12 Dec 2016 14:13:05 +0000 (UTC)
commit 9b25d5aebcf11a79f5a87eecefd358f5b33636a4
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Mon Dec 12 16:42:19 2016 +0530
timer-widget: set color from context
blindly setting the color to (0, 0, 0) may not be good, as it can
have contrast issue in different themes.
This commit gets the GdkRGBA color and sets the cairo surface.
https://bugzilla.gnome.org/show_bug.cgi?id=775976
src/gr-timer-widget.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-timer-widget.c b/src/gr-timer-widget.c
index 01099c8..10b1706 100644
--- a/src/gr-timer-widget.c
+++ b/src/gr-timer-widget.c
@@ -196,6 +196,7 @@ gr_timer_widget_draw (GtkWidget *widget,
{
GrTimerWidget *timer = GR_TIMER_WIDGET (widget);
GtkStyleContext *context;
+ GdkRGBA color;
gint width, height;
double xc, yc;
double radius;
@@ -215,7 +216,8 @@ gr_timer_widget_draw (GtkWidget *widget,
now = g_get_monotonic_time ();
- cairo_set_source_rgb (cr, 0, 0, 0);
+ gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget), &color);
+ gdk_cairo_set_source_rgba (cr, &color);
xc = width / 2;
yc = height / 2;
radius = width / 2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]