raj@limbo.UCI.EDU.UUCP (06/05/87)
A while back a version of the xclock program which included an alarm was posted. This program is pretty nice but I noticed two small bugs with it. First, if you cover up the clock and then uncover it, it would sometimes not draw the clock face back completely. Second, if you invoke the program with the command "xalarmclock -analog -update 1" it wouldn't do updates every second whereas if you invoke it with "xalarmclock -update 1 -analog" it would! (By the way, we called the program "xalarmclock" instead of "xclock" so that users could choose whichever one they wanted. Don't be confused.) Anyway, there are the fixes for these two bugs: *** bk_xclock.c Wed May 6 08:59:17 1987 --- xclock.c Thu Jun 4 14:04:57 1987 *************** *** 63,71 **** "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static char *DayName[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; handler () { (void) signal (SIGALRM, handler); ! ShowTime (); (void) alarm (ringing ? 1 : interval); } --- 63,73 ---- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static char *DayName[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + int Inhibit=FALSE; /* inhibit updates while we're drawing the clock */ + handler () { (void) signal (SIGALRM, handler); ! if(! Inhibit) ShowTime (); (void) alarm (ringing ? 1 : interval); } *************** *** 216,232 **** } if (strcmp (*argv, "-analog") == 0) { Iconified = FALSE; - argc--; continue; } if (strcmp (*argv, "-digital") == 0) { Iconified = TRUE; - argc--; continue; } if (strcmp (*argv, "-chime") == 0) { chime = TRUE; - argc--; continue; } } --- 218,231 ---- *************** *** 316,321 **** --- 315,321 ---- register int i; register int delta = (Radius - second_hand) / 3; + Inhibit = TRUE; XClear(AnalogWindow); for (i = 0; i < 60; i++) if ((i % 5) == 0) *************** *** 322,327 **** --- 322,328 ---- DrawHand(second_hand, Radius, ((double) i)/60.); else DrawHand((Radius - delta), Radius, ((double) i)/60.); Sync(FgPixel); + Inhibit = FALSE; } /* ----------------------------------------------------------------------------- Richard A. Johnson raj@rome.uci.edu (Internet) UCI ICS Assistant Technical Manager ucbvax!ucivax!raj (UUCP) Postmaster / Network Services raj@limbo.uci.edu (via Nameservers)