1
0
forked from ports/contrib

wmclock: adopted from opt, fixed few bugs

This commit is contained in:
Mikhail Kolesnik 2009-01-11 21:13:11 +02:00
parent ec82c6338e
commit b319673240
6 changed files with 164 additions and 0 deletions

6
wmclock/.footprint Normal file
View File

@ -0,0 +1,6 @@
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/bin/
-rwxr-xr-x root/root usr/bin/wmclock
drwxr-xr-x root/root usr/man/
drwxr-xr-x root/root usr/man/man1/
-r--r--r-- root/root usr/man/man1/wmclock.1x.gz

4
wmclock/.md5sum Normal file
View File

@ -0,0 +1,4 @@
97f6e82f55f216ba724859d4652586b4 wmclock-1.0.12.2.tar.gz
0b6171a856c041fec0b2fc61d4bf2cc0 wmclock-fix_year_display.diff
682670891873386fec16c1d2219c374d wmclock-manpage.diff
ef26a885e3b2c75388560211e9d9b5c1 wmclock-nopolling.diff

21
wmclock/Pkgfile Normal file
View File

@ -0,0 +1,21 @@
# Description: A Window Maker applet which displays date and time
# URL: http://www.jmknoble.net/WindowMaker/wmclock/
# Maintainer: Mikhail Kolesnik, mike at openbunker dot org
# Packager: Simone Rota, sip at crux dot nu
# Depends on: xorg-gccmakedep, xorg-imake, xorg-libxpm
name=wmclock
version=1.0.12.2
release=3
source=(http://www.dockapps.org/download.php/id/328/$name-$version.tar.gz \
$name-nopolling.diff $name-fix_year_display.diff $name-manpage.diff)
build() {
cd $name-$version
patch -p0 -i $SRC/$name-nopolling.diff
patch -p0 -i $SRC/$name-fix_year_display.diff
patch -p0 -i $SRC/$name-manpage.diff
./configure --lang english
make
make DESTDIR=$PKG install install.man
}

View File

@ -0,0 +1,34 @@
--- wmclock.c-orig 2008-11-16 18:23:07.185633821 +0100
+++ wmclock.c 2008-11-16 18:23:25.482650412 +0100
@@ -828,7 +828,14 @@
#endif /* !ONLY_SHAPED_WINDOW */
for (i = 0; i < NUM_TIME_POSITIONS; i++)
{
- xPos[i] += enable12HourClock ? timePos24[i] : timePos12[i];
+ if (enable12HourClock && (!enableYearDisplay))
+ {
+ xPos[i] += timePos24[i];
+ }
+ else
+ {
+ xPos[i] += timePos12[i];
+ }
}
/* Open the display */
--- wmclock.c-orig 2000-03-08 08:31:33.000000000 +0100
+++ wmclock.c 2007-10-03 22:42:36.000000000 +0200
@@ -470,11 +470,11 @@
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);
+ digitXOffset = LED_NUM_WIDTH * (year % 1000 / 100);
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);
+ digitXOffset = LED_NUM_WIDTH * (year % 100 / 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]);

View File

@ -0,0 +1,22 @@
--- wmclock.man.in-orig 2008-11-16 18:22:33.061623927 +0100
+++ wmclock.man.in 2008-11-16 18:22:33.417626015 +0100
@@ -25,9 +25,7 @@
.TH wmclock 1x "@DATE@" "Version @VERSION@"
.\" ----------------------------------------------------------------
.SH NAME
-.PP
-.BR wmclock :
-a dockable clock for the Window Maker window manager
+wmclock \- A dockable clock for the Window Maker window manager
.\" ----------------------------------------------------------------
.SH SYNOPSIS
.HP
@@ -196,7 +194,7 @@
.\" ----------------------------------------------------------------
.SH COPYRIGHT AND LICENSE
.PP
-Copyright © 1999 by Jim Knoble <jmknoble@pobox.com>. Significant
+Copyright \(co 1999 by Jim Knoble <jmknoble@pobox.com>. Significant
portions of
.B wmclock
are directly derived from

View File

@ -0,0 +1,77 @@
--- wmclock.c.orig 2008-09-28 17:41:49.000000000 +0200
+++ wmclock.c 2008-09-28 20:33:59.000000000 +0200
@@ -20,6 +20,7 @@
* with the software or the use or other dealings in the software.
*/
+#include <sys/select.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
@@ -141,7 +142,8 @@
Display *dpy;
Window rootWindow;
int screen;
-/* int xFd; */
+int xFd;
+fd_set xFdSet;
int displayDepth;
XSizeHints sizeHints;
XWMHints wmHints;
@@ -801,6 +803,7 @@
XTextProperty wmName;
XClassHint classHint;
Pixmap shapeMask;
+ struct timeval nextEvent;
/* Parse command line options */
progName = extractProgName(argv[0]);
@@ -849,7 +852,7 @@
screen = DefaultScreen(dpy);
rootWindow = RootWindow(dpy, screen);
displayDepth = DefaultDepth(dpy, screen);
- /* xFd = XConnectionNumber(dpy); */
+ xFd = XConnectionNumber(dpy);
/* Icon Daten nach XImage konvertieren */
GetXpms();
@@ -1049,14 +1052,32 @@
poll((struct poll *) 0, (size_t) 0, 50); /* 5/100 sec */
}
#else
- if (enableYearDisplay)
- {
- usleep(200000L); /* 1/5 sec */
- }
+ //We compute the date of next event, in order to avoid polling
+ if (enableBlinking)
+ {
+ gettimeofday(&nextEvent,NULL);
+ nextEvent.tv_sec = 0;
+ nextEvent.tv_usec = 1000000-nextEvent.tv_usec;
+ }
else
- {
- usleep(50000L); /* 5/100 sec */
- }
+ {
+ if (enableYearDisplay)
+ {
+ nextEvent.tv_sec = 86400-actualTime%86400;
+ nextEvent.tv_usec = 0;
+ }
+ else
+ {
+ nextEvent.tv_sec = 60-actualTime%60;
+ nextEvent.tv_usec = 0;
+ }
+ }
+ printf("xFd %d\n", xFd);
+ FD_ZERO(&xFdSet);
+ FD_SET(xFd,&xFdSet);
+ printf("debut select %d\n", nextEvent.tv_sec);
+ select(FD_SETSIZE,&xFdSet,NULL,NULL,&nextEvent);
+ printf("fin select\n");
#endif
}
return(0);