Package: wmfishtime
Version: 1:1.24-5+digiclock
Severity: wishlist
Tags: patch
Hi,
having problems with reading analog clocks, I'd like you to take my
patch to implement an optional digital clock display for wmfishtime or
forward it to its upstream authro. It is not quite as nice looking as
the analog clock, though. ;-)
When started normally, the behavior of wmfishtime is not
changed. I.e. it starts up just normal with the analog clock
activated.
The patch implements an option "-a" that disables the analog clock and
an option "-d" that enables a digital clock. This also gives the
option to run wmfishtime without any clock display (as calendar
applet) or with both displays.
Thanks for considering,
René
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-amd64
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Versions of packages wmfishtime depends on:
ii libc6 2.3.6.ds1-4 GNU C Library: Shared libraries
ii libglib1.2 1.2.10-10.1 The GLib library of C routines
ii libgtk1.2 1.2.10-18 The GIMP Toolkit set of widgets fo
ii libx11-6 2:1.0.0-9 X11 client-side library
ii libxext6 1:1.0.1-2 X11 miscellaneous extension librar
ii libxi6 1:1.0.1-3 X11 Input extension library
wmfishtime recommends no packages.
-- no debconf information
diff -ruN wmfishtime-1.24/fishmon.c wmfishtime-1.24+digital_clock/fishmon.c
--- wmfishtime-1.24/fishmon.c 2004-05-13 01:55:59.000000000 +0200
+++ wmfishtime-1.24+digital_clock/fishmon.c 2006-09-26 16:10:06.000000000 +0200
@@ -81,6 +81,8 @@
static int enable_check_mail = 0; /* no mail check for default !!! */
static int new_mail = 0; /* no new mail for default !!! */
static int broken_wm = 0; /* need broken windowmanager fix? */
+static int clock_analog = 1; /* display analog clock */
+static int clock_digital = 0; /* display digital clock */
/* 34 sprites:
* 0, 2, 4, 6, 8, 10, 12, 14 - fish left
@@ -277,6 +279,7 @@
struct tm *data;
time_t cur_time;
static time_t old_time;
+ static char buffer[9];
int hr, min, sec;
static int osec = -1;
@@ -296,6 +299,10 @@
min = data->tm_min;
sec = data->tm_sec;
+ /* build digital clock */
+ sprintf(buffer, "%02d %02d %02d", data->tm_hour,
+ data->tm_min, data->tm_sec);
+
/* hours */
if ((sec % 15) == 0) {
psi = hr * (M_PI / 6.0);
@@ -339,10 +346,14 @@
}
/* must redraw each frame */
- anti_line(28, 24, hdx, hdy, 1, 0xbf0000);
- anti_line(28, 24, mdx, mdy, 1, 0x00aa00);
- anti_line(28, 24, sdx, sdy, 1, 0xc79f2b);
+ if(clock_analog) {
+ anti_line(28, 24, hdx, hdy, 1, 0xbf0000);
+ anti_line(28, 24, mdx, mdy, 1, 0x00aa00);
+ anti_line(28, 24, sdx, sdy, 1, 0xc79f2b);
+ }
+ if(clock_digital)
+ draw_string(4, 2, buffer);
}
static void weed_update(void)
@@ -543,7 +554,8 @@
}
/* now draw the clock face */
- for (i = 0; i < 60; i += 5) {
+ if(clock_analog) {
+ for (i = 0; i < 60; i += 5) {
psi = i * (M_PI / 30.0);
dx = floor(sin(psi) * 25 * 0.9) + 29;
dy = floor(-cos(psi) * 22 * 0.9) + 24;
@@ -559,6 +571,7 @@
idx = 28;
}
draw_sprite_alpha(dx, dy, idx, 20);
+ }
}
curr_time = time(NULL);
@@ -1028,6 +1041,10 @@
{ "check-mail", no_argument, &enable_check_mail, 1 },
{ "b", no_argument, &broken_wm, 1 },
{ "broken", no_argument, &broken_wm, 1 },
+ { "a", no_argument, &clock_analog, 0},
+ { "no-analog", no_argument, &clock_analog, 0},
+ { "d", no_argument, &clock_digital, 1},
+ { "digital", no_argument, &clock_digital, 1},
{ 0, 0, 0, 0 }
};
@@ -1051,7 +1068,9 @@
" -h\t--help\t\tshow this message and exit\n"
" -v\t--version\tshow version and exit\n"
" -c\t--check-mail\tenables check for new mail\n"
- " -b\t--broken\tactivates broken window manager fix\n\n"
+ " -b\t--broken\tactivates broken window manager fix\n"
+ " -a\t--no-analog\tdisables display of analog clock\n"
+ " -d\t--digital\tenables display of digital clock\n\n"
"Yet Another Waste of CPU Cycles! Dock app clock with\n"
"shy fish, bubbles and mail check functionality (disabled by default).\n"
"Try out the man page wmfishtime (1x).\n");