Package: buici-clock
Version: 0.4.9.4

buici-clock manpage documents a showSecondHand resource/option, but does not actually implement it. The below patch implements the documented behaviour.

How to reproduce:

Run "buici-clock --show-second-hand=0", observer that it incorrectly displays a ticking second-hand.

Fix: apply the patch below:

diff -u buici-clock-0.4.9.2-orig/clock.cxx buici-clock-0.4.9.2/clock.cxx
--- buici-clock-0.4.9.2-orig/clock.cxx  2011-07-25 12:54:11.000000000 -0700
+++ buici-clock-0.4.9.2/clock.cxx       2014-10-19 03:55:19.862690022 -0700
@@ -106,7 +106,8 @@
 void draw_dial (Display* display, Visual* visual,
                Pixmap pixmap, int dx, int dy);
 void draw_hands (Display* display, Visual* visual,
-               Pixmap pixmap, int dx, int dy, int seconds);
+               Pixmap pixmap, int dx, int dy, int seconds,
+               bool showSecondHand);
 void draw_dial_shape (Display* display, Pixmap pixmap, int dx, int dy);

 class WTopLevel : public LWindow {
@@ -538,7 +539,7 @@
             _gc, 0, 0, width (), height (), 0, 0);


-  draw_hands (xdisplay (), xvisual (), pixmap, width (), height (), seconds);
+  draw_hands (xdisplay (), xvisual (), pixmap, width (), height (), seconds, 
m_fSecondHand);

 #if 0
                                // -- Draw hands
diff -u buici-clock-0.4.9.2-orig/draw.cc buici-clock-0.4.9.2/draw.cc
--- buici-clock-0.4.9.2-orig/draw.cc    2011-07-25 12:54:11.000000000 -0700
+++ buici-clock-0.4.9.2/draw.cc 2014-10-19 03:55:50.805687985 -0700
@@ -145,7 +145,8 @@


 void draw_hands (Display* display, Visual* visual,
-                Pixmap pixmap, int dx, int dy, int seconds)
+                Pixmap pixmap, int dx, int dy, int seconds,
+                bool showSecondHand)
 {
   cairo_surface_t* s = cairo_xlib_surface_create (display, pixmap, visual,
                                                  dx, dy);
@@ -198,16 +199,18 @@
     cairo_path_destroy (path);

        // Second hand
-    cairo_save (cr);
-    cairo_rotate (cr, ((2.0*M_PI)*seconds)/60.0);
-    cairo_set_line_width (cr, WIDTH_THIN);
-    cairo_move_to (cr, 0,  (DY/2.0)*0.20);
-    cairo_line_to (cr, 0, -(DY/2.0)*0.64);
-    cairo_set_source_rgb (cr, 1.0, 0, 0);
-    cairo_stroke (cr);
-    cairo_arc (cr, 0, -(DY/2.0)*0.64, DX*0.03, 0, 2*M_PI);
-    cairo_fill (cr);
-    cairo_restore (cr);
+    if (showSecondHand){
+        cairo_save (cr);
+        cairo_rotate (cr, ((2.0*M_PI)*seconds)/60.0);
+        cairo_set_line_width (cr, WIDTH_THIN);
+        cairo_move_to (cr, 0,  (DY/2.0)*0.20);
+        cairo_line_to (cr, 0, -(DY/2.0)*0.64);
+        cairo_set_source_rgb (cr, 1.0, 0, 0);
+        cairo_stroke (cr);
+        cairo_arc (cr, 0, -(DY/2.0)*0.64, DX*0.03, 0, 2*M_PI);
+        cairo_fill (cr);
+        cairo_restore (cr);
+    }
   }

   cairo_destroy (cr);


 -Jason

Reply via email to