pkg://wmclock-1.0.12.2-3.src.rpm:45630/wmclock-1.0.12.2.tar.gz
info downloads
wmclock-1.0.12.2/ 0040775 0001356 0001356 00000000000 07075276300 013576 5 ustar jmknoble jmknoble wmclock-1.0.12.2/wmclock.spec.in 0100664 0001356 0000012 00000006357 07075276024 016020 0 ustar jmknoble wheel # User-Defined Macros:
# %%define <name> <expansion>
%define Name wmclock
%define Version @VERSION@
%define Release 1
%define Prefix /usr
%define ExecPrefix /usr/X11R6
Summary: dockable clock applet for Window Maker
Name: %{Name}
Version: %{Version}
Release: %{Release}
#Epoch:
Copyright: GPL
Group: User Interface/X
URL: http://www.pobox.com/~jmknoble/WindowMaker/wmclock/
Source0: http://www.pobox.com/~jmknoble/WindowMaker/wmclock/%{Name}-%{Version}.tar.gz
#Patch0:
#Prefix: %{Prefix}
BuildRoot: /tmp/%{Name}-%{Version}-%{Release}-root
#Provides:
#Requires:
#Obsoletes:
%description
Wmclock is an applet which displays the date and time in a dockable
tile in the same style as the clock from the NEXTSTEP(tm) operating
system. Wmclock is specially designed for the Window Maker window
manager, by Alfredo Kojima, and features multiple language support,
twenty-four-hour and twelve-hour (am/pm) time display, and, optionally,
can run a user-specified program on a mouse click. Wmclock is derived
from asclock, a similar clock for the AfterStep window manager.
%prep
%setup
#%patch0 -b .orig
#function Replace() {
# local fil="$1"
# local sep="$2"
# local old="$3"
# local new="$4"
# local suf="$5"
# [ -z "${suf}" ] && suf='~'
# mv -f ${fil} ${fil}${suf}
# cat ${fil}${suf} | sed -e "s${sep}${old}${sep}${new}${sep}g" >$fil
#}
%build
if [ -z "${CC}" ]; then
if [ -n "`which gcc`" ]; then
CC="gcc"
else
CC="cc"
fi
fi
export CC
./configure --lang english
make CC="${CC}" CDEBUGFLAGS="${RPM_OPT_FLAGS}"
%install
function CheckBuildRoot() {
# do a few sanity checks on the BuildRoot
# to make sure we don't damage a system
case "${RPM_BUILD_ROOT}" in
''|' '|/|/bin|/boot|/dev|/etc|/home|/lib|/mnt|/root|/sbin|/tmp|/usr|/var)
echo "Yikes! Don't use '${RPM_BUILD_ROOT}' for a BuildRoot!"
echo "The BuildRoot gets deleted when this package is rebuilt;"
echo "something like '/tmp/build-blah' is a better choice."
return 1
;;
*) return 0
;;
esac
}
function CleanBuildRoot() {
if CheckBuildRoot; then
rm -rf "${RPM_BUILD_ROOT}"
else
exit 1
fi
}
CleanBuildRoot
for i in \
%{Prefix} \
%{Prefix}/share \
%{Prefix}/share/%{Name} \
%{ExecPrefix} \
; do
mkdir -p "${RPM_BUILD_ROOT}${i}"
done
make DESTDIR="${RPM_BUILD_ROOT}" install
make DESTDIR="${RPM_BUILD_ROOT}" install.man
make DESTDIR="${RPM_BUILD_ROOT}" install.share
%clean
function CheckBuildRoot() {
# do a few sanity checks on the BuildRoot
# to make sure we don't damage a system
case "${RPM_BUILD_ROOT}" in
''|' '|/|/bin|/boot|/dev|/etc|/home|/lib|/mnt|/root|/sbin|/tmp|/usr|/var)
echo "Yikes! Don't use '${RPM_BUILD_ROOT}' for a BuildRoot!"
echo "The BuildRoot gets deleted when this package is rebuilt;"
echo "something like '/tmp/build-blah' is a better choice."
return 1
;;
*) return 0
;;
esac
}
function CleanBuildRoot() {
if CheckBuildRoot; then
rm -rf "${RPM_BUILD_ROOT}"
else
exit 1
fi
}
CleanBuildRoot
%files
%attr(- ,root,root) %doc COPYING ChangeLog INSTALL README
%attr(0755,root,root) %{ExecPrefix}/bin/wmclock
%attr(0755,root,root) %{ExecPrefix}/man/man1/wmclock.1*
%attr(0755,root,root) %dir %{Prefix}/share/wmclock
%attr(- ,root,root) %{Prefix}/share/wmclock/*
wmclock-1.0.12.2/wmclock.spec 0100664 0001356 0001356 00000006356 07075276276 016134 0 ustar jmknoble jmknoble # User-Defined Macros:
# %%define <name> <expansion>
%define Name wmclock
%define Version 1.0.12.2
%define Release 1
%define Prefix /usr
%define ExecPrefix /usr/X11R6
Summary: dockable clock applet for Window Maker
Name: %{Name}
Version: %{Version}
Release: %{Release}
#Epoch:
Copyright: GPL
Group: User Interface/X
URL: http://www.pobox.com/~jmknoble/WindowMaker/wmclock/
Source0: http://www.pobox.com/~jmknoble/WindowMaker/wmclock/%{Name}-%{Version}.tar.gz
#Patch0:
#Prefix: %{Prefix}
BuildRoot: /tmp/%{Name}-%{Version}-%{Release}-root
#Provides:
#Requires:
#Obsoletes:
%description
Wmclock is an applet which displays the date and time in a dockable
tile in the same style as the clock from the NEXTSTEP(tm) operating
system. Wmclock is specially designed for the Window Maker window
manager, by Alfredo Kojima, and features multiple language support,
twenty-four-hour and twelve-hour (am/pm) time display, and, optionally,
can run a user-specified program on a mouse click. Wmclock is derived
from asclock, a similar clock for the AfterStep window manager.
%prep
%setup
#%patch0 -b .orig
#function Replace() {
# local fil="$1"
# local sep="$2"
# local old="$3"
# local new="$4"
# local suf="$5"
# [ -z "${suf}" ] && suf='~'
# mv -f ${fil} ${fil}${suf}
# cat ${fil}${suf} | sed -e "s${sep}${old}${sep}${new}${sep}g" >$fil
#}
%build
if [ -z "${CC}" ]; then
if [ -n "`which gcc`" ]; then
CC="gcc"
else
CC="cc"
fi
fi
export CC
./configure --lang english
make CC="${CC}" CDEBUGFLAGS="${RPM_OPT_FLAGS}"
%install
function CheckBuildRoot() {
# do a few sanity checks on the BuildRoot
# to make sure we don't damage a system
case "${RPM_BUILD_ROOT}" in
''|' '|/|/bin|/boot|/dev|/etc|/home|/lib|/mnt|/root|/sbin|/tmp|/usr|/var)
echo "Yikes! Don't use '${RPM_BUILD_ROOT}' for a BuildRoot!"
echo "The BuildRoot gets deleted when this package is rebuilt;"
echo "something like '/tmp/build-blah' is a better choice."
return 1
;;
*) return 0
;;
esac
}
function CleanBuildRoot() {
if CheckBuildRoot; then
rm -rf "${RPM_BUILD_ROOT}"
else
exit 1
fi
}
CleanBuildRoot
for i in \
%{Prefix} \
%{Prefix}/share \
%{Prefix}/share/%{Name} \
%{ExecPrefix} \
; do
mkdir -p "${RPM_BUILD_ROOT}${i}"
done
make DESTDIR="${RPM_BUILD_ROOT}" install
make DESTDIR="${RPM_BUILD_ROOT}" install.man
make DESTDIR="${RPM_BUILD_ROOT}" install.share
%clean
function CheckBuildRoot() {
# do a few sanity checks on the BuildRoot
# to make sure we don't damage a system
case "${RPM_BUILD_ROOT}" in
''|' '|/|/bin|/boot|/dev|/etc|/home|/lib|/mnt|/root|/sbin|/tmp|/usr|/var)
echo "Yikes! Don't use '${RPM_BUILD_ROOT}' for a BuildRoot!"
echo "The BuildRoot gets deleted when this package is rebuilt;"
echo "something like '/tmp/build-blah' is a better choice."
return 1
;;
*) return 0
;;
esac
}
function CleanBuildRoot() {
if CheckBuildRoot; then
rm -rf "${RPM_BUILD_ROOT}"
else
exit 1
fi
}
CleanBuildRoot
%files
%attr(- ,root,root) %doc COPYING ChangeLog INSTALL README
%attr(0755,root,root) %{ExecPrefix}/bin/wmclock
%attr(0755,root,root) %{ExecPrefix}/man/man1/wmclock.1*
%attr(0755,root,root) %dir %{Prefix}/share/wmclock
%attr(- ,root,root) %{Prefix}/share/wmclock/*
wmclock-1.0.12.2/Imakefile 0100664 0001356 0001356 00000003772 07075276063 015423 0 ustar jmknoble jmknoble NAME = wmclock
VERSION = 1.0.12.2
DATE = 2000-Apr-13
MAKE_CHANGELOG = cvs2cl
DEFINES = -DVERSION=\"$(VERSION)\"
XPMLIB = -L/usr/lib/X11 -lXpm
DEPLIBS = $(DEPXLIB)
LOCAL_LIBRARIES = $(XPMLIB) $(XLIB)
LINTLIBS = $(LINTXLIB)
SHAREDIR = /usr/share/$(NAME)
IMAKEFILE = Imakefile
MAKEFILE = Makefile
CHANGELOG = ChangeLog
SPEC_SRC = $(NAME).spec.in
SPEC_OBJ = $(NAME).spec
SPECS = $(SPEC_SRC) $(SPEC_OBJ)
EXTRA_FILES = \@@\
$(SPECS) \@@\
$(IMAKEFILE) \@@\
$(CHANGELOG) \@@\
COPYING \@@\
INSTALL \@@\
README \@@\
configure
EXTRA_DIRS = \@@\
asclock-orig \@@\
lang.* \@@\
xpm
MANSRC = wmclock.man.in
MANOBJ = wmclock.man
SYMLINKS = month.xpm weekday.xpm
HDRS = dynlist.h
SRCS = dynlist.c wmclock.c
OBJS = dynlist.o wmclock.o
TARDIR = $(NAME)-$(VERSION)
TARBALL = $(TARDIR).tar.gz
ComplexProgramTarget($(NAME))
depend::
cat $(MANSRC) |sed \@@\
-e 's/@VERSION@/$(VERSION)/g' \@@\
-e 's/@DATE@/$(DATE)/g' \@@\
>$(MANOBJ)
.PHONY: depends changelog spec realclean spotless tar
spec: $(SPEC_OBJ)
$(SPEC_OBJ): $(SPEC_SRC) $(IMAKEFILE)
cat $(SPEC_SRC) |sed -e 's/@VERSION@/$(VERSION)/g' >$@
install.share::
@if [ -d $(DESTDIR)$(SHAREDIR) ]; then set +x; \@@\
else (set -x; $(MKDIRHIER) $(DESTDIR)$(SHAREDIR)); fi
@set -x; \@@\
for i in lang.*; do \@@\
$(MKDIRHIER) $(DESTDIR)$(SHAREDIR)/$${i}; \@@\
$(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) ./$${i}//**/* \@@\
$(DESTDIR)$(SHAREDIR)/$${i}/; \@@\
done
changelog:
$(MAKE_CHANGELOG)
realclean: clean
$(RM) $(MANOBJ) $(SYMLINKS) $(SPEC_OBJ) */**///**/*~
spotless: realclean
$(RM) $(MAKEFILE)
tar: changelog $(TARBALL)
$(TARBALL): $(EXTRA_FILES) $(EXTRA_DIRS) $(MANSRC) $(HDRS) $(SRCS)
$(RM) -r $(TARDIR)
$(MKDIRHIER) $(TARDIR)
$(CP) -p $(EXTRA_FILES) $(MANSRC) $(HDRS) $(SRCS) $(TARDIR)/
-for i in $(EXTRA_DIRS); do \@@\
$(MKDIRHIER) $(TARDIR)/$${i}; \@@\
$(CP) -p $${i}//**/* $(TARDIR)/$${i}/; \@@\
done >/dev/null 2>&1
chmod -Rc ug+rwX,o+rX,o-w $(TARDIR)
tar -cvf - $(TARDIR) |gzip -9 >$(TARBALL)
$(RM) -r $(TARDIR)
wmclock-1.0.12.2/ChangeLog 0100664 0001356 0001356 00000010316 07075276276 015362 0 ustar jmknoble jmknoble
-+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+-
NOTE: This file was automatically generated by `cvs2cl.pl'. If you
edit this file, your changes will be lost when someone next runs
cvs2cl.pl. See http://www.red-bean.com/~kfogel/cvs2cl.shtml for more.
-+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+- -+-
2000-04-13 07:49 jmknoble
* wmclock.spec.in: Add ChangeLog to %%doc directory.
* Imakefile: Bump version to 1.0.12.2. Release.
* Imakefile: Generate changelog from CVS comments with 'make
changelog'. Add generated changelog to distribution tarball.
2000-03-08 07:59 jmknoble
* Imakefile: `tar' target was copying CVS directories.
Restructured it a bit to avoid that.
* Imakefile: `distclean' target could prove troublesome by
destroying irreproducible work.
* wmclock.spec.in: Oops. Missed an obsolete %%{ReleaseNum} macro.
2000-03-08 07:35 jmknoble
* Imakefile, wmclock.spec.in: Added template from which to generate
spec file (wmclock.spec.in). Added targets in Imakefile to handle
generating the spec file. Revised `tar' target to rebuild on
sourcefile change. Added distclean target. Removed symlinks from
tarball. Updated version to 1.0.12.1.
* .cvsignore: Added .cvsignore file for convenience of the
developer.
* Makefile: Makefile is automagically generated; it shouldn't be
stored in CVS.
* wmclock.c, xpm/mask.xbm: Compiling with gcc -Wall -ansi -pedantic
revealed that the mask bitmap should be declared as unsigned char.
XCreateBitmapFromData() expects char *, though, so we cast the mask
bitmap data explicitly.
* dynlist.c, dynlist.h: Fixed possible memory leak.
2000-03-08 06:56 jmknoble
* COPYING, INSTALL, Imakefile, Makefile, README, configure,
dynlist.c, dynlist.h, wmclock.c, wmclock.man.in,
asclock-orig/INSTALL, asclock-orig/Imakefile, asclock-orig/README,
asclock-orig/asclock.c, asclock-orig/asclock.man,
asclock-orig/configure, asclock-orig/mask.xpm,
lang.breton/month.xpm, lang.breton/weekday.xpm,
lang.czech/month.xpm, lang.czech/weekday.xpm,
lang.danish/month.xpm, lang.danish/weekday.xpm,
lang.dutch/month.xpm, lang.dutch/weekday.xpm,
lang.english/month.xpm, lang.english/weekday.xpm,
lang.french/month.xpm, lang.french/weekday.xpm,
lang.french2/month.xpm, lang.french2/weekday.xpm,
lang.german/month.xpm, lang.german/weekday.xpm,
lang.hungarian/month.xpm, lang.hungarian/weekday.xpm,
lang.indonesian/month.xpm, lang.indonesian/weekday.xpm,
lang.italian/month.xpm, lang.italian/weekday.xpm,
lang.norwegian/month.xpm, lang.norwegian/weekday.xpm,
lang.portuguese/month.xpm, lang.portuguese/weekday.xpm,
lang.russian/month.xpm, lang.russian/weekday.xpm,
lang.slovene/month.xpm, lang.slovene/weekday.xpm,
lang.spanish/month.xpm, lang.spanish/weekday.xpm,
lang.swedish/month.xpm, lang.swedish/weekday.xpm,
lang.ukrainian/month.xpm, lang.ukrainian/weekday.xpm, xpm/date.xpm,
xpm/led.xpm, xpm/mask.xbm, xpm/mask.xpm: Begin CVS revision control
* COPYING, INSTALL, Imakefile, Makefile, README, configure,
dynlist.c, dynlist.h, wmclock.c, wmclock.man.in,
asclock-orig/INSTALL, asclock-orig/Imakefile, asclock-orig/README,
asclock-orig/asclock.c, asclock-orig/asclock.man,
asclock-orig/configure, asclock-orig/mask.xpm,
lang.breton/month.xpm, lang.breton/weekday.xpm,
lang.czech/month.xpm, lang.czech/weekday.xpm,
lang.danish/month.xpm, lang.danish/weekday.xpm,
lang.dutch/month.xpm, lang.dutch/weekday.xpm,
lang.english/month.xpm, lang.english/weekday.xpm,
lang.french/month.xpm, lang.french/weekday.xpm,
lang.french2/month.xpm, lang.french2/weekday.xpm,
lang.german/month.xpm, lang.german/weekday.xpm,
lang.hungarian/month.xpm, lang.hungarian/weekday.xpm,
lang.indonesian/month.xpm, lang.indonesian/weekday.xpm,
lang.italian/month.xpm, lang.italian/weekday.xpm,
lang.norwegian/month.xpm, lang.norwegian/weekday.xpm,
lang.portuguese/month.xpm, lang.portuguese/weekday.xpm,
lang.russian/month.xpm, lang.russian/weekday.xpm,
lang.slovene/month.xpm, lang.slovene/weekday.xpm,
lang.spanish/month.xpm, lang.spanish/weekday.xpm,
lang.swedish/month.xpm, lang.swedish/weekday.xpm,
lang.ukrainian/month.xpm, lang.ukrainian/weekday.xpm, xpm/date.xpm,
xpm/led.xpm, xpm/mask.xbm, xpm/mask.xpm: branches: 1.1.1; Initial
revision
wmclock-1.0.12.2/COPYING 0100664 0001356 0001356 00000045720 07061374644 014643 0 ustar jmknoble jmknoble *******************************************************************************
NO WARRANTY
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
*******************************************************************************
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
wmclock-1.0.12.2/INSTALL 0100664 0001356 0001356 00000002733 07061374644 014636 0 ustar jmknoble jmknoble # INSTALL: how to install wmclock
# created 1999-Apr-10 jmk
# autodate: 1999-Apr-10 03:07
____________________________
|O| Installing wmclock |X|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The procedure for installing wmclock is relatively simple; it depends
on imake, which ships with most systems which include the X Window
System.
(1) Run the `configure' script to configure the language support that
is built into wmclock. For example:
./configure --lang english
For a list of the available languages, use:
./configure --help
The configure script also creates a Makefile out of the Imakefile
using xmkmf.
(2) Compile:
make
You may specify the C compiler to use and additional command-line
options for the C compiler using the `CC' and `CDEBUGFLAGS'
variables, respectively. For example:
make CC=egcs CDEBUGFLAGS='-O6 -mpentium'
(3) Test wmclock:
./wmclock
(If it appears to work as expected, *don't dock it*. Wait until
after you've installed it).
(4) Install:
su
make install
make install.man
Optionally, install all the month and weekday pixmaps for use
with the `-monthxpm' and `-weekdayxpm' options:
make install.share
(5) You're done. See the README me file accompanying this one for
instructions on installing wmclock into Window Maker's dock.
--
Jim Knoble <jmknoble@pobox.com>
wmclock-1.0.12.2/README 0100664 0001356 0001356 00000014265 07061374644 014470 0 ustar jmknoble jmknoble # README: notes about wmclock
# created 1999-Apr-10 jmk
# autodate: 1999-Apr-10 02:21
_______________________
|O| About wmclock |X|
^^^^^^^^^^^^^^^^^^^^^^^
Wmclock is an applet which displays the date and time in a dockable
tile in the same style as the clock from the NEXTSTEP(tm) operating
system. Wmclock is specially designed for the Window Maker window
manager, by Alfredo Kojima, and features multiple language support,
twenty-four-hour and twelve-hour (am/pm) time display, and, optionally,
can run a user-specified program on a mouse click. Wmclock is derived
from asclock, a similar clock for the AfterStep window manager.
____________________________
|O| Installing wmclock |X|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please see the INSTALL file accompanying the wmclock source for
instructions on installing wmclock.
_________________________
|O| Getting Started |X|
^^^^^^^^^^^^^^^^^^^^^^^^^
Wmclock is designed especially for Window Maker; hence, putting wmclock
into your Window Maker dock is quick and easy. After you've installed
wmclock according to the instructions, there are three steps:
(1) Start wmclock. The easiest way to accomplish this is to accept
the defaults for things such as led color, blinking, etc, and
just start the clock:
wmclock
(2) Drag the resulting wmclock appicon to an empty slot in your dock.
You can do this in one of two fashions:
(a) Position the mouse pointer over a portion of the appicon tile
that is not covered by wmclock's LED display or calendar
display. Press the primary mouse button (usually the left
one) and drag to the dock. This requires a little bit of
precision in aiming the mouse, but requires no keyboard
action.
(b) Hold down the [Alt] or [Meta] key (whichever one you have
configured Window Maker to use), position the mouse pointer
over any part of the wmlock appicon, press the primary mouse
button (usually the left one), and drag to the dock. This
method requires less precision, but requires you to press and
hold a key while dragging.
(3) Set wmclock to launch when Window Maker starts. Press the menu
mouse button (usually the right one) on the portion of the docked
wmclock tile that is not covered by wmclock's LED display or
calendar display to bring up the dock icon menu, and choose
`Settings...'. In the resulting dialog, check the box labelled
`Start when Window Maker is started' and press `OK'. That's it!
_________________________
|O| Troubleshooting |X|
^^^^^^^^^^^^^^^^^^^^^^^^^
As with any dockable applet, there are a few possible `gotchas' with
wmclock and Window Maker:
- If you have the Clip set to `AutoAttract Icons', the wmclock
appicon will appear in the Clip instead of on the desktop. If your
Clip is collapsed, you won't be able to see the wmclock appicon,
even though it's running. Make sure you uncollapse your Clip and
look for wmclock there if it doesn't appear on your desktop.
- If your Clip is too close to your dock, you may have difficulty
docking wmclock, because the Clip may grab the wmclock appicon
instead. Try moving your Clip farther away from your dock before
docking wmclock.
_________________________________________________
|O| Differences Between asclock and wmclock |X|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Wmclock is derived from asclock version 1.0.12 (the latest `stable'
version, according to <http://www.asclock.org/>), by Beat Christen.
The major differences between asclock and wmclock are:
(1) Asclock is designed for use with the AfterStep window manager.
To use asclock with Window Maker, a patch is required. Wmclock
is better behaved with Window Maker and requires no patch or
special command-line options; it `just works'.
(2) Wmclock corrects a few of asclock's aesthetic defects. Most
notably, the `off-by-one-pixel' defect at the lefthand side of
the LED display is corrected.
(3) Asclock use a simple system() call to execute the command
specified using the `-exe' command-line option; this method could
create lots of unwanted zombie processes. Wmclock cleans up its
chiled processes every so often to eliminate the zombies.
Also, if no command was specified when asclock was started, it
would output a message warning that no command was specified each
time you click the mouse on asclock window area. Wmclock does not
output that message; if no command was specified, wmclock simply
does nothing when you click on it.
Other minor differences include:
(1) The `-shape' and `-iconic' command-line options are no longer
needed with wmclock. Wmclock recognizes them for backwards
compatibility with asclock, but they have no effect.
(2) Asclock contained an arbitrary limitation on the length of the
command (approximately 50 characters) that you could specify with
the `-exe' option. Wmclock removes that arbitrary limitation and
cleans up the code significantly in the process.
_______________________________________________________
|O| Authors, Copyright, License, Disclaimer, etc. |X|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Wmclock is Copyright © 1999 by Jim Knoble <jmknoble@pobox.com>.
Significant portions of wmclock are directly derived from asclock by
Beat Christen <spiff@longstreet.ch>, who, along with asclock's other
authors, owns the copyright to those portions of wmclock.
Wmclock is licensed under the GNU General Public License, version 2, or
(at your option) any later version. See <http://www.gnu.org/> for more
information.
The software is provided ``as is'', without warranty of any kind,
express or implied, including but not limited to the warranties of
merchantability, fitness for a particular purpose and noninfringement.
In no event shall the author(s) be liable for any claim, damages or
other liability, whether in an action of contract, tort or otherwise,
arising from, out of or in connection with the software or the use or
other dealings in the software.
Your mileage may vary. Eat your vegetables.
--
Jim Knoble <jmknoble@pobox.com>
wmclock-1.0.12.2/configure 0100775 0001356 0001356 00000004277 07061374644 015521 0 ustar jmknoble jmknoble #!/bin/sh
#
# configure: prepare wmclock to be built using imake and make
# created 1999-Mar-30 03:40 jmk
# autodate: 1999-Apr-09 04:19
#DefColorLevel=high
#ColorLevel=''
DefLanguage=english
Language=''
LangDir=''
Me=`basename $0`
GetLanguages() {
ls -1d lang.* | awk -F . '{
print " " $2
}'
}
PrintHelp() {
langlist="`GetLanguages`"
cat <<EOF
Usage: ${0} [--lang <language>]
Options:
--lang <language>
Configure wmclock to use day and month names for the specified
language. Defaults to 'english'. Choices are:
${langlist}
EOF
# Usage: ${0} [--lang <language>] [--colorlevel {low|high}]
# --colorlevel {low|high}
# Configure wmclock to use a background with a low or high number
# of colors when run without the '-shape' flag. Defaults to
# 'high'.
#
}
Die() {
echo "$*"
echo "wmclock is NOT successfully configured!"
exit 1
}
while [ $# -gt 0 ]; do
case "$1" in
--lang|--language)
shift
Language="$1"
;;
# --color|--colorlevel)
# shift
# ColorLevel="$1"
# ;;
--help)
PrintHelp
exit 1
;;
esac
shift
done
if [ -z "${Language}" ]; then
Language="${DefLanguage}"
fi
#if [ -z "${ColorLevel}" ]; then
# ColorLevel="${DefColorLevel}"
#fi
LangDir="lang.${Language}"
if [ ! -d "${LangDir}" ]; then
Die "${Me}: error: cannot find language directory '${LangDir}'"
fi
#case "${ColorLevel}" in
# low)
# ClockPixmap="clk2.xpm"
# ;;
# high)
# ClockPixmap="color.xpm"
# ;;
# *)
# Die "${Me}: error: unknown color level '${ColorLevel}'"
# ;;
#esac
echo "Configuring for ${Language} day-of-week and month names ..."
rm -f month.xpm weekday.xpm
ln -s "./${LangDir}/month.xpm" .
ln -s "./${LangDir}/weekday.xpm" .
#echo "Configuring for ${ColorLevel} number of colors ..."
#rm -f clk.xpm
#ln -s "./xpm/${ClockPixmap}" ./clk.xpm
echo "Building Makefile from Imakefile ..."
echo "----------------------------------------------------------------"
xmkmf -a
echo "----------------------------------------------------------------"
echo "Finished configuring. To build wmclock, type 'make'."
echo
exit 0
wmclock-1.0.12.2/wmclock.man.in 0100664 0001356 0001356 00000016073 07061374644 016350 0 ustar jmknoble jmknoble .\" wmclock.man: manual page for wmclock -*- nroff -*-
.\" created 1999-Apr-09 jmk
.\" autodate: 1999-Apr-09 04:17
.\"
.\" by Jim Knoble <jmknoble@pobox.com>
.\" Copyright © 1999 Jim Knoble
.\" Based on asclock.man by Dan Weeks.
.\"
.\" Disclaimer:
.\"
.\" The software is provided "as is", without warranty of any kind,
.\" express or implied, including but not limited to the warranties of
.\" merchantability, fitness for a particular purpose and
.\" noninfringement. In no event shall the author(s) be liable for any
.\" claim, damages or other liability, whether in an action of
.\" contract, tort or otherwise, arising from, out of or in connection
.\" with the software or the use or other dealings in the software.
.\"
.de TQ
.br
.ns
.TP \\$1
..
.\" ----------------------------------------------------------------
.TH wmclock 1x "@DATE@" "Version @VERSION@"
.\" ----------------------------------------------------------------
.SH NAME
.PP
.BR wmclock :
a dockable clock for the Window Maker window manager
.\" ----------------------------------------------------------------
.SH SYNOPSIS
.HP
\fBwmclock\fP [{\-12|\-24|\-year}] [\-noblink] [\-exe \fIprogram\fP]
[\-led \fIcolor\fP] [\-monthxpm \fIfilename\fP] [\-weekdayxpm
\fIfilename\fP]
.\" ----------------------------------------------------------------
.SH DESCRIPTION
.PP
.B Wmclock
is an applet which displays the date and time in a dockable tile in the
same style as the clock from the NEXTSTEP(tm) operating system.
.B Wmclock
is specially designed for the Window Maker window manager, by Alfredo
Kojima, and features multiple language support, twenty-four-hour and
twelve-hour (am/pm) time display, and, optionally, can run a
user-specified program on a mouse click.
.B Wmclock
is derived from
.BR asclock ,
a similar clock for the AfterStep window manager.
.\" ----------------------------------------------------------------
.SH OPTIONS
.TP
\fB\-12\fR or \fB\-24\fR
Display the time in either twelve-hour format (with am/pm) or
twenty-four-hour format. Defaults to twenty-four-hour display.
.TP
\fB\-year\fR
Display the current year in the LED display instead of the time.
.TP
\fB\-noblink\fR
The separator between the hours and minutes in the time display blinks
by default. This option turns off the blinking and displays a steadily
lit separator instead.
.TP
\fB\-exe\fR \fIcommand\fR
Run
.I command
in the background when a mouse button is pressed over
.BR wmclock .
See below for details.
.TP
\fB\-led\fR \fIcolor\fR
Use
.I color
as the foreground color of the LED display.
.I Color
may be either a named color from the rgb.txt database (for example,
`red' or `chartreuse') or a numeric color specification in any of the usual
X11 formats (for example, `#ff0000' or `rgb:7f/ff/00'). See the
.BR X (1)
man page for more information.
.TP
\fB\-monthxpm\fR \fIfilename\fR
Get month abbreviations from
.IR filename ,
which is expected to be in the XPM format. See below for details.
.TP
\fB\-weekdayxpm\fR \fIfilename\fR
Get weekday abbreviations from
.IR filename ,
which is expected to be in the XPM format. See below for details.
.\" ----------------------------------------------------------------
.SH INVOCATION AND EXAMPLES
.PP
The simplest way to start
.B wmclock
is:
.PP
.RS
.TQ
wmclock
.RE
.PP
.B Wmclock
displays in its own appicon, which you can place in Window Maker's dock
by holding down the [Alt] or [Meta] key and dragging
.B wmclock
to the dock with the primary mouse button (usually the left one).
.PP
For a more complicated example:
.PP
.RS
.TQ
wmclock \-12 \-led gold \-exe /usr/GNUstep/Apps/WPrefs.app/WPrefs
.RE
.PP
This displays 12-hour time in an amber-colored LED display, and starts
Window Maker's preferences utility when you click on
.BR wmclock .
.\" ----------------------------------------------------------------
.SH DETAILS
.SS Running Commands
.PP
When you use
.B wmclock
with the
.B \-exe
option,
.B wmclock
will run the command you specify whenever you press a mouse button
while the mouse cursor is over
.BR wmclock .
.B Wmclock
uses the
.BR system (3)
function from the C library (and ultimately
.BR /bin/sh )
to run the command; hence, the command must be in Bourne-shell syntax.
.SS Using Alternate Month and Weekday Abbreviations
.PP
You can use the
.B \-monthxpm
and
.B \-weekdayxpm
options to convince
.B wmclock
to display month and day-of-week abbreviations in a language besides
the one it was compiled with, or to display them in a language that
.B wmclock
does not yet support. The files you specify must be in the XPM format,
and they must follow the same strict size and placement as the month
and weekday XPMs that come in the
.B wmclock
source package. Each weekday abbreviation must be 21 pixels wide and 6
pixels high; each month abbreviation must be 22 pixels wide and 6
pixels high. The month abbreviations must be arranged vertically,
beginning with January at the top and continuing down to December at
the bottom. The weekday abbreviations must also be arranged
vertically, beginning with Monday at the top and continuing to Sunday
at the bottom.
.SS Obsolete Options
.PP
In order to maintain command-line compatibility (mostly) with
.BR asclock ,
.B wmclock
accepts a few options on the command line without complaining, even
though they don't have any effect. The options which
.B wmclock
accepts in this manner are
.B \-shape
and
.BR \-iconic .
Some dockable versions of
.B asclock
required one or both of these options to become properly dockable.
However, Since
.B wmclock
is designed for Window Maker's dock, it already displays in a shaped
window in its own dockable appicon.
.\" ----------------------------------------------------------------
.SH BUGS
.PP
.B Wmclock
shouldn't run a command on a single click; should use a double click
instead.
.PP
.B Wmclock
should use Alfredo Kojima's libdockapp library instead of inventing its
own wheel.
.\" ----------------------------------------------------------------
.SH SEE ALSO
.PP
X(1), asclock(1x), wmaker(1x), system(3)
.\" ----------------------------------------------------------------
.SH COPYRIGHT AND LICENSE
.PP
Copyright © 1999 by Jim Knoble <jmknoble@pobox.com>. Significant
portions of
.B wmclock
are directly derived from
.B asclock
by Beat Christen, who, along with
.BR asclock 's
other authors, owns the copyright to those portions of
.BR wmclock .
.PP
.B Wmclock
is licensed under the GNU General Public License, version 2, or (at
your option) any later version. See <http://www.gnu.org/> for more
information.
.SH AUTHORS
.TQ
Jim Knoble <jmknoble@pobox.com>
.TQ
Beat Christen <spiff@longstreet.ch>, author of \fBasclock\fI
.\" ----------------------------------------------------------------
.SH DISCLAIMER
.PP
The software is provided ``as is'', without warranty of any kind,
express or implied, including but not limited to the warranties of
merchantability, fitness for a particular purpose and noninfringement.
In no event shall the author(s) be liable for any claim, damages or
other liability, whether in an action of contract, tort or otherwise,
arising from, out of or in connection with the software or the use or
other dealings in the software.
.PP
Your mileage may vary. Eat your vegetables.
wmclock-1.0.12.2/dynlist.h 0100664 0001356 0001356 00000002430 07061400227 015421 0 ustar jmknoble jmknoble /* dynlist.h: Dynamic lists and buffers in C
* created 1999-Jan-06 15:04 jmk
* autodate: 2000-Mar-08 02:26
*
* by Jim Knoble <jmknoble@pobox.com>
* Copyright © 1999 Jim Knoble
*
* Disclaimer:
*
* The software is provided "as is", without warranty of any kind,
* express or implied, including but not limited to the warranties of
* merchantability, fitness for a particular purpose and
* noninfringement. In no event shall the author(s) be liable for any
* claim, damages or other liability, whether in an action of
* contract, tort or otherwise, arising from, out of or in connection
* with the software or the use or other dealings in the software.
*
* 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.
*/
#ifndef H_DYNLIST
#define H_DYNLIST 1
#define APPEND_SUCCESS 1
#define APPEND_FAILURE 0
int append_to_list(char ***list_ptr, int *list_len, int *i, char *item);
int append_to_buf(char **buf, int *buflen, int *i, int c);
int append_string_to_buf(char **buf, int *buflen, int *i, char *s);
#endif /* H_DYNLIST */
wmclock-1.0.12.2/dynlist.c 0100664 0001356 0001356 00000005151 07061400143 015414 0 ustar jmknoble jmknoble /* dynlist.c: Dynamic lists and buffers in C.
* created 1999-Jan-06 15:34 jmk
* autodate: 2000-Mar-08 02:25
*
* by Jim Knoble <jmknoble@pobox.com>
* Copyright © 1999 Jim Knoble
*
* Disclaimer:
*
* The software is provided "as is", without warranty of any kind,
* express or implied, including but not limited to the warranties of
* merchantability, fitness for a particular purpose and
* noninfringement. In no event shall the author(s) be liable for any
* claim, damages or other liability, whether in an action of
* contract, tort or otherwise, arising from, out of or in connection
* with the software or the use or other dealings in the software.
*
* 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dynlist.h"
#define LIST_CHUNK_SIZE 512
#define BUF_CHUNK_SIZE 512
/* For lists of pointers cast to char *. */
int append_to_list(char ***list_ptr, int *list_len, int *i, char *item)
{
char **tmp_ptr;
if (*i >= *list_len)
{
*list_len += LIST_CHUNK_SIZE;
tmp_ptr = realloc(*list_ptr, (sizeof(**list_ptr) * *list_len));
if (NULL == tmp_ptr)
{
return(APPEND_FAILURE);
}
*list_ptr = tmp_ptr;
}
(*list_ptr)[*i] = item;
(*i)++;
return(APPEND_SUCCESS);
}
/* For single-dimensional buffers. */
int append_to_buf(char **buf, int *buflen, int *i, int c)
{
char *tmp_buf;
if (*i >= *buflen)
{
*buflen += BUF_CHUNK_SIZE;
tmp_buf = realloc(*buf, (sizeof(**buf) * *buflen));
if (NULL == tmp_buf)
{
return(APPEND_FAILURE);
}
*buf = tmp_buf;
#ifdef DEBUG
printf("-->Allocated buffer of size %d\n", *buflen);
#endif /* DEBUG */
}
(*buf)[*i] = (char) c;
(*i)++;
return(APPEND_SUCCESS);
}
int append_string_to_buf(char **buf, int *buflen, int *i, char *s)
{
int addlen;
int n;
char *tmp_buf;
n = strlen(s);
if (*i >= *buflen)
{
addlen = BUF_CHUNK_SIZE;
if (addlen <= n)
{
addlen = n + 1;
}
*buflen += addlen;
tmp_buf = realloc(*buf, (sizeof(**buf) * *buflen));
if (NULL == tmp_buf)
{
return(APPEND_FAILURE);
}
*buf = tmp_buf;
#ifdef DEBUG
printf("-->Allocated buffer of size %d\n", *buflen);
#endif /* DEBUG */
}
(*buf)[*i] = '\0';
strncat(*buf, s, n);
*i += n;
return(APPEND_SUCCESS);
}
wmclock-1.0.12.2/wmclock.c 0100664 0001356 0001356 00000070445 07061400725 015403 0 ustar jmknoble jmknoble /* wmclock.c: a dockable clock applet for Window Maker
* created 1999-Apr-09 jmk
* autodate: 2000-Mar-08 02:31
*
* by Jim Knoble <jmknoble@pobox.com>
* Copyright © 1999 Jim Knoble
*
* Significant portions of this software are derived from asclock by
* Beat Christen <spiff@longstreet.ch>. Such portions are copyright
* by Beat Christen and the other authors of asclock.
*
* Disclaimer:
*
* The software is provided "as is", without warranty of any kind,
* express or implied, including but not limited to the warranties of
* merchantability, fitness for a particular purpose and
* noninfringement. In no event shall the author(s) be liable for any
* claim, damages or other liability, whether in an action of
* contract, tort or otherwise, arising from, out of or in connection
* with the software or the use or other dealings in the software.
*/
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/xpm.h>
#include <X11/extensions/shape.h>
#include "dynlist.h"
/**********************************************************************/
#define ONLY_SHAPED_WINDOW 1
#define NUM_TIME_POSITIONS 5
#define NUM_X_POSITIONS 11
#define NUM_Y_POSITIONS 4
#define DIGIT_1_X_POS 0
#define DIGIT_2_X_POS 1
#define DIGIT_3_X_POS 3
#define DIGIT_4_X_POS 4
#define DIGIT_Y_POS 0
#define LED_NUM_Y_OFFSET 0
#define LED_THIN_1_X_OFFSET 13
#define LED_NUM_WIDTH 9
#define LED_NUM_HEIGHT 11
#define LED_THIN_1_WIDTH 5
#define COLON_X_POS 2
#define COLON_Y_POS DIGIT_Y_POS
#define COLON_X_OFFSET 90
#define COLON_Y_OFFSET 0
#define BLANK_X_OFFSET 119
#define BLANK_Y_OFFSET COLON_Y_OFFSET
#define COLON_WIDTH 3
#define COLON_HEIGHT 11
#define AMPM_X_POS 5
#define AM_X_OFFSET 94
#define AM_Y_OFFSET 5
#define PM_X_OFFSET 107
#define PM_Y_OFFSET 5
#define AM_WIDTH 12
#define AM_HEIGHT 6
#define PM_WIDTH 11
#define PM_HEIGHT 6
#define MONTH_X_POS 10
#define MONTH_Y_POS 3
#define MONTH_X_OFFSET 0
#define MONTH_WIDTH 22
#define MONTH_HEIGHT 6
#define DATE_LEFT_X_POS 7
#define DATE_CENTER_X_POS 8
#define DATE_RIGHT_X_POS 9
#define DATE_Y_POS 2
#define DATE_Y_OFFSET 0
#define DATE_NUM_WIDTH 9
#define DATE_NUM_HEIGHT 13
#define WEEKDAY_X_POS 6
#define WEEKDAY_Y_POS 1
#define WEEKDAY_X_OFFSET 0
#define WEEKDAY_WIDTH 21
#define WEEKDAY_HEIGHT 6
#define OUR_WINDOW_EVENTS (ExposureMask | ButtonPressMask | StructureNotifyMask)
#define LED_XPM_BRIGHT_LINE_INDEX 3
#define LED_XPM_BRIGHT_CHAR '+'
#define LED_XPM_DIM_LINE_INDEX 4
#define LED_XPM_DIM_CHAR '@'
#define DEFAULT_XPM_CLOSENESS 40000
#define DIM_NUMERATOR 5
#define DIM_DENOMINATOR 10
#define makeDimColor(c) (((c) * DIM_NUMERATOR) / DIM_DENOMINATOR)
/**********************************************************************/
#ifndef ONLY_SHAPED_WINDOW
# include "clk.xpm"
#endif /* !ONLY_SHAPED_WINDOW */
#include "month.xpm"
#include "weekday.xpm"
#include "xpm/date.xpm"
#include "xpm/led.xpm"
#include "xpm/mask.xbm"
#include "xpm/mask.xpm"
/**********************************************************************/
int enable12HourClock = 0; /* default value is 24h format */
int enableShapedWindow = 1; /* default value is noshape */
int enableBlinking = 1; /* default is blinking */
int startIconified = 0; /* default is not iconified */
int enableYearDisplay = 0; /* default is to show time, not year */
int timePos12[NUM_TIME_POSITIONS] = { 5, 14, 24, 28, 37 };
int timePos24[NUM_TIME_POSITIONS] = { 4, 8, 17, 22, 31 };
/* with shape */
int xPosShaped[NUM_X_POSITIONS] = { 0, 0, 0, 0, 0, 40, 17, 17, 22, 27, 15 };
int yPosShaped[NUM_Y_POSITIONS] = { 3, 21, 30, 45 };
#ifndef ONLY_SHAPED_WINDOW
/* no shape */
int xPosUnshaped[NUM_X_POSITIONS] = { 5, 5, 5, 5, 5, 45, 21, 21, 26, 31, 19 };
int yPosUnshaped[NUM_Y_POSITIONS] = { 7, 25, 34, 49 };
#endif /* !ONLY_SHAPED_WINDOW */
int xPos[NUM_X_POSITIONS];
int yPos[NUM_Y_POSITIONS];
Display *dpy;
Window rootWindow;
int screen;
/* int xFd; */
int displayDepth;
XSizeHints sizeHints;
XWMHints wmHints;
Pixel bgPixel, fgPixel;
GC normalGC;
Window iconWin, win;
char *progName;
char *className = "WMClock";
char *geometry = "";
char *ledColor = "LightSeaGreen";
char *commandToExec = NULL;
char *commandBuf = NULL;
int commandLength = 0;
int commandIndex = 0;
char *errColorCells = "not enough free color cells or xpm not found\n";
char *userClockXpm;
char *userMonthXpm;
char *userWeekdayXpm;
int useUserClockXpm = 0;
int useUserMonthXpm = 0;
int useUserWeekdayXpm = 0;
typedef struct _XpmIcon {
Pixmap pixmap;
Pixmap mask;
XpmAttributes attributes;
} XpmIcon;
XpmIcon clockBg, led, months, dateNums, weekdays;
XpmIcon visible;
time_t actualTime;
long actualMinutes;
static struct tm *localTime;
char *usageText[] = {
"Options:",
" -12 show 12-hour time (am/pm)",
" -24 show 24-hour time",
" -year show year instead of time",
" -noblink don't blink",
" -exe <command> start <command> on mouse click",
" -led <color> use <color> as color of led",
#ifndef ONLY_SHAPED_WINDOW
" -clockxpm <filename> get clock background from pixmap in <filename>",
#endif /* !ONLY_SHAPED_WINDOW */
" -monthxpm <filename> get month names from pixmap in <filename>",
" -weekdayxpm <filename> get weekday names from pixmap in <filename>",
NULL
};
char *version = VERSION;
/**********************************************************************/
/* Display usage information */
void showUsage()
{
char **cpp;
fprintf(stderr, "Usage: %s [option [option ...]]\n\n", progName);
for (cpp = usageText; *cpp; cpp++)
{
fprintf(stderr, "%s\n", *cpp);
}
fprintf(stderr,"\n");
exit(1);
}
/* Display the program version */
void showVersion()
{
fprintf(stderr, "%s version %s\n", progName, version);
exit(1);
}
/* Build the shell command to execute */
int buildCommand(char *command, char **buf, int *buf_len, int *i)
{
int status;
status = append_string_to_buf(buf, buf_len, i, command);
if (APPEND_FAILURE == status)
{
return(0);
}
status = append_string_to_buf(buf, buf_len, i, " &");
return((APPEND_FAILURE == status) ? 0 : 1);
}
/* Execute the given shell command */
void executeCommand(char *command)
{
int status;
if (NULL == command)
{
return;
}
status = system(command);
if (-1 == status)
{
perror("system");
}
}
/* Display an error message */
void showError(char *message, char *data)
{
fprintf(stderr,"%s: can't %s %s\n", progName, message, data);
}
/* Display an error message and exit */
void showFatalError(char *message, char *data)
{
showError(message, data);
exit(1);
}
/* Konvertiere XPMIcons nach Pixmaps */
void GetXpms(void)
{
static char **clock_xpm;
XColor color;
XWindowAttributes attributes;
char ledBright[64];
char ledDim[64];
int status;
#ifdef ONLY_SHAPED_WINDOW
clock_xpm = mask_xpm;
#else /* !ONLY_SHAPED_WINDOW */
clock_xpm = enableShapedWindow ? mask_xpm : clk_xpm;
#endif /* ONLY_SHAPED_WINDOW */
/* for the colormap */
XGetWindowAttributes(dpy, rootWindow, &attributes);
/* get user-defined color */
if (!XParseColor(dpy, attributes.colormap, ledColor, &color))
{
showError("parse color", ledColor);
}
sprintf(ledBright, "%c c #%04X%04X%04X", LED_XPM_BRIGHT_CHAR,
color.red, color.green, color.blue);
led_xpm[LED_XPM_BRIGHT_LINE_INDEX] = &ledBright[0];
color.red = makeDimColor(color.red);
color.green = makeDimColor(color.green);
color.blue = makeDimColor(color.blue);
sprintf(&ledDim[0], "%c c #%04X%04X%04X", LED_XPM_DIM_CHAR,
color.red, color.green, color.blue);
led_xpm[LED_XPM_DIM_LINE_INDEX] = &ledDim[0];
clockBg.attributes.closeness = DEFAULT_XPM_CLOSENESS;
clockBg.attributes.valuemask |=
(XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
if (useUserClockXpm)
{
status = XpmReadFileToPixmap(dpy, rootWindow, userClockXpm,
&clockBg.pixmap, &clockBg.mask,
&clockBg.attributes);
}
else
{
status = XpmCreatePixmapFromData(dpy, rootWindow, clock_xpm,
&clockBg.pixmap, &clockBg.mask,
&clockBg.attributes);
}
if (XpmSuccess != status)
{
showFatalError("create clock pixmap:", errColorCells);
}
#ifdef ONLY_SHAPED_WINDOW
visible.attributes.depth = displayDepth;
visible.attributes.width = clockBg.attributes.width;
visible.attributes.height = clockBg.attributes.height;
visible.pixmap = XCreatePixmap(dpy, rootWindow, visible.attributes.width,
visible.attributes.height,
visible.attributes.depth);
#else /* !ONLY_SHAPED_WINDOW */
visible.attributes.closeness = DEFAULT_XPM_CLOSENESS;
visible.attributes.valuemask |=
(XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
status = XpmCreatePixmapFromData(dpy, rootWindow, clk_xpm,
&visible.pixmap, &visible.mask,
&visible.attributes);
#endif /* ONLY_SHAPED_WINDOW */
led.attributes.closeness = DEFAULT_XPM_CLOSENESS;
led.attributes.valuemask |=
(XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
status = XpmCreatePixmapFromData(dpy, rootWindow, led_xpm,
&led.pixmap, &led.mask,
&led.attributes);
if (XpmSuccess != status)
{
showFatalError("create led pixmap:", errColorCells);
}
months.attributes.closeness = DEFAULT_XPM_CLOSENESS;
months.attributes.valuemask |=
(XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
if (useUserMonthXpm)
{
status = XpmReadFileToPixmap(dpy, rootWindow, userMonthXpm,
&months.pixmap, &months.mask,
&months.attributes);
}
else
{
status = XpmCreatePixmapFromData(dpy, rootWindow, month_xpm,
&months.pixmap, &months.mask,
&months.attributes);
}
if (XpmSuccess != status)
{
showFatalError("create month pixmap:", errColorCells);
}
dateNums.attributes.closeness = DEFAULT_XPM_CLOSENESS;
dateNums.attributes.valuemask |=
(XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
status = XpmCreatePixmapFromData(dpy, rootWindow, date_xpm,
&dateNums.pixmap, &dateNums.mask,
&dateNums.attributes);
if (XpmSuccess != status)
{
showFatalError("create date pixmap:", errColorCells);
}
weekdays.attributes.closeness = DEFAULT_XPM_CLOSENESS;
weekdays.attributes.valuemask |=
(XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
if (useUserWeekdayXpm)
{
status = XpmReadFileToPixmap(dpy, rootWindow, userWeekdayXpm,
&weekdays.pixmap, &weekdays.mask,
&weekdays.attributes);
}
else
{
status = XpmCreatePixmapFromData(dpy, rootWindow, weekday_xpm,
&weekdays.pixmap, &weekdays.mask,
&weekdays.attributes);
}
if (XpmSuccess != status)
{
showFatalError("create weekday pixmap:", errColorCells);
}
}
/* Remove expose events for a specific window from the queue */
int flushExposeEvents(Window w)
{
XEvent dummy;
int i = 0;
while (XCheckTypedWindowEvent(dpy, w, Expose, &dummy))
{
i++;
}
return(i);
}
/* (Re-)Draw the main window and the icon window */
void redrawWindow(XpmIcon *v)
{
flushExposeEvents(iconWin);
XCopyArea(dpy, v->pixmap, iconWin, normalGC,
0, 0, v->attributes.width, v->attributes.height, 0, 0);
flushExposeEvents(win);
XCopyArea(dpy, v->pixmap, win, normalGC,
0, 0, v->attributes.width, v->attributes.height, 0, 0);
}
/* Get a Pixel for the given color name */
Pixel GetColor(char *colorName)
{
XColor color;
XWindowAttributes attributes;
XGetWindowAttributes(dpy, rootWindow, &attributes);
color.pixel = 0;
if (!XParseColor(dpy, attributes.colormap, colorName, &color))
{
showError("parse color", colorName);
}
else if (!XAllocColor(dpy, attributes.colormap, &color))
{
showError("allocate color", colorName);
}
return(color.pixel);
}
/* Fetch the system time and time zone */
int mytime()
{
struct timeval tv;
struct timezone tz;
gettimeofday(&tv, &tz);
return(tv.tv_sec);
}
/* Display the current year in the LED display */
void showYear()
{
int year;
int digitXOffset;
int digitYOffset;
year = localTime->tm_year + 1900;
digitYOffset = LED_NUM_Y_OFFSET;
digitXOffset = LED_NUM_WIDTH * (year / 1000);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset , digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_1_X_POS], yPos[DIGIT_Y_POS]);
digitXOffset = LED_NUM_WIDTH * (year % 1000);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset , digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_2_X_POS], yPos[DIGIT_Y_POS]);
digitXOffset = LED_NUM_WIDTH * (year % 100);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset , digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_3_X_POS], yPos[DIGIT_Y_POS]);
digitXOffset = LED_NUM_WIDTH * (year % 10);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset , digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_4_X_POS], yPos[DIGIT_Y_POS]);
}
/* Display time in twelve-hour mode, with am/pm indicator */
void showTime12()
{
int digitXOffset;
int digitYOffset;
int localHour = localTime->tm_hour % 12;
if (0 == localHour)
{
localHour = 12;
}
if (localTime->tm_hour < 12)
{
/* AM */
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
AM_X_OFFSET, AM_Y_OFFSET, AM_WIDTH, AM_HEIGHT,
xPos[AMPM_X_POS], yPos[DIGIT_Y_POS] + AM_Y_OFFSET);
}
else
{
/* PM */
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
PM_X_OFFSET, PM_Y_OFFSET, PM_WIDTH, PM_HEIGHT,
xPos[AMPM_X_POS], yPos[DIGIT_Y_POS] + PM_Y_OFFSET);
}
digitYOffset = LED_NUM_Y_OFFSET;
if (localHour > 9)
{
digitXOffset = LED_THIN_1_X_OFFSET;
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset, digitYOffset, LED_THIN_1_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_1_X_POS], yPos[DIGIT_Y_POS]);
}
digitXOffset = LED_NUM_WIDTH * (localHour % 10);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset, digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_2_X_POS], yPos[DIGIT_Y_POS]);
digitXOffset = LED_NUM_WIDTH * (localTime->tm_min / 10);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset, digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_3_X_POS], yPos[DIGIT_Y_POS]);
digitXOffset = LED_NUM_WIDTH * (localTime->tm_min % 10);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset, digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_4_X_POS], yPos[DIGIT_Y_POS]);
}
/* Display time in 24-hour mode, without am/pm indicator */
void showTime24()
{
int digitXOffset;
int digitYOffset;
digitYOffset = LED_NUM_Y_OFFSET;
digitXOffset = LED_NUM_WIDTH * (localTime->tm_hour / 10);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset, digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_1_X_POS], yPos[DIGIT_Y_POS]);
digitXOffset = LED_NUM_WIDTH * (localTime->tm_hour % 10);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset, digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_2_X_POS], yPos[DIGIT_Y_POS]);
digitXOffset = LED_NUM_WIDTH * (localTime->tm_min / 10);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset, digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_3_X_POS], yPos[DIGIT_Y_POS]);
digitXOffset = LED_NUM_WIDTH * (localTime->tm_min % 10);
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
digitXOffset, digitYOffset, LED_NUM_WIDTH, LED_NUM_HEIGHT,
xPos[DIGIT_4_X_POS], yPos[DIGIT_Y_POS]);
}
void showTime()
{
int xOffset;
int yOffset;
/* Zeit auslesen */
actualTime = mytime();
actualMinutes = actualTime / 60;
localTime = localtime(&actualTime);
/* leere clock holen */
XCopyArea(dpy, clockBg.pixmap, visible.pixmap, normalGC,
0, 0, sizeHints.width, sizeHints.height, 0, 0);
if (enableYearDisplay)
{
showYear();
}
else if (enable12HourClock)
{
showTime12();
}
else
{
showTime24();
}
/* Monat */
xOffset = MONTH_X_OFFSET;
yOffset = MONTH_HEIGHT * (localTime->tm_mon);
XCopyArea(dpy, months.pixmap, visible.pixmap, normalGC,
xOffset, yOffset, MONTH_WIDTH, MONTH_HEIGHT,
xPos[MONTH_X_POS], yPos[MONTH_Y_POS]);
/* Datum */
yOffset = DATE_Y_OFFSET;
if (localTime->tm_mday > 9)
{
xOffset = DATE_NUM_WIDTH * (((localTime->tm_mday / 10) + 9) % 10);
XCopyArea(dpy, dateNums.pixmap, visible.pixmap, normalGC,
xOffset, yOffset, DATE_NUM_WIDTH, DATE_NUM_HEIGHT,
xPos[DATE_LEFT_X_POS], yPos[DATE_Y_POS]);
xOffset = DATE_NUM_WIDTH * (((localTime->tm_mday % 10) + 9) % 10);
XCopyArea(dpy, dateNums.pixmap, visible.pixmap, normalGC,
xOffset, yOffset, DATE_NUM_WIDTH, DATE_NUM_HEIGHT,
xPos[DATE_RIGHT_X_POS], yPos[DATE_Y_POS]);
}
else
{
xOffset = DATE_NUM_WIDTH * (localTime->tm_mday - 1);
XCopyArea(dpy, dateNums.pixmap, visible.pixmap, normalGC,
xOffset, yOffset, DATE_NUM_WIDTH, DATE_NUM_HEIGHT,
xPos[DATE_CENTER_X_POS], yPos[DATE_Y_POS]);
}
/* Wochentag */
xOffset = WEEKDAY_X_OFFSET;
yOffset = WEEKDAY_HEIGHT * ((localTime->tm_wday + 6) % 7);
XCopyArea(dpy, weekdays.pixmap, visible.pixmap, normalGC,
xOffset, yOffset, WEEKDAY_WIDTH, WEEKDAY_HEIGHT,
xPos[WEEKDAY_X_POS], yPos[WEEKDAY_Y_POS]);
if ((!enableBlinking) && (!enableYearDisplay))
{
/* Sekunden Doppelpunkt ein */
xOffset = COLON_X_OFFSET;
yOffset = COLON_Y_OFFSET;
XCopyArea(dpy, led.pixmap, visible.pixmap, normalGC,
xOffset, yOffset, COLON_WIDTH, COLON_HEIGHT,
xPos[COLON_X_POS], yPos[COLON_Y_POS]);
}
}
/* Extract program name from the zeroth program argument */
char *extractProgName(char *argv0)
{
char *prog_name = NULL;
if (NULL != argv0)
{
prog_name = strrchr(argv0, '/');
if (NULL == prog_name)
{
prog_name = argv0;
}
else
{
prog_name++;
}
}
return(prog_name);
}
/* Process program arguments and set corresponding options */
int processArgs(int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++)
{
if (0 == strcmp(argv[i], "--"))
{
break;
}
else if ((0 == strcmp(argv[i], "-12")) ||
(0 == strcmp(argv[i], "-1")) ||
(0 == strcmp(argv[i], "--12")))
{
enable12HourClock = 1;
}
else if ((0 == strcmp(argv[i], "-24")) ||
(0 == strcmp(argv[i], "-2")) ||
(0 == strcmp(argv[i], "--24")))
{
enable12HourClock = 0;
}
else if ((0 == strcmp(argv[i], "-exe")) ||
(0 == strcmp(argv[i], "-e")) ||
(0 == strcmp(argv[i], "--exe")))
{
if (++i >= argc)
{
showUsage();
}
commandToExec = argv[i];
}
else if ((0 == strcmp(argv[i], "-led")) ||
(0 == strcmp(argv[i], "-l")) ||
(0 == strcmp(argv[i], "--led")))
{
if (++i >= argc)
{
showUsage();
}
ledColor = argv[i];
}
else if ((0 == strcmp(argv[i], "-clockxpm")) ||
(0 == strcmp(argv[i], "-c")) ||
(0 == strcmp(argv[i], "--clockxpm")))
{
#ifndef ONLY_SHAPED_WINDOW
if (++i >= argc)
{
showUsage();
}
userClockXpm = argv[i];
useUserClockXpm = 1;
#endif /* !ONLY_SHAPED_WINDOW */
}
else if ((0 == strcmp(argv[i], "-monthxpm")) ||
(0 == strcmp(argv[i], "-m")) ||
(0 == strcmp(argv[i], "--monthxpm")))
{
if (++i >= argc)
{
showUsage();
}
userMonthXpm = argv[i];
useUserMonthXpm = 1;
}
else if ((0 == strcmp(argv[i], "-weekdayxpm")) ||
(0 == strcmp(argv[i], "-w")) ||
(0 == strcmp(argv[i], "--weekdayxpm")))
{
if (++i >= argc)
{
showUsage();
}
userWeekdayXpm = argv[i];
useUserWeekdayXpm = 1;
}
else if ((0 == strcmp(argv[i], "-noblink")) ||
(0 == strcmp(argv[i], "-n")) ||
(0 == strcmp(argv[i], "--noblink")))
{
enableBlinking = 0;
}
else if ((0 == strcmp(argv[i], "-year")) ||
(0 == strcmp(argv[i], "-y")) ||
(0 == strcmp(argv[i], "--year")))
{
enableYearDisplay = 1;
}
else if ((0 == strcmp(argv[i], "-position")) ||
(0 == strcmp(argv[i], "-p")) ||
(0 == strcmp(argv[i], "--position")))
{
#ifndef ONLY_SHAPED_WINDOW
if (++i >= argc)
{
showUsage();
}
geometry = argv[i];
#endif /* !ONLY_SHAPED_WINDOW */
}
else if ((0 == strcmp(argv[i], "-shape")) ||
(0 == strcmp(argv[i], "-s")) ||
(0 == strcmp(argv[i], "--shape")))
{
enableShapedWindow = 1;
}
else if ((0 == strcmp(argv[i], "-iconic")) ||
(0 == strcmp(argv[i], "-i")) ||
(0 == strcmp(argv[i], "--iconic")))
{
#ifndef ONLY_SHAPED_WINDOW
startIconified = 1;
#endif /* !ONLY_SHAPED_WINDOW */
}
else if ((0 == strcmp(argv[i], "-version")) ||
(0 == strcmp(argv[i], "-V")) ||
(0 == strcmp(argv[i], "--version")))
{
showVersion();
}
else if ((0 == strcmp(argv[i], "-help")) ||
(0 == strcmp(argv[i], "-h")) ||
(0 == strcmp(argv[i], "--help")))
{
showUsage();
}
else
{
fprintf(stderr, "%s: unrecognized option `%s'\n",
progName, argv[i]);
showUsage();
}
}
return(i);
}
/**********************************************************************/
int main(int argc, char **argv)
{
int i;
unsigned int borderWidth = 0;
char *displayName = NULL;
XGCValues gcValues;
unsigned long gcMask;
XEvent event;
XTextProperty wmName;
XClassHint classHint;
Pixmap shapeMask;
/* Parse command line options */
progName = extractProgName(argv[0]);
processArgs(argc, argv);
/* init led position */
#ifndef ONLY_SHAPED_WINDOW
for (i = 0; i < NUM_Y_POSITIONS; i++)
{
yPos[i] = enableShapedWindow ? yPosShaped[i] : yPosUnshaped[i];
}
for (i = 0; i < NUM_X_POSITIONS; i++)
{
xPos[i] = enableShapedWindow ? xPosShaped[i] : xPosUnshaped[i];
}
#else /* ONLY_SHAPED_WINDOW */
for (i = 0; i < NUM_Y_POSITIONS; i++)
{
yPos[i] = yPosShaped[i];
}
for (i = 0; i < NUM_X_POSITIONS; i++)
{
xPos[i] = xPosShaped[i];
}
#endif /* !ONLY_SHAPED_WINDOW */
for (i = 0; i < NUM_TIME_POSITIONS; i++)
{
xPos[i] += enable12HourClock ? timePos24[i] : timePos12[i];
}
/* Open the display */
dpy = XOpenDisplay(displayName);
if (NULL == dpy)
{
fprintf(stderr, "%s: can't open display %s\n", progName,
XDisplayName(displayName));
exit(1);
}
screen = DefaultScreen(dpy);
rootWindow = RootWindow(dpy, screen);
displayDepth = DefaultDepth(dpy, screen);
/* xFd = XConnectionNumber(dpy); */
/* Icon Daten nach XImage konvertieren */
GetXpms();
/* Create a window to hold the banner */
sizeHints.x = 0;
sizeHints.y = 0;
sizeHints.min_width = clockBg.attributes.width;
sizeHints.min_height = clockBg.attributes.height;
sizeHints.max_width = clockBg.attributes.width;
sizeHints.max_height = clockBg.attributes.height;
sizeHints.base_width = clockBg.attributes.width;
sizeHints.base_height = clockBg.attributes.height;
sizeHints.flags = USSize | USPosition | PMinSize | PMaxSize | PBaseSize;
bgPixel = GetColor("white");
fgPixel = GetColor("black");
XWMGeometry(dpy, screen, geometry, NULL, borderWidth, &sizeHints,
&sizeHints.x, &sizeHints.y, &sizeHints.width, &sizeHints.height,
&sizeHints.win_gravity);
sizeHints.width = clockBg.attributes.width;
sizeHints.height = clockBg.attributes.height;
win = XCreateSimpleWindow(dpy, rootWindow, sizeHints.x, sizeHints.y,
sizeHints.width, sizeHints.height,
borderWidth, fgPixel, bgPixel);
iconWin = XCreateSimpleWindow(dpy, win, sizeHints.x, sizeHints.y,
sizeHints.width, sizeHints.height,
borderWidth, fgPixel, bgPixel);
/* Hints aktivieren */
XSetWMNormalHints(dpy, win, &sizeHints);
classHint.res_name = progName;
classHint.res_class = className;
XSetClassHint(dpy, win, &classHint);
XSelectInput(dpy, win, OUR_WINDOW_EVENTS);
XSelectInput(dpy, iconWin, OUR_WINDOW_EVENTS);
if (0 == XStringListToTextProperty(&progName, 1, &wmName))
{
fprintf(stderr, "%s: can't allocate window name text property\n",
progName);
exit(-1);
}
XSetWMName(dpy, win, &wmName);
/* Create a GC for drawing */
gcMask = GCForeground | GCBackground | GCGraphicsExposures;
gcValues.foreground = fgPixel;
gcValues.background = bgPixel;
gcValues.graphics_exposures = False;
normalGC = XCreateGC(dpy, rootWindow, gcMask, &gcValues);
if (enableShapedWindow)
{
shapeMask = XCreateBitmapFromData(dpy, win, (char *)mask_bits,
mask_width, mask_height);
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, shapeMask, ShapeSet);
XShapeCombineMask(dpy, iconWin, ShapeBounding, 0, 0, shapeMask,
ShapeSet);
}
wmHints.initial_state = WithdrawnState;
wmHints.icon_window = iconWin;
wmHints.icon_x = sizeHints.x;
wmHints.icon_y = sizeHints.y;
wmHints.window_group = win;
wmHints.flags = StateHint | IconWindowHint | IconPositionHint |
WindowGroupHint;
XSetWMHints(dpy, win, &wmHints);
XSetCommand(dpy, win, argv, argc);
XMapWindow(dpy,win);
showTime();
redrawWindow(&visible);
while (1)
{
if (actualTime != mytime())
{
actualTime = mytime();
if (actualMinutes != (actualTime / 60))
{
showTime();
if (!enableBlinking)
{
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 */
#ifdef DEBUG
fprintf(stderr, "%s: cleaning up zombies (time %ld)\n",
progName, actualTime);
#endif /* DEBUG */
if (NULL != commandToExec)
{
waitpid(0, NULL, WNOHANG);
}
}
}
/* read a packet */
while (XPending(dpy))
{
XNextEvent(dpy, &event);
switch(event.type)
{
case Expose:
if (0 == event.xexpose.count)
{
redrawWindow(&visible);
}
break;
case ButtonPress:
if (NULL != commandToExec)
{
pid_t fork_pid;
if ((NULL == commandBuf) &&
(!buildCommand(commandToExec, &commandBuf,
&commandLength, &commandIndex)))
{
break;
}
fork_pid = fork();
switch (fork_pid)
{
case 0:
/* We're the child process;
* run the command and exit.
*/
executeCommand(commandBuf);
/* When the system() call finishes, we're done. */
exit(0);
break;
case -1:
/* We're the parent process, but
* fork() gave an error.
*/
perror("fork");
break;
default:
/* We're the parent process;
* keep on doing what we normally do.
*/
break;
}
}
break;
case DestroyNotify:
#if 0
XFreeGC(dpy, normalGC);
XDestroyWindow(dpy, win);
XDestroyWindow(dpy, iconWin);
#endif /* 0 */
#ifdef ONLY_SHAPED_WINDOW
XFreePixmap(dpy, visible.pixmap);
#endif /* ONLY_SHAPED_WINDOW */
XCloseDisplay(dpy);
exit(0);
default:
break;
}
}
XFlush(dpy);
#ifdef SYSV
if (enableYearDisplay)
{
poll((struct poll *) 0, (size_t) 0, 200); /* 1/5 sec */
}
else
{
poll((struct poll *) 0, (size_t) 0, 50); /* 5/100 sec */
}
#else
if (enableYearDisplay)
{
usleep(200000L); /* 1/5 sec */
}
else
{
usleep(50000L); /* 5/100 sec */
}
#endif
}
return(0);
}
wmclock-1.0.12.2/asclock-orig/ 0040775 0001356 0001356 00000000000 07075276277 016170 5 ustar jmknoble jmknoble wmclock-1.0.12.2/asclock-orig/INSTALL 0100664 0001356 0001356 00000000172 07061374644 017206 0 ustar jmknoble jmknoble 1. Check in the Imakefile if all LIBS are ok for your system.
2. `configure`
3. `make` (Send me the output if this fails)
wmclock-1.0.12.2/asclock-orig/Imakefile 0100664 0001356 0001356 00000000271 07061374644 017766 0 ustar jmknoble jmknoble
XPMLIB = -L/usr/lib/X11 -lXpm
DEPLIBS = $(DEPXLIB)
LOCAL_LIBRARIES = $(XPMLIB) $(XLIB)
LINTLIBS = $(LINTXLIB)
SRCS = asclock.c
OBJS = asclock.o
ComplexProgramTarget(asclock)
wmclock-1.0.12.2/asclock-orig/README 0100664 0001356 0001356 00000011124 07061374644 017034 0 ustar jmknoble jmknoble =============================================
asclock - afterstep clock
the best clock for the best X-windowmanager!
=============================================
RELEASE 12
27. September 1998
by Beat Christen, spiff@longstreet.ch
COPYING
This is GPL2 software. Read the file COPYING for infos!
VERSION 1.3
Please note, that there is also a GTK version. Find out more
about this here:
http://www.gtk.org
And even an applet for the gnome desktop: See the link below for
more infos!
http://www.gnome.org
This version (now called 'classic asclock') is still being
maintained and will keep being supported until gnome has taken over
all of our desktops at work.
AVAILABILITY
the latest release should be available from
http://www.longstreet.ch/asclock
All other flavours of asclock are also maintained there.
INSTALL
1. Check in the Imakefile if all LIBS are ok for your system.
2. `configure`
3. `make` (Send me the output if this fails)
FEEDBACK
Please send me language customized 'month.xpm' and 'weekday.xpm' files.
I prefer uuencoded mail.
AUTHOR
Beat Christen
CONTRIBUTORS
low-network-
bandwidth-patch: Tim Phipps
close-color-matching-
patch: Patrick Rogan
year-display-patch: Nick Vargish
dynamic xpm Fredrik Hallenberg
loading
Shape Extensions Dan Weeks
and man page
language specific Carlos Canau
files Frank Larsen
Andy Lo A Foe
Dan Weeks
Emanuele Caratti
Jorgen Pehrson
Vadim V. Klimenko (vadim@max.odessa.ua)
Alexey L. Yarovinsky" <aleshka@cortext.co.il>
and many more. look at the changes for the
respective names.
CHANGES
26-Sep-98 - applied different patches supplied by Tim Phipps, Patrick
Rogan, Nick Vargish
Thanks to all authors for keeping those patches coming!!!
11-Apr-98 - loadable xpm's...
15-May-97 - slovene added
10-Dec-96 - ukrainian & russian added
26-Aug-96 - czech added
13-Aug-96 - french added
6-Aug-96 - spanish added (thanks to David Lazaro Saz khelekir@encomix.es)
- hungarian added
(thanks to Gyula Matics mgyula@garfield.sch.bme.hu)
- breton added (thanks to Jean-Pierre.Messager@univ-brest.fr)
30-Jul-96 - ClassHints added (patch by Peter Parnes peppar@cdt.luth.se)
23-Jul-96 - swedish added (by Jorgen Pehrson d93jpe@blg.du.se)
4-Jul-96 - italian added (by Emanuele Caratti)
- improved configure
21-Jun-96 - '-iconic' state added
- usleep did not exist on Solaris 2.4: changed to poll()
- better error messages
8-Jun-96 - '-noblink' feature added
- final switch to imake
30-May-96 - am/pm should not show 0:00 am/pm but 12:00 am/pm
- portuguese weekday resized
- man page (by Dan Weeks)
25-May-96 - '-geometry' is now '-position' and it _works_ !!!
- in AM/PM mode, no leading one was visible...
- '-led' command line option added
24-May-96 - asclock can start an executable: as default you get a
message on console
- command line options added (-exe, -geometry, -shape, -12, -24)
- Shape-Extension (by Dan Weeks)
- now it's a Build script
- dutch added (by Andy Lo A Foe <arloafoe@cs.vu.nl>)
- norwegian added (by Frank Larsen <frankrl@stud.cs.uit.no>)
22-May-96 - obscure, not necessary XRaiseWindow removed :)
- error-message if Xpm-conversion failed
- name changed to 'afterstep clock'
- blinking optimized
- color selection in Configure
- color led added (by James Robinson <jimr@simons-rock.edu>)
- portuguese added (by Carlos Canau <canau@dawn.EUnet.pt>)
- Makefile improvements
- Configure is now for sh
20-May-96 - english support added (by Dan Weeks <dan@mango.sfasu.edu>)
- Language configure script
- german weekday widened to same size as english...
- Makefile changes for Solaris
18-May-96 - 8bit greyscale support added
- slightly moved the time-led's
- no bmclock directory was created while decompressing
--
END OF FILE
wmclock-1.0.12.2/asclock-orig/asclock.c 0100664 0001356 0001356 00000040657 07061374644 017754 0 ustar jmknoble jmknoble #include <stdio.h>
#include <X11/Xlib.h>
#include <X11/xpm.h>
#include <X11/extensions/shape.h>
#include <time.h>
#include <sys/time.h>
#include <X11/Xatom.h>
#include <unistd.h>
#include "clk.xpm"
#include "led.xpm"
#include "month.xpm"
#include "date.xpm"
#include "weekday.xpm"
#include "xpm/mask.xbm"
#include "xpm/mask.xpm"
int SHOWAMPM=0; /* default value is 24h format */
int ONLYSHAPE=0; /* default value is noshape */
int ITBLINKS=1; /* default is blinking */
int ICONIFIED=0; /* default is not iconified */
int YEAR=0; /* default is to show time, not year */
/* led positions *************************************************************/
int twelve[5] = {5, 14, 24, 28, 37};
int twfour[5] = {4, 8, 17, 22, 31};
/* with shape */
int ws_posx[11] = {0,0,0,0,0,40, 17, 17, 22, 27, 15};
int ws_posy[4] = {3, 21, 30, 45};
/* no shape */
int ns_posx[11] = {5,5,5,5,5,45, 21, 21, 26, 31, 19};
int ns_posy[4] = {7, 25, 34, 49};
int posx[11];
int posy[4];
/* X11 Variablen *************************************************************/
Display *dpy; /* welches DISPLAY */
Window Root; /* Hintergrund-Drawable */
int screen;
int x_fd;
int d_depth;
XSizeHints mysizehints;
XWMHints mywmhints;
Pixel back_pix, fore_pix;
GC NormalGC;
Window iconwin, win; /* My home is my window */
char *ProgName;
char *Geometry;
char *LedColor = "LightSeaGreen";
char Execute[] = "echo no program has been specified >/dev/console";
char *ERR_colorcells = "not enough free color cells or xpm not found\n";
char *ampers = " &";
int readmonthxpm = 0;
char monthxpm[256];
int readclockxpm = 0;
char clockxpm[256];
int readweekxpm = 0;
char weekxpm[256];
/* XPM Variablen *************************************************************/
typedef struct _XpmIcon {
Pixmap pixmap;
Pixmap mask;
XpmAttributes attributes;
} XpmIcon;
XpmIcon asclock, led, month, date, weekday;
XpmIcon visible;
time_t actualtime;
long actualmin;
/* lokale Funktionen *********************************************************/
#define MW_EVENTS (ExposureMask | ButtonPressMask | StructureNotifyMask)
#define FALSE 0
void GetXPM(void);
Pixel GetColor(char *name);
void RedrawWindow( XpmIcon *v);
void InsertTime();
/*****************************************************************************/
/*****************************************************************************/
static char *help_message[] = {
"where options include:",
" -12 12 hour format",
" -24 24 hour format",
" -exe <program> program to start on click",
" -led <color> color of the led",
" -monthxpm <xpm> month xpm",
" -clockxpm <xpm> clock xpm",
" -weekdayxpm <xpm> weekday xpm",
" -position [+|-]x[+|-]y position of asclock",
" -shape without groundplate",
" -noblink don't blink",
" -iconic start up as icon",
" -year show year instead of time",
NULL
};
void usage()
{
char **cpp;
fprintf(stderr,"usage: %s [-options ...] \n", ProgName);
for (cpp = help_message; *cpp; cpp++) {
fprintf(stderr, "%s\n", *cpp);
}
fprintf(stderr,"\n");
exit(1);
}
int main(int argc,char *argv[])
{
int i;
unsigned int borderwidth ;
char *display_name = NULL;
char *wname = "asclock";
XGCValues gcv;
unsigned long gcm;
XEvent Event;
XTextProperty name;
XClassHint classHint;
Pixmap pixmask;
ProgName = argv[0];
Geometry = "";
/* Parse command line options */
ProgName = argv[0];
for(i=1;i<argc;i++) {
char *arg= argv[i];
if (arg[0] == '-') {
switch(arg[1]) {
case '1':
SHOWAMPM=1;
continue;
case '2':
SHOWAMPM=0;
continue;
case 'e':
if(++i >=argc) usage();
strcpy(&Execute[0], argv[i]);
strcat(&Execute[0], " &");
continue;
case 'c':
if(++i >=argc) usage();
strcpy(&clockxpm[0], argv[i]);
readclockxpm = 1;
continue;
case 'm':
if(++i >=argc) usage();
strcpy(&monthxpm[0], argv[i]);
readmonthxpm = 1;
continue;
case 'w':
if(++i >=argc) usage();
strcpy(&weekxpm[0], argv[i]);
readweekxpm = 1;
continue;
case 's':
ONLYSHAPE=1;
continue;
case 'p':
if(++i >=argc) usage();
Geometry = argv[i];
continue;
case 'i':
ICONIFIED=1;
continue;
case 'l':
if(++i >=argc) usage();
LedColor = argv[i];
continue;
case 'n':
ITBLINKS = 0;
continue;
case 'y':
YEAR = 1;
continue;
default:
usage();
}
}
}
/* init led position */
for(i=0;i<4;i++)
posy[i] = ONLYSHAPE ? ws_posy[i] : ns_posy[i];
for(i=0;i<11;i++)
posx[i] = ONLYSHAPE ? ws_posx[i] : ns_posx[i];
for(i=0;i<5;i++)
posx[i] += SHOWAMPM ? twfour[i] : twelve[i];
/* Open the display */
if (!(dpy = XOpenDisplay(display_name)))
{
fprintf(stderr,"asclock: can't open display %s\n",
XDisplayName(display_name));
exit (1);
}
screen= DefaultScreen(dpy);
Root = RootWindow(dpy, screen);
d_depth = DefaultDepth(dpy, screen);
x_fd = XConnectionNumber(dpy);
/* Icon Daten nach XImage konvertieren */
GetXPM();
/* Create a window to hold the banner */
mysizehints.flags= USSize|USPosition;
mysizehints.x = 0;
mysizehints.y = 0;
back_pix = GetColor("white");
fore_pix = GetColor("black");
XWMGeometry(dpy, screen, Geometry, NULL, (borderwidth =1), &mysizehints,
&mysizehints.x,&mysizehints.y,&mysizehints.width,&mysizehints.height, &i);
mysizehints.width = asclock.attributes.width;
mysizehints.height= asclock.attributes.height;
win = XCreateSimpleWindow(dpy,Root,mysizehints.x,mysizehints.y,
mysizehints.width,mysizehints.height,
borderwidth,fore_pix,back_pix);
iconwin = XCreateSimpleWindow(dpy,win,mysizehints.x,mysizehints.y,
mysizehints.width,mysizehints.height,
borderwidth,fore_pix,back_pix);
/* Hints aktivieren */
XSetWMNormalHints(dpy, win, &mysizehints);
classHint.res_name = "asclock";
classHint.res_class = " ASClock";
XSetClassHint(dpy, win, &classHint);
XSelectInput(dpy,win,MW_EVENTS);
XSelectInput(dpy,iconwin,MW_EVENTS);
if (XStringListToTextProperty(&wname, 1, &name) ==0) {
fprintf(stderr, "asclock: can't allocate window name\n");
exit(-1);
}
XSetWMName(dpy, win, &name);
/* Create a GC for drawing */
gcm = GCForeground|GCBackground|GCGraphicsExposures;
gcv.foreground = fore_pix;
gcv.background = back_pix;
gcv.graphics_exposures = FALSE;
NormalGC = XCreateGC(dpy, Root, gcm, &gcv);
if (ONLYSHAPE) { /* try to make shaped window here */
pixmask = XCreateBitmapFromData(dpy, win, mask_bits, mask_width,
mask_height);
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, pixmask, ShapeSet);
XShapeCombineMask(dpy, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
}
mywmhints.initial_state = (ICONIFIED ? IconicState : NormalState);
mywmhints.icon_window = iconwin;
mywmhints.icon_x = mysizehints.x;
mywmhints.icon_y = mysizehints.y;
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint;
XSetWMHints(dpy, win, &mywmhints);
XMapWindow(dpy,win);
InsertTime();
RedrawWindow(&visible);
while(1)
{
if (actualtime != mytime())
{
actualtime = mytime();
if(actualmin != actualtime / 60)
{
InsertTime();
if (!ITBLINKS) RedrawWindow(&visible);
}
if (ITBLINKS && (! YEAR))
{
if (actualtime % 2)
/* Sekunden Doppelpunkt ein */
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
90,0,3,11,posx[2], posy[0]);
else
/* Sekunden Doppelpunkt aus */
XCopyArea(dpy, asclock.pixmap, visible.pixmap, NormalGC,
27,6,3,11,posx[2], posy[0]);
RedrawWindow(&visible);
}
}
/* read a packet */
while (XPending(dpy))
{
XNextEvent(dpy,&Event);
switch(Event.type)
{
case Expose:
if(Event.xexpose.count == 0 )
RedrawWindow(&visible);
break;
case ButtonPress:
system(Execute);
break;
case DestroyNotify:
/*
XFreeGC(dpy, NormalGC);
XDestroyWindow(dpy, win);
XDestroyWindow(dpy, iconwin);
*/
XCloseDisplay(dpy);
exit(0);
default:
break;
}
}
XFlush(dpy);
#ifdef SYSV
if (YEAR) {
poll((struct poll *) 0, (size_t) 0, 200);
} else
poll((struct poll *) 0, (size_t) 0, 50);
#else
if (YEAR) {
usleep(200000L); /* 1/5 sec */
} else
usleep(50000L); /* 5/100 sec */
#endif
}
return 0;
}
/****************************************************************************/
void nocolor(char *a, char *b)
{
fprintf(stderr,"asclock: can't %s %s\n", a,b);
}
/****************************************************************************/
/* Konvertiere XPMIcons nach XImage */
void GetXPM(void)
{
static char **clock_xpm;
XColor col;
XWindowAttributes attributes;
char led1[23];
char led2[23];
int ret;
clock_xpm =ONLYSHAPE ? mask_xpm : clk_xpm;
/* for the colormap */
XGetWindowAttributes(dpy,Root,&attributes);
/* get user-defined color */
if (!XParseColor (dpy, attributes.colormap, LedColor, &col))
{
nocolor("parse",LedColor);
}
sprintf(&led1[0], ". c #%4X%4X%4X", col.red, col.green, col.blue);
for(ret=10;ret<22;ret++)
if(led1[ret]==' ') led1[ret]='0';
led_xpm[2] = &led1[0];
col.red = (col.red /10) *3;
col.green = (col.green/10) *3;
col.blue = (col.blue /10) *3;
sprintf(&led2[0], "X c #%4X%4X%4X", col.red, col.green, col.blue);
for(ret=10;ret<22;ret++)
if(led2[ret]==' ') led2[ret]='0';
led_xpm[3] = &led2[0];
asclock.attributes.closeness = 40000; /* Allow for "similar" colors */
asclock.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
if (readclockxpm)
ret = XpmReadFileToPixmap(dpy, Root, clockxpm,
&asclock.pixmap, &asclock.mask, &asclock.attributes);
else
ret = XpmCreatePixmapFromData(dpy, Root, clock_xpm, &asclock.pixmap,
&asclock.mask, &asclock.attributes);
if(ret != XpmSuccess)
{nocolor("create asclock xpm", ERR_colorcells);exit(1);}
visible.attributes.closeness = 40000; /* Allow for "similar" colors */
visible.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
ret = XpmCreatePixmapFromData(dpy, Root, clk_xpm, &visible.pixmap,
&visible.mask, &visible.attributes);
led.attributes.closeness = 40000; /* Allow for "similar" colors */
led.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
ret = XpmCreatePixmapFromData(dpy, Root, led_xpm, &led.pixmap,
&led.mask, &led.attributes);
if(ret != XpmSuccess)
{nocolor("create led xpm", ERR_colorcells);exit(1);}
month.attributes.closeness = 40000; /* Allow for "similar" colors */
month.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
if (readmonthxpm)
ret = XpmReadFileToPixmap(dpy, Root, monthxpm,
&month.pixmap, &month.mask, &month.attributes);
else
ret = XpmCreatePixmapFromData(dpy, Root, month_xpm, &month.pixmap,
&month.mask, &month.attributes);
if(ret != XpmSuccess)
{nocolor("create month xpm", ERR_colorcells);exit(1);}
date.attributes.closeness = 40000; /* Allow for "similar" colors */
date.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
ret = XpmCreatePixmapFromData(dpy, Root, date_xpm, &date.pixmap,
&date.mask, &date.attributes);
if(ret != XpmSuccess)
{nocolor("create date xpm", ERR_colorcells);exit(1);}
weekday.attributes.closeness = 40000; /* Allow for "similar" colors */
weekday.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions | XpmCloseness);
if (readweekxpm)
ret = XpmReadFileToPixmap(dpy, Root, weekxpm,
&weekday.pixmap, &weekday.mask, &weekday.attributes);
else
ret = XpmCreatePixmapFromData(dpy, Root, weekday_xpm, &weekday.pixmap,
&weekday.mask, &weekday.attributes);
if(ret != XpmSuccess)
{nocolor("create weekday xpm", ERR_colorcells);exit(1);}
}
/****************************************************************************/
/* Removes expose events for a specific window from the queue */
int flush_expose (Window w)
{
XEvent dummy;
int i=0;
while (XCheckTypedWindowEvent (dpy, w, Expose, &dummy))i++;
return i;
}
/****************************************************************************/
/* Draws the icon window */
void RedrawWindow( XpmIcon *v)
{
flush_expose (iconwin);
XCopyArea(dpy,v->pixmap,iconwin,NormalGC,
0,0,v->attributes.width, v->attributes.height,0,0);
flush_expose (win);
XCopyArea(dpy,v->pixmap,win,NormalGC,
0,0,v->attributes.width, v->attributes.height,0,0);
}
/****************************************************************************/
Pixel GetColor(char *name)
{
XColor color;
XWindowAttributes attributes;
XGetWindowAttributes(dpy,Root,&attributes);
color.pixel = 0;
if (!XParseColor (dpy, attributes.colormap, name, &color))
{
nocolor("parse",name);
}
else if(!XAllocColor (dpy, attributes.colormap, &color))
{
nocolor("alloc",name);
}
return color.pixel;
}
/****************************************************************************/
static struct tm *clk;
void Year()
{
int year;
year = clk->tm_year + 1900;
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(year / 1000),0,9,11,posx[0],posy[0]);
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*((year % 1000) / 100),0,9,11,posx[1], posy[0]);
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*((year % 100) / 10),0,9,11,posx[3],posy[0]);
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(year % 10),0,9,11,posx[4],posy[0]);
}
void Twelve()
{
int thishour;
/* Stunde ohne am/pm */
thishour = clk->tm_hour % 12;
if (thishour == 0 )
thishour = 12;
if (clk->tm_hour >= 12)
{
/* PM */
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
107,5,11,6,posx[5],posy[0]+5);
}
else
/* AM */
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
94,5,12,6,posx[5],posy[0]+5);
if (thishour>9)
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
13,0,5,11,posx[0], posy[0]);
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(thishour % 10),0,9,11,posx[1], posy[0]);
/* Minute, drawn first, so am/pm won't be overwritten */
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(clk->tm_min / 10),0,9,11,posx[3],posy[0]);
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(clk->tm_min % 10),0,9,11,posx[4],posy[0]);
}
void TwentyFour()
{
/* Stunde ohne am/pm */
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(clk->tm_hour / 10),0,9,11,posx[0],posy[0]);
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(clk->tm_hour % 10),0,9,11,posx[1], posy[0]);
/* Minute */
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(clk->tm_min / 10),0,9,11,posx[3],posy[0]);
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
9*(clk->tm_min % 10),0,9,11,posx[4],posy[0]);
}
/****************************************************************************/
int mytime()
{
struct timeval tv;
struct timezone tz;
gettimeofday(&tv, &tz);
return tv.tv_sec;
}
/****************************************************************************/
void InsertTime()
{
int thismonth, thisweekday, thisdate;
/* Zeit auslesen */
actualtime = mytime();
actualmin = actualtime / 60;
clk = localtime(&actualtime);
/* leere asclock holen */
XCopyArea(dpy, asclock.pixmap, visible.pixmap, NormalGC,
0,0,mysizehints.width,mysizehints.height,0,0);
if (YEAR) {
Year();
} else if (SHOWAMPM)
{
Twelve();
}
else
TwentyFour();
/* Monat */
XCopyArea(dpy, month.pixmap, visible.pixmap, NormalGC,
0,6*(clk->tm_mon ),22,6,posx[10],posy[3]);
/* Datum */
if (clk->tm_mday>9)
{
XCopyArea(dpy, date.pixmap, visible.pixmap, NormalGC,
9*((clk->tm_mday / 10 +9) % 10),0,9,13,posx[7],posy[2]);
XCopyArea(dpy, date.pixmap, visible.pixmap, NormalGC,
9*((clk->tm_mday % 10 +9) % 10),0,9,13,posx[9],posy[2]);
}
else
XCopyArea(dpy, date.pixmap, visible.pixmap, NormalGC,
9*(clk->tm_mday -1),0,9,13,posx[8], posy[2]);
/* Wochentag */
XCopyArea(dpy, weekday.pixmap, visible.pixmap, NormalGC,
0,6*((clk->tm_wday +6) % 7),21,7,posx[6], posy[1]);
if ((! ITBLINKS) && (! YEAR))
/* Sekunden Doppelpunkt ein */
XCopyArea(dpy, led.pixmap, visible.pixmap, NormalGC,
90,0,3,11,posx[2], posy[0]);
}
wmclock-1.0.12.2/asclock-orig/asclock.man 0100664 0001356 0001356 00000006242 07061374644 020275 0 ustar jmknoble jmknoble .TH asclock 0.99 "23 July 1996" asclock
.UC
.SH NAME
\fBasclock\fP \- the AfterStep clock
.SH SYNOPSIS
.B asclock
[ -help] [-12 | -24] [-shape]
[-position \fI[+|-]x[+|-]y\fP]
[-exe \fIprogram\fP]
[-led \fIcolor\fP]
[-noblink] [-iconic]
.SH DESCRIPTION
The \fBasclock\fP is a clock written to emulate the date/time application on
the NEXTSTEP(tm) operating system. \fBasclock\fP supports multiple languages,
military and AM/PM time formats, program execution, and the shape extention
to X-Windows.
.SH CONFIGURATION OPTIONS
.IP "-help"
.RS
prints the usage message:
.nf
usage: asclock [-options ...]
where options include:
-12 12 hour format
-24 24 hour format
-exe <program> program to start on click
-led <color> color of the led
-position [+|-]x[+|-]y position of asclock
-shape without groundplate
-noblink don't blink
-iconic start up as icon
.fi
.RE
.IP "-12 or -24"
.RS
sets the desired time format to either twelve hour
with AM/PM ( -12 ) or military time ( -24 ). If no
option is given military time is used.
.RE
.IP "-shape"
.RS
turn on shaped window support for \fBasclock\fP. When this is turned on the
\fBasclock\fP windows will only appear to be the led and date pad. By default
shaped windows are turned off and the clock will appear on a 64 pixel by 64
pixel base.
.RE
.IP "-led <color>"
.RS
specifies the color of the led. To find out what colors are available, try
.I showrgb
.P (part of X11).
.RE
.IP "-position [+|-]x[+|-]y "
.RS
specifies the starting position of \fBasclock\fP. The [+|-] works like the standard X-Windows x/y geometry option.
.RE
.IP "-exe <program>"
.RS
specifies the application to start when the pointer is activated over \fBasclock\fP. To invoke applications with parameters, you have to set quotes around the command. See example below...
.RE
.IP "-noblink"
.RS
specifies if asclock should blink.
.RE
.IP "-iconic"
.RS
This gives weird output with AfterStep, so don't bother. It's for mwm and other wm's with no hint functionality.
.RE
.SH INVOCATION
\fBasclock\fP can be called from one of many ways. The most common invocation
is the command line:
.nf
[user@host] ~% asclock -12 -exe 'xlock -mode hop' &
.fi
Another way to call \fBasclock\fP is from the window manager:
.nf
*Wharf - - MaxSwallow "asclock" asclock -shape -12&
.fi
This line, when placed in the \fI.steprc\fP file in the users home directory
will cause \fBasclock\fP to use the shape extensions so that it will be a
button on the \fBWharf (1)\fP button bar under the \fBafterstep (1)\fP
window manager.
.SH BUGS
we don't have bugs :)
.SH COPYRIGHTS
Copyright 1996, Beat Christen <bchriste@iiic.ethz.ch>. No guarantees or
warranties or anything are provided or implied in any way whatsoever.
Use this program at your own risk. Permission to use this program for
any purpose is given, as long as the copyright is kept intact.
.SH AUTHORS
Beat Christen <bchriste@iiic.ethz.ch> -- application
.sp
Dan Weeks <dan@mango.sfasu.edu> -- man page
wmclock-1.0.12.2/asclock-orig/configure 0100775 0001356 0001356 00000003406 07061374644 020067 0 ustar jmknoble jmknoble