[PATCH 3/9] clock: binary: simplify

Felipe Contreras felipe.contreras at gmail.com
Fri Jun 14 02:40:38 CEST 2019


No need to get the same style twice; we can let C copy the contents of
the struct.

Signed-off-by: Felipe Contreras <felipe.contreras at gmail.com>
---
 plugins/clock/clock-binary.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c
index ff04f0ff..1c599883 100644
--- a/plugins/clock/clock-binary.c
+++ b/plugins/clock/clock-binary.c
@@ -273,12 +273,11 @@ xfce_clock_binary_draw_true_binary (XfceClockBinary *binary,
   GdkRGBA           active_rgba, inactive_rgba;
 
   ctx = gtk_widget_get_style_context (GTK_WIDGET (binary));
-  gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                               &inactive_rgba);
-  inactive_rgba.alpha = 0.2;
   gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
                                &active_rgba);
+  inactive_rgba = active_rgba;
   active_rgba.alpha = 1.0;
+  inactive_rgba.alpha = 0.2;
 
   time = clock_time_get_time (binary->time);
 
@@ -357,12 +356,11 @@ xfce_clock_binary_draw_binary (XfceClockBinary *binary,
   GdkRGBA           active_rgba, inactive_rgba;
 
   ctx = gtk_widget_get_style_context (GTK_WIDGET (binary));
-  gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
-                               &inactive_rgba);
-  inactive_rgba.alpha = 0.2;
   gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (GTK_WIDGET (binary)),
                                &active_rgba);
+  inactive_rgba = active_rgba;
   active_rgba.alpha = 1.0;
+  inactive_rgba.alpha = 0.2;
 
   time = clock_time_get_time (binary->time);
 
-- 
2.22.0.rc2.dirty



More information about the Xfce4-dev mailing list