1 XDALICLOCK 
Melting digital clock  (version 2.01, 15-May-1994)

SYNOPSIS

 $ xdaliclock [-toolkitoption ...] [-option ...]

2 DESCRIPTION
The xdaliclock program displays a digital clock; when a digit
changes, it ``melts'' into its new shape.

This program was inspired by the Alto and Macintosh programs of the same
name, written by Steve Capps in 1983 or 1984.
2 OPTIONS
Xdaliclock accepts all of the standard toolkit options, and also accepts the
following options:
 
    -help
Print a brief summary of the allowed options on the standard error output.
 
    -12
Use a twelve hour clock.
 
    -24
Use a twenty-four hour clock.
 
    -seconds
Update every second.
 
    -noseconds
Update once per minute; don't display seconds at all.
 
    -cycle
Do color-cycling.
 
    -nocycle
Don't do color-cycling.
 
    -visual visual
Specify which visual to use.  Legal values are:
 
       best
Use the visual which supports the most writable color cells; this is
the default.
 
       default
Use the screen's default visual (the visual of the root window.)  This is
not necessarily the most colorful visual, which is why it is not the default.
 
       class
One of StaticGray, StaticColor, TrueColor, GrayScale, 
PseudoColor, or DirectColor.  Selects the deepest visual of
the given class.
 
       number
A number (decimal or hex) is interpreted as a visual id number, as reported
by the xdpyinfo  program; in this way you can select a shallower visual if 
desired.
 
    -shape
Use the Shape Extension, if it's available, to make the window background be
transparent.  

This doesn't interact terribly well with the twm or tvtwm window
managers, unless they have been configured to not put a titlebar on
the xdaliclock window.  If this isn't specified in your .twmrc
or .tvtwmrc file, then the window will flicker constantly, as the
window manager tries to add and remove the titlebar ten times each second.

Also, this turns most X servers into huge cycle hogs.  This is probably
because of inefficient implementations of the Shape extension.
 
    -noshape
Don't use the Shape Extension.
 
    -memory low
Use high-bandwidth, low-memory mode.  If you have a very fast connection
between the machine this program is running on and the X server it is
displaying on, then xdaliclock can work correctly by simply making
the drawing requests it needs when it needs them.  This is the elegant
method.  However, the amount of data necessary to animate the display 
ends up being a bit over 10 kilobytes worth of X Protocol per second.  On a
fast machine with a local display, or over a fast network, that's almost
negligible, but (for example) an NCD X Terminal at 38.4 kilobaud can't 
keep up.  That is the reason for:
 
    -memory medium
Use high-memory, low-bandwidth mode.  In this mode, xdaliclock
precomputes most of the frames that it will ever need.  This is the
sleazy copout method.  The bandwidth requirements are drastically 
reduced, because instead of telling the server what bits to draw where, 
it merely tells it what pixmaps to copy into the window.  Aside from the 
fact that I consider this to be cheating, the only downside of this
method is that those pixmaps (about 170 of them, each the size of one
character) are consuming server-memory.  This probably isn't a very big deal,
unless you're using an exceptionally large font.
 
    -memory high
With memory set to high, the cache is twice as 
large (the n -> n+2 transitions are cached as well as the n -> n+1
ones).  Even with memory set to medium, this program can seem sluggish 
when using the builtin font over a very slow connection to the display server.
 
    -font fontname
Specifies the X font to use; xdaliclock can correctly animate any font
that contains all the digits plus colon and slash, and in which the letters
aren't excessively curly.

The xdaliclock program contains a pair of builtin bitmapped fonts,
which are larger and more attractive than the standard X fonts.  One of
these fonts will be used if the -font option is given one of the
fontnames BUILTIN or BUILTIN2.
 
    -builtin
This is the same as specifying -font BUILTIN.
 
    -builtin2
This is the same as specifying -font BUILTIN2.
 
    -fullscreen
Make the window take up the whole screen.  When -fullscreen is 
specified, the displayed time will wander around a little, to prevent
any pixels from being on continuously and causing phosphor burn-in.
 
    -root
Display the clock on the root window instead of in its own window.
This makes the digits wander around too.

The following standard X Toolkit command line arguments are commonly 
used with xdaliclock:
 
    -display host:dpy
This option specifies the X server to contact.
 
    -geometry geometry
This option specifies the prefered size and position of the clock window.
 
    -bg color
This option specifies the color to use for the background of the window.
The default is ``white.''
 
    -fg color
This option specifies the color to use for the foreground of the window.
The default is ``black.''
 
    -bd color
This option specifies the color to use for the border of the window.
The default is the same as the foreground color.
 
    -rv
This option indicates that reverse video should be simulated by swapping
the foreground and background colors.
 
    -bw number
This option specifies the width in pixels of the border surrounding 
the window.
 
    -xrm resourcestring
This option specifies a resource string to be used.

2 COMMANDS
Clicking and holding any mouse button in the xdaliclock window will
cause it to display the date while the button is held.

Typing ``space'' at the xdaliclock window will toggle between a 
twelve hour and twenty-four hour display.

Typing ``q'' or ``C-c'' at the window quits.

If the xdaliclock window is iconified or otherwise unmapped, it
will go to sleep until it is mapped again.

2 X_DEFAULTS
xdaliclock understands all of the core resource names and
classes as well as:

 
   seconds (class Seconds)
Whether to display seconds.  
If true, this is the same as the -seconds command line argument;
if false, this is the same as -noseconds.
 
   cycle (class Cycle)
Whether to do color cycling.
If true, this is the same as the -cycle command line argument;
if false, this is the same as -nocycle.
 
   shape (class Shape)
Whether to use the Shape Extension, if available.
If true, this is the same as the -shape command line argument;
if false, this is the same as -noshape.
 
   memory (class Memory)
This must be high, medium, or low, the same as
the -memory command-line option.
 
   font (class Font)
The same as the -font command line option: the font to melt.
If this is the string BUILTIN, then the large builtin font is
used.  If this is the string BUILTIN2, then the even larger
builtin font is used.  Otherwise, this must be the name of a valid X font.
 
   mode (class Mode)
Whether to display 12-hour or 24-hour time.
If 12, this is the same as the -12 command line argument;
if 24, this is the same as -24.
 
   datemode (class DateMode)
Specifies how the date should be printed when a mouse button is held down.
This may be one of the strings mm/dd/yy, dd/mm/yy,
yy/mm/dd, yy/dd/mm, mm/yy/dd, or dd/yy/mm.
The default is mm/dd/yy.  If seconds are not being displayed, then
only the first four digits will ever be displayed (mm/dd instead
of mm/dd/yy, for example.)
 
   fullScreen (class FullScreen)
The same as the -fullscreen command-line option.
 
   root (class Root)
The same as the -root command-line option.
 
   visualID (class VisualID)
The same as the -visual command-line option.

2 ENVIRONMENT

   DISPLAY
to get the default host and display number.

   XENVIRONMENT
to get the name of a resource file that overrides the global resources
stored in the RESOURCE_MANAGER property.

   TZ
to get the current time zone.  If you want to force the clock to display
some other time zone, set this variable before starting it.  For example:

$ TZ=GMT0 xdaliclock
% ( setenv TZ PST8PDT ; xdaliclock )

You may notice that the format of the TZ variable (which is used by the
C library ctime (3)
and localtime (3)
routines) is not actually documented anywhere.  The fourth character (the
digit) is the only thing that really matters: it is the offset in hours from
GMT.  The first three characters are ignored.  The last three characters are
used to flag daylight savings time: their presence effectively adds 1 to the
zone offset.  (I am not making this up...)

2 BUGS
Other system load will sometimes cause the second-display to increment
by more than one second at a time, in order to remain synchronized to 
the current time.

The -memory option is disgusting and shouldn't be necessary, but I'm
not clever enough to eliminate it.  It has been said that hacking graphics
in X is like finding sqrt(pi) with roman numerals.

When using a small font (less than 48x56 or so) it's possible that shipping
a bitmap to the server would be more efficient than sending a DrawSegments
request (since the endpoints are specified using 16 bits each, when all that
we really need is 6 or 7 bits.)

Support for the Shared Memory Extension would be a good thing.

It should display the day of the week somewhere.

The color cycling should be less predictable; it should vary saturation and
intensity as well, and should be more careful that foreground and background
contrast well.

Should have a -analog mode (maybe someday...)

2 COPYRIGHT
Copyright (© 1991, 1992, 1993, 1994 by Jamie Zawinski.  Permission to use, 
copy, modify, distribute, and sell this software and its documentation for 
any purpose is hereby granted without fee, provided that the above copyright
notice appear in all copies and that both that copyright notice and this
permission notice appear in supporting documentation.  No representations are
made about the suitability of this software for any purpose.  It is provided
"as is" without express or implied warranty.

2 AUTHOR
Jamie Zawinski <jwz@lucid.com>, 18-sep-91.

Please let me know if you find any bugs or make any improvements.

Thanks to Ephraim Vishniac <ephraim@think.com> for explaining the format of
the bitmap resources in the Macintosh version of this, so that I could snarf
them for the -builtin fonts.

And thanks to Steve Capps for the really great idea.
