[Pkg-wmaker-commits] [wmclock] 40/66: debian/patches/add_interval_option.patch - Add -interval option for blink cycle (Closes: #228986).

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 10:52:53 UTC 2015


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

dtorrance-guest pushed a commit to branch master
in repository wmclock.

commit 85d43ddbdd650f5eafa4c586de511796fd695302
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Thu Jul 31 03:29:04 2014 -0500

    debian/patches/add_interval_option.patch - Add -interval option for blink cycle (Closes: #228986).
---
 debian/patches/add_interval_option.patch | 147 +++++++++++++++++++++++++++++++
 debian/patches/series                    |   1 +
 2 files changed, 148 insertions(+)

diff --git a/debian/patches/add_interval_option.patch b/debian/patches/add_interval_option.patch
new file mode 100644
index 0000000..795e094
--- /dev/null
+++ b/debian/patches/add_interval_option.patch
@@ -0,0 +1,147 @@
+Description: Add -interval option.
+ The user has the ability to set the interval at which the clock blinks by
+ using the -interval or --interval option with a given number of seconds.  The
+ default is 2 (1 on, 1 off), the traditional behavior of wmclock.
+ .
+ In order to have a blinking cycle with an odd number of seconds, nextEvent now
+ keeps track of the next half-second instead of the next second.
+Author: Doug Torrance <dtorrance at monmouthcollege.edu>
+Bug-Debian: http://bugs.debian.org/228986
+Last-Update: 2014-07-31
+
+--- a/wmclock.c
++++ b/wmclock.c
+@@ -146,6 +146,7 @@
+ int enableBlinking = 1;		/* default is blinking */
+ int startIconified = 0;		/* default is not iconified */
+ int enableYearDisplay = 0;	/* default is to show time, not year */
++int blinkInterval = 2;          /* default is a 2-second blink cycle */
+ 
+ int timePos12[NUM_TIME_POSITIONS]  = { 5, 14, 24, 28, 37 };
+ int timePos24[NUM_TIME_POSITIONS]  = { 4,  8, 17, 22, 31 };
+@@ -207,6 +208,7 @@
+ "    -24                     show 24-hour time",
+ "    -year                   show year instead of time",
+ "    -noblink                don't blink",
++"    -interval <seconds>     set blink interval",
+ "    -exe <command>          start <command> on mouse click",
+ "    -led <color>            use <color> as color of led",
+ #ifndef ONLY_SHAPED_WINDOW
+@@ -799,6 +801,16 @@
+ 	{
+ 	   showUsage();
+ 	}
++       else if ((0 == strcmp(argv[i], "-interval")) ||
++		(0 == strcmp(argv[i], "--interval")))
++	{
++	   if (++i >= argc)
++	    {
++	       showUsage();
++	    }
++	   blinkInterval = atoi(argv[i]);
++	}
++
+        else
+ 	{
+ 	   fprintf(stderr, "%s: unrecognized option `%s'\n",
+@@ -822,6 +834,7 @@
+    XClassHint    classHint;
+    Pixmap        shapeMask;
+    struct timeval nextEvent;
++   unsigned int   blinkCounter = 0;
+    
+    /* Parse command line options */
+    progName = extractProgName(argv[0]);
+@@ -962,26 +975,6 @@
+ 		  redrawWindow(&visible);
+ 		}
+ 	    }
+-	  if (enableBlinking && (!enableYearDisplay))
+-	    {  
+-	       if (actualTime % 2)
+-		{
+-		   /* Sekunden Doppelpunkt ein */
+-		   XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
+-			     COLON_X_OFFSET, COLON_Y_OFFSET,
+-			     COLON_WIDTH, COLON_HEIGHT,
+-			     xPos[COLON_X_POS], yPos[COLON_Y_POS]);
+-		}
+-	       else
+-		{
+-		   /* Sekunden Doppelpunkt aus */
+-		   XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
+-			     BLANK_X_OFFSET, BLANK_Y_OFFSET,
+-			     COLON_WIDTH, COLON_HEIGHT,
+-			     xPos[COLON_X_POS], yPos[COLON_Y_POS]);
+-		}
+-	       redrawWindow(&visible);
+-	    }
+ 	   if (0 == (actualTime % 2))
+ 	    {
+ 	       /* Clean up zombie processes */
+@@ -995,7 +988,38 @@
+ 		}
+ 	    }
+ 	}
+-       
++       if (enableBlinking && (!enableYearDisplay))
++        {
++            blinkCounter++;
++#ifdef SYSV
++            if (blinkCounter >= 20*blinkInterval)
++#else
++            if (blinkCounter >= 2*blinkInterval)
++#endif
++                blinkCounter = 0;
++            if (blinkCounter == 0)
++	     {
++                /* Sekunden Doppelpunkt ein */
++		XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
++			  COLON_X_OFFSET, COLON_Y_OFFSET,
++			  COLON_WIDTH, COLON_HEIGHT,
++			  xPos[COLON_X_POS], yPos[COLON_Y_POS]);
++	     }
++#ifdef SYSV
++	    if (blinkCounter == 10*blinkInterval)
++#else
++	    if (blinkCounter == blinkInterval)
++#endif
++	     {
++		    /* Sekunden Doppelpunkt aus */
++		    XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
++			      BLANK_X_OFFSET, BLANK_Y_OFFSET,
++			      COLON_WIDTH, COLON_HEIGHT,
++			      xPos[COLON_X_POS], yPos[COLON_Y_POS]);
++	     }
++	    redrawWindow(&visible);
++        }
++
+        /* read a packet */
+        while (XPending(dpy))
+ 	{
+@@ -1075,7 +1099,10 @@
+ 	 {
+ 	   gettimeofday(&nextEvent,NULL);
+ 	   nextEvent.tv_sec = 0;
+-	   nextEvent.tv_usec = 1000000-nextEvent.tv_usec;
++	   if (nextEvent.tv_usec < 500000)
++		   nextEvent.tv_usec = 500000-nextEvent.tv_usec;
++	   else
++		   nextEvent.tv_usec = 1000000-nextEvent.tv_usec;
+ 	 }
+        else
+ 	 {
+--- a/wmclock.man.in
++++ b/wmclock.man.in
+@@ -61,6 +61,11 @@
+ by default.  This option turns off the blinking and displays a steadily
+ lit separator instead.
+ .TP
++\fB\-interval\fI n\fR
++Set the blink cycle to
++.I n
++seconds.  The default is 2 (1 second on, 1 second off).
++.TP
+ \fB\-version\fB
+ Displays the version of Wmclock.
+ .TP
diff --git a/debian/patches/series b/debian/patches/series
index 04b46ca..26f2fa7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ manpage_xpm_notes.patch
 fix_12_year_display.patch
 correct_year.patch
 hardening.patch
+add_interval_option.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmclock.git



More information about the Pkg-wmaker-commits mailing list