[Xfce4-commits] [xfce/xfce4-settings] 06/09: Cosmetic fixes to cairo drawing of arcs

noreply at xfce.org noreply at xfce.org
Sun Mar 11 13:37:28 CET 2018


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-settings.

commit c960dee69265ee1fdaa9d02124f7634183c3b340
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Tue Feb 20 16:06:11 2018 +0100

    Cosmetic fixes to cairo drawing of arcs
---
 dialogs/accessibility-settings/find-cursor.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/dialogs/accessibility-settings/find-cursor.c b/dialogs/accessibility-settings/find-cursor.c
index 344538c..e1b3833 100644
--- a/dialogs/accessibility-settings/find-cursor.c
+++ b/dialogs/accessibility-settings/find-cursor.c
@@ -31,6 +31,9 @@
 #include <gdk/gdkx.h>
 #include <math.h>
 
+/* global var to keep track of the circle size */
+double px = 10;
+
 
 gboolean timeout (gpointer data)
 {
@@ -62,7 +65,6 @@ find_cursor_window_screen_changed (GtkWidget *widget,
     gtk_widget_set_visual (widget, visual);
 }
 
-double px = 10;
 
 static gboolean
 find_cursor_window_draw (GtkWidget      *window,
@@ -80,6 +82,7 @@ find_cursor_window_draw (GtkWidget      *window,
 
     cairo_set_line_width (cr, 3.0);
     cairo_translate (cr, width / 2, height / 2);
+
     if (px > 90.0)
         arcs = 4;
     else if (px > 60.0)
@@ -87,15 +90,18 @@ find_cursor_window_draw (GtkWidget      *window,
     else if (px > 30.0)
         arcs = 2;
 
+    /* draw fill */
+    cairo_arc (cr, 0, 0, px, 0, 2 * M_PI);
+    cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.5);
+    cairo_fill (cr);
+
+    /* draw several arcs, depending on the radius */
+    cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 1.0);
     for (i = 0; i < arcs; i++) {
         cairo_arc (cr, 0, 0, px - (i * 30.0), 0, 2 * M_PI);
+        cairo_stroke (cr);
     }
 
-    cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.5);
-    cairo_fill_preserve (cr);
-    cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 1.0);
-    cairo_stroke (cr);
-
     /* stop before the circles get bigger than the window */
     if (px > 200)
         gtk_main_quit();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list