Remove trailing whitespace.

This commit is contained in:
Doug Torrance 2018-01-08 08:28:15 -05:00 committed by Carlos R. Mafra
parent cb7b362149
commit 0075abd36f
44 changed files with 618 additions and 618 deletions

View file

@ -40,13 +40,13 @@ char temp[BUFFER_SIZE];
while(fscanf(fp_memory, "%s", temp)!=EOF) { while(fscanf(fp_memory, "%s", temp)!=EOF) {
if(!strncmp(temp,"MemTotal:", 9)) if(!strncmp(temp,"MemTotal:", 9))
fscanf(fp_memory, "%Ld", &m_total); fscanf(fp_memory, "%Ld", &m_total);
if(!strncmp(temp,"MemFree:", 8)) if(!strncmp(temp,"MemFree:", 8))
fscanf(fp_memory, "%Ld", &m_free); fscanf(fp_memory, "%Ld", &m_free);
if(!strncmp(temp,"Cached:", 7)) if(!strncmp(temp,"Cached:", 7))
fscanf(fp_memory, "%Ld", &m_cached); fscanf(fp_memory, "%Ld", &m_cached);
} }
@ -175,7 +175,7 @@ struct timeval timeout;
fp_loadavg = fopen("/proc/loadavg", "r"); fp_loadavg = fopen("/proc/loadavg", "r");
fp_stat = fopen("/proc/stat", "r"); fp_stat = fopen("/proc/stat", "r");
for (j=0; j<V_WIDTH+1; j++) for (j=0; j<V_WIDTH+1; j++)
cpu_device.his[j] = 0; cpu_device.his[j] = 0;
cpu_device.hisaddcnt = 0; cpu_device.hisaddcnt = 0;
@ -197,14 +197,14 @@ struct timeval timeout;
cpu_device.idlelast = idle; cpu_device.idlelast = idle;
if (show_memory) { if (show_memory) {
dcl_draw_string(6, 5, "cpu", FONT_NORMAL, 3); dcl_draw_string(6, 5, "cpu", FONT_NORMAL, 3);
dcl_draw_string(6, 12, "mem", FONT_NORMAL, 3); dcl_draw_string(6, 12, "mem", FONT_NORMAL, 3);
dcl_copy_xpm_area(5, 57, 54, 1, 5, 18); dcl_copy_xpm_area(5, 57, 54, 1, 5, 18);
get_mem_statistics(&free_memory); get_mem_statistics(&free_memory);
draw_memory_meter(); draw_memory_meter();
draw_stats(cpu_device.his, V_WIDTH, V_HEIGHT_MEM, 5, 55); draw_stats(cpu_device.his, V_WIDTH, V_HEIGHT_MEM, 5, 55);
} else { } else {
dcl_draw_string(6, 5, "cpu", FONT_LARGE, 3); dcl_draw_string(6, 5, "cpu", FONT_LARGE, 3);
@ -220,7 +220,7 @@ struct timeval timeout;
waitpid(0, NULL, WNOHANG); waitpid(0, NULL, WNOHANG);
update_stat_cpu(&cpu_device); update_stat_cpu(&cpu_device);
/* cpu meter */ /* cpu meter */
dcl_copy_xpm_area(0, 64, 32, 7-(show_memory*2), 26, 5); dcl_copy_xpm_area(0, 64, 32, 7-(show_memory*2), 26, 5);
@ -246,7 +246,7 @@ struct timeval timeout;
draw_memory_meter(); draw_memory_meter();
draw_stats(cpu_device.his, V_WIDTH, V_HEIGHT_MEM, 5, 55); draw_stats(cpu_device.his, V_WIDTH, V_HEIGHT_MEM, 5, 55);
} else } else
draw_stats(cpu_device.his, V_WIDTH, V_HEIGHT, 5, 55); draw_stats(cpu_device.his, V_WIDTH, V_HEIGHT, 5, 55);
cpu_device.his[V_WIDTH] = 0; cpu_device.his[V_WIDTH] = 0;
@ -289,7 +289,7 @@ struct timeval timeout;
break; break;
case ButtonRelease: case ButtonRelease:
i = dcl_check_mouse_region(Event.xbutton.x, Event.xbutton.y); i = dcl_check_mouse_region(Event.xbutton.x, Event.xbutton.y);
if(!i && Event.xbutton.button == LMB && cmd_lmb) if(!i && Event.xbutton.button == LMB && cmd_lmb)
dcl_execute_command(command_lmb, 0); dcl_execute_command(command_lmb, 0);
else if(!i && Event.xbutton.button == RMB && cmd_rmb) else if(!i && Event.xbutton.button == RMB && cmd_rmb)
@ -303,24 +303,24 @@ struct timeval timeout;
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void cputnik_write_prefs(void) void cputnik_write_prefs(void)
{ {
if (dcl_prefs_openfile (dcl_getfilename_config (".clay", "cputnik.rc"), P_WRITE)) { if (dcl_prefs_openfile (dcl_getfilename_config (".clay", "cputnik.rc"), P_WRITE)) {
dcl_prefs_put_int ("update_period", update_period); dcl_prefs_put_int ("update_period", update_period);
dcl_prefs_put_int ("show_memory", show_memory); dcl_prefs_put_int ("show_memory", show_memory);
dcl_prefs_put_string ("command_lmb", command_lmb); dcl_prefs_put_string ("command_lmb", command_lmb);
dcl_prefs_put_string ("command_rmb", command_rmb); dcl_prefs_put_string ("command_rmb", command_rmb);
} }
dcl_prefs_closefile (); dcl_prefs_closefile ();
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void cputnik_read_prefs(void) void cputnik_read_prefs(void)
{ {
if (dcl_prefs_openfile (dcl_getfilename_config(".clay", "cputnik.rc"), P_READ)) { if (dcl_prefs_openfile (dcl_getfilename_config(".clay", "cputnik.rc"), P_READ)) {
@ -336,7 +336,7 @@ void cputnik_read_prefs(void)
if(strlen(command_rmb)) cmd_rmb = 1; if(strlen(command_rmb)) cmd_rmb = 1;
dcl_prefs_closefile (); dcl_prefs_closefile ();
} else { } else {
update_period = 2; update_period = 2;
@ -353,7 +353,7 @@ void cputnik_read_prefs(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
cputnik_read_prefs(); cputnik_read_prefs();
cputnik_routine(argc, argv); cputnik_routine(argc, argv);
return 0; return 0;

View file

@ -47,7 +47,7 @@ char *fonts_xpm[], *leds_xpm[];
* *
******************************************************************************/ ******************************************************************************/
void dcl_get_xpm (XpmIcon *wmgen, char *pixmap_bytes[]) void dcl_get_xpm (XpmIcon *wmgen, char *pixmap_bytes[])
{ {
XWindowAttributes attributes; XWindowAttributes attributes;
int err; int err;
@ -59,7 +59,7 @@ int err;
err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap), err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
&(wmgen->mask), &(wmgen->attributes)); &(wmgen->mask), &(wmgen->attributes));
if (err != XpmSuccess) { if (err != XpmSuccess) {
fprintf(stderr, "ERROR: Not enough free colorcells.\n"); fprintf(stderr, "ERROR: Not enough free colorcells.\n");
exit(1); exit(1);
@ -73,7 +73,7 @@ int err;
* *
******************************************************************************/ ******************************************************************************/
Pixel dcl_get_color (char *name) Pixel dcl_get_color (char *name)
{ {
XColor color; XColor color;
XWindowAttributes attributes; XWindowAttributes attributes;
@ -96,7 +96,7 @@ XWindowAttributes attributes;
* *
******************************************************************************/ ******************************************************************************/
int dcl_flush_expose (Window w) int dcl_flush_expose (Window w)
{ {
XEvent dummy; XEvent dummy;
int i=0; int i=0;
@ -113,11 +113,11 @@ int i=0;
* *
******************************************************************************/ ******************************************************************************/
void dcl_redraw_window (void) void dcl_redraw_window (void)
{ {
dcl_flush_expose(iconwin); dcl_flush_expose(iconwin);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0); 0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
dcl_flush_expose(win); dcl_flush_expose(win);
XCopyArea(display, wmgen.pixmap, win, NormalGC, XCopyArea(display, wmgen.pixmap, win, NormalGC,
@ -130,11 +130,11 @@ void dcl_redraw_window (void)
* *
******************************************************************************/ ******************************************************************************/
void dcl_redraw_window_xy (int x, int y) void dcl_redraw_window_xy (int x, int y)
{ {
dcl_flush_expose(iconwin); dcl_flush_expose(iconwin);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0); x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
dcl_flush_expose(win); dcl_flush_expose(win);
XCopyArea(display, wmgen.pixmap, win, NormalGC, XCopyArea(display, wmgen.pixmap, win, NormalGC,
@ -147,7 +147,7 @@ void dcl_redraw_window_xy (int x, int y)
* *
******************************************************************************/ ******************************************************************************/
void dcl_add_mouse_region (int index, int left, int top, int right, int bottom) void dcl_add_mouse_region (int index, int left, int top, int right, int bottom)
{ {
if (index < MAX_MOUSE_REGION) { if (index < MAX_MOUSE_REGION) {
mouse_region[index].enable = 1; mouse_region[index].enable = 1;
@ -164,7 +164,7 @@ void dcl_add_mouse_region (int index, int left, int top, int right, int bottom)
* *
******************************************************************************/ ******************************************************************************/
int dcl_check_mouse_region (int x, int y) int dcl_check_mouse_region (int x, int y)
{ {
int i, found; int i, found;
@ -265,7 +265,7 @@ unsigned long gcm;
int dummy=0, i, flags; int dummy=0, i, flags;
for (i=1; argv[i]; i++) { for (i=1; argv[i]; i++) {
if (!strcmp(argv[i], "-display")) if (!strcmp(argv[i], "-display"))
display_name = argv[i+1]; display_name = argv[i+1];
} }
@ -297,10 +297,10 @@ int dummy=0, i, flags;
mysizehints.width = 64; mysizehints.width = 64;
mysizehints.height = 64; mysizehints.height = 64;
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y, win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y, iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
@ -323,7 +323,7 @@ int dummy=0, i, flags;
XSetWMName(display, win, &name); XSetWMName(display, win, &name);
/* Create GC for drawing */ /* Create GC for drawing */
gcm = GCForeground | GCBackground | GCGraphicsExposures; gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = fore_pix; gcv.foreground = fore_pix;
gcv.background = back_pix; gcv.background = back_pix;
@ -408,7 +408,7 @@ void* dcl_prefs_openfile (char *filename, int openmode)
prefs_filehandle = fopen (filename, "rb"); prefs_filehandle = fopen (filename, "rb");
else if (openmode == P_WRITE) else if (openmode == P_WRITE)
prefs_filehandle = fopen (filename, "wb"); prefs_filehandle = fopen (filename, "wb");
return prefs_filehandle; return prefs_filehandle;
} }
@ -501,20 +501,20 @@ static char prfline[MAX_LINE_LEN];
int i; int i;
char c; char c;
fseek (prefs_filehandle, 0, SEEK_SET); fseek (prefs_filehandle, 0, SEEK_SET);
while (!feof (prefs_filehandle)) { while (!feof (prefs_filehandle)) {
i = 0; i = 0;
while (((c = fgetc (prefs_filehandle)) != '\n') && c!= EOF && i < MAX_LINE_LEN) while (((c = fgetc (prefs_filehandle)) != '\n') && c!= EOF && i < MAX_LINE_LEN)
prfline[i++] = c; prfline[i++] = c;
prfline[i] = '\0'; prfline[i] = '\0';
if (prfline[0] != '#') if (prfline[0] != '#')
if (!strncmp (tagname, prfline, strlen (tagname))) break; if (!strncmp (tagname, prfline, strlen (tagname))) break;
} }
return prfline; return prfline;
} }
@ -536,7 +536,7 @@ int i;
if ((valpos = strchr (dcl_prefs_get_line_with_tag (tagname), '='))) { if ((valpos = strchr (dcl_prefs_get_line_with_tag (tagname), '='))) {
while((c = valpos[i+1]) != '\0' && i < MAX_VALUE_LEN) valuestr[i++] = c; while((c = valpos[i+1]) != '\0' && i < MAX_VALUE_LEN) valuestr[i++] = c;
} }
valuestr[i] = '\0'; valuestr[i] = '\0';
return valuestr; return valuestr;
} }
@ -605,7 +605,7 @@ int len;
(int)(len-maxlength), src); (int)(len-maxlength), src);
len = maxlength; len = maxlength;
} }
memcpy(dest, src, len); memcpy(dest, src, len);
dest[len] = 0; dest[len] = 0;
return dest; return dest;
@ -639,7 +639,7 @@ int src_len, dest_len;
(int)(src_len + dest_len - maxlength), src); (int)(src_len + dest_len - maxlength), src);
src_len = maxlength - dest_len; src_len = maxlength - dest_len;
} }
memcpy(&dest[dest_len], src, src_len); memcpy(&dest[dest_len], src, src_len);
dest[dest_len + src_len] = 0; dest[dest_len + src_len] = 0;
return dest; return dest;
@ -687,7 +687,7 @@ int k, font_line, font_width, font_height;
if(toupper(z)==ctable[k]) { if(toupper(z)==ctable[k]) {
dcl_copy_font_xpm_area(k*font_width, font_line, font_width, font_height, x, y); dcl_copy_font_xpm_area(k*font_width, font_line, font_width, font_height, x, y);
break; break;
} }
@ -707,7 +707,7 @@ char a;
if(length == -1) if(length == -1)
len = strlen(string); len = strlen(string);
else else
len = length; len = length;
if(len <= 0 || len > MAX_STRING_LEN) { if(len <= 0 || len > MAX_STRING_LEN) {
@ -745,7 +745,7 @@ char a;
return true; return true;
} }
/****************************************************************************** /******************************************************************************
* *

View file

@ -89,7 +89,7 @@ enum { /* don't change the order! */
RED, RED,
MAGENTA, MAGENTA,
BROWN, BROWN,
WHITE WHITE
} led_colors; } led_colors;
enum { enum {

View file

@ -4,10 +4,10 @@ Please send bug reports to mghenderson@lanl.gov or jedgar@fxp.org and
describe the problem as detailed as you can. describe the problem as detailed as you can.
Note: all apm statistics are taken directly from Note: all apm statistics are taken directly from
/proc/apm (in Linux) or /dev/apm (in FreeBSD). If /proc/apm (in Linux) or /dev/apm (in FreeBSD). If
you see odd behavior with WMAPM (such as you see odd behavior with WMAPM (such as
displaying battery time remaining without a displaying battery time remaining without a
corresponding percentage), please first check the corresponding percentage), please first check the
statistics in /proc/apm (or using your system's statistics in /proc/apm (or using your system's
'apm' program to see if the computer/kernel are 'apm' program to see if the computer/kernel are
properly reporting the applicable statistics. properly reporting the applicable statistics.

View file

@ -2,7 +2,7 @@ WMAPM changes.
Version Description Version Description
--------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------
3.1 -Released: Jan 11, 2000. 3.1 -Released: Jan 11, 2000.
+ Added support for time left on FreeBSD 3.x/4.x + Added support for time left on FreeBSD 3.x/4.x
(Chris D. Faulhaber <jedgar@fxp.org>) (Chris D. Faulhaber <jedgar@fxp.org>)
@ -12,87 +12,87 @@ WMAPM changes.
3.0 -Released: December 15, 1998. 3.0 -Released: December 15, 1998.
A Major overhaul performed. Changes include; A Major overhaul performed. Changes include;
+ Added buttons to place laptop into "Suspend" (button labeled `Z') + Added buttons to place laptop into "Suspend" (button labeled `Z')
or "Standby" (button labeled `S') mode. Buttons are separated or "Standby" (button labeled `S') mode. Buttons are separated
by status LEDs to minimize accidentally clicking on the wrong by status LEDs to minimize accidentally clicking on the wrong
one. I used `Z' for suspend because its like the laptop is one. I used `Z' for suspend because its like the laptop is
catching some Zs (i.e. going to sleep). catching some Zs (i.e. going to sleep).
+ Replaced the 3 rectangular red/yellow/green status indicators + Replaced the 3 rectangular red/yellow/green status indicators
with 3 small round LEDs and moved them to a viewport at the with 3 small round LEDs and moved them to a viewport at the
bottom between the two buttons. This array of LEDs could in future bottom between the two buttons. This array of LEDs could in future
be moved to a single LED in the main viewport to make room for be moved to a single LED in the main viewport to make room for
other things at this location (perhaps more buttons if apm supports other things at this location (perhaps more buttons if apm supports
more things like truning off LCD, etc). more things like truning off LCD, etc).
+ Created user-definable LowLevel and CriticalLevel thresholds. Yellow LED + Created user-definable LowLevel and CriticalLevel thresholds. Yellow LED
comes on when Battery Percentage hits the LowLevel threshold. Red comes on comes on when Battery Percentage hits the LowLevel threshold. Red comes on
when you reach CriticalLevel threshold. when you reach CriticalLevel threshold.
+ Made red status LED blink for extra noticability. User can define blink rate. + Made red status LED blink for extra noticability. User can define blink rate.
A BlinkRate of 0 turns off blinking. A BlinkRate of 0 turns off blinking.
+ Moved all of the other indicators into a single viewport above the + Moved all of the other indicators into a single viewport above the
buttons and status LEDs. buttons and status LEDs.
+ Changed the red-dark-green colorbar to a banded blue LED bar that is tipped + Changed the red-dark-green colorbar to a banded blue LED bar that is tipped
with a color indicating capacity level. The tip color goes through with a color indicating capacity level. The tip color goes through
green-yellow-orange-red. A series of single-pixel dots is always present green-yellow-orange-red. A series of single-pixel dots is always present
below the bar to indicate its range. This is needed now, because below the bar to indicate its range. This is needed now, because
the bar is free-floating in the viewport. The single-pixel dots can be the bar is free-floating in the viewport. The single-pixel dots can be
seen easily on an LCD - the type of monitor wmapm is likely to be used. seen easily on an LCD - the type of monitor wmapm is likely to be used.
+ Changed the `CHARGING' indicator with a single red `C' indicator at the + Changed the `CHARGING' indicator with a single red `C' indicator at the
upper left of the APP. upper left of the APP.
+ Changed percentage indicator so that it can display 100%. (Used to only go + Changed percentage indicator so that it can display 100%. (Used to only go
up to 99% max). up to 99% max).
+ Changed time indicator to have a +/- sign depending on whether you are + Changed time indicator to have a +/- sign depending on whether you are
charging up or draining down. (+ means you have that much battery life charging up or draining down. (+ means you have that much battery life
left before its discharged. - means you have that much time to wait until left before its discharged. - means you have that much time to wait until
the battery is fully charged.) the battery is fully charged.)
+ Fixed a problem with very large "TimeLeft" values. If the time is greater + Fixed a problem with very large "TimeLeft" values. If the time is greater
than the maximum time displayable 99 hours and 59 minutes, a ---:-- is than the maximum time displayable 99 hours and 59 minutes, a ---:-- is
listed instead. Since the time is based on measured charge/discharge rates, listed instead. Since the time is based on measured charge/discharge rates,
when the battery is doing neither, the time is essentially infinite. On my when the battery is doing neither, the time is essentially infinite. On my
(M Henderson's) laptop, the time left indicated 32766 when this happened. (M Henderson's) laptop, the time left indicated 32766 when this happened.
FreeBSD systems should also show a ---:-- indicator. Dont have FreeBSD though FreeBSD systems should also show a ---:-- indicator. Dont have FreeBSD though
so I couldnt test it.... so I couldnt test it....
+ Changed Makefile to suid the apm program. This is needed to allow users to + Changed Makefile to suid the apm program. This is needed to allow users to
invoke the standby and suspend capabilities in apm. invoke the standby and suspend capabilities in apm.
+ Sped up the loop to catch button press and expose events. But the querying of + Sped up the loop to catch button press and expose events. But the querying of
/proc/apm is still done about once a second... /proc/apm is still done about once a second...
+ Added alert feature. User can use command line option -A <T1 T2> to turn on alerts + Added alert feature. User can use command line option -A <T1 T2> to turn on alerts
via wall. T1 and T2 are the time in seconds between updates for Low and Critical via wall. T1 and T2 are the time in seconds between updates for Low and Critical
status. By default the alerts are turned off. status. By default the alerts are turned off.
+ Various sundry code cleanups. + Various sundry code cleanups.
2.0 - Added FreeBSD support. 2.0 - Added FreeBSD support.
1.3 - Fixed an annoying little problem with the the meter 1.3 - Fixed an annoying little problem with the the meter
not properly lowering as the battery is depleted. not properly lowering as the battery is depleted.
Also did some code cleanup, enhanced the Makefile which Also did some code cleanup, enhanced the Makefile which
now includes 'make install'. now includes 'make install'.
Released 980826 Released 980826
1.2 - Fixed bug that showed 100% battery capacity 1.2 - Fixed bug that showed 100% battery capacity
as 90% (I never noticed since my battery seems as 90% (I never noticed since my battery seems
to max out at 98%). to max out at 98%).
Thanx to Brice Ruth <bruth@ltic.com> for pointing out/helping fix the Thanx to Brice Ruth <bruth@ltic.com> for pointing out/helping fix the
100% bug (err...feature). 100% bug (err...feature).
Released 980731 Released 980731
1.1 - Removed libapm dependency; tweaked some code. 1.1 - Removed libapm dependency; tweaked some code.
Released 980729 Released 980729
1.0 - Initial release version. 1.0 - Initial release version.
Released 980725 Released 980725

View file

@ -4,7 +4,7 @@ Generic
-------------------------------------------------------------- --------------------------------------------------------------
WMAPM supports 7 commandline options: WMAPM supports 7 commandline options:
-h (help); -h (help);
-C (Critical Percent Threshold); -C (Critical Percent Threshold);
-L (Low Percent Threshold); -L (Low Percent Threshold);
-b (BlinkRate for red LED); -b (BlinkRate for red LED);
@ -28,7 +28,7 @@ Afterstep users put the following in their .steprc
Note: AfterStep's Wharf has a problem with pixmaps that are Note: AfterStep's Wharf has a problem with pixmaps that are
larger than 60x60 pixels. Please tell the AfterStep authors larger than 60x60 pixels. Please tell the AfterStep authors
to fix this, this is not our fault, but a Wharf problem! to fix this, this is not our fault, but a Wharf problem!
Other WindowManagers Other WindowManagers
-------------------------------------------------------------- --------------------------------------------------------------

View file

@ -1,9 +1,9 @@
WMAPM-3.1 release WMAPM-3.1 release
-------------------------------------------------------------- --------------------------------------------------------------
Authors....: wmapm was originally written by Chris D. Faulhaber Authors....: wmapm was originally written by Chris D. Faulhaber
<jedgar@fxp.org>. Version 3.0 modifications due to <jedgar@fxp.org>. Version 3.0 modifications due to
Michael G. Henderson <mghenderson@lanl.gov> Michael G. Henderson <mghenderson@lanl.gov>
Credits...: Rik Faith <faith@cs.unc.edu> for his implementation Credits...: Rik Faith <faith@cs.unc.edu> for his implementation
of libapm with respect to Linux APM support. of libapm with respect to Linux APM support.
Martijm Pieterse <pieterse@xs4all.nl> and Martijm Pieterse <pieterse@xs4all.nl> and
@ -16,17 +16,17 @@ Thanx to..: Brice Ruth <bruth@ltic.com> for the corrections
Timecop <timecop@linuxwarez.com> for corrections to Timecop <timecop@linuxwarez.com> for corrections to
fix the meter mismatch. fix the meter mismatch.
William M. Perry - Added Solaris support. William M. Perry - Added Solaris support.
Also, thanks to the following for various Also, thanks to the following for various
bug fixes, patches and/or suggestions; bug fixes, patches and/or suggestions;
ObiTuarY ObiTuarY
MATSUBAYASHI 'Shaolin' Kohji" MATSUBAYASHI 'Shaolin' Kohji"
Fumihiko Nishio Fumihiko Nishio
Description Description
-------------------------------------------------------------- --------------------------------------------------------------
WMAPM monitors the APM statistics through the APM support in WMAPM monitors the APM statistics through the APM support in
@ -56,11 +56,11 @@ BUGS Things you don't want to know ;-)
CHANGES Description of changes. CHANGES Description of changes.
COPYING GNU General Public License Version 2. COPYING GNU General Public License Version 2.
TODO Stuff I've planned for future WMAPM releases. TODO Stuff I've planned for future WMAPM releases.
Bugs Bugs
-------------------------------------------------------------- --------------------------------------------------------------
If you discover any bugs in this software, please send a If you discover any bugs in this software, please send a
bugreport to jedgar@fxp.org and describe the problem as bugreport to jedgar@fxp.org and describe the problem as
as detailed as you can. as detailed as you can.
@ -68,7 +68,7 @@ as detailed as you can.
Copyright Copyright
-------------------------------------------------------------- --------------------------------------------------------------
WMAPM.app is copyright (c)1998,1999 by Chris D. Faulhaber and WMAPM.app is copyright (c)1998,1999 by Chris D. Faulhaber and
licensed through the GNU General Public License. Read the licensed through the GNU General Public License. Read the
COPYING file for the complete GNU license. COPYING file for the complete GNU license.

View file

@ -4,9 +4,9 @@ TODO list for WMAPM
* Work on NetBSD support. * Work on NetBSD support.
* Add GUI to allow user to set things. * Add GUI to allow user to set things.
* Add ~/.wmapmrc file to store saved settings. * Add ~/.wmapmrc file to store saved settings.
Your feedback is greatly appreciated! If you have nice Your feedback is greatly appreciated! If you have nice
suggestions, ideas, whatever, that aren't on this list, feel suggestions, ideas, whatever, that aren't on this list, feel
free to mail them to: free to mail them to:
jedgar@fxp.org jedgar@fxp.org

View file

@ -23,6 +23,6 @@ clean:
install:: wmapm install:: wmapm
install -s -m 0755 wmapm $(DESTDIR)/bin install -s -m 0755 wmapm $(DESTDIR)/bin
install -m 0644 wmapm.1 $(DESTDIR)/man/man1 install -m 0644 wmapm.1 $(DESTDIR)/man/man1
chmod +s $(DESTDIR)/bin/wmapm chmod +s $(DESTDIR)/bin/wmapm

View file

@ -1,4 +1,4 @@
.TH WMAPM 1 "15 December 1998" .TH WMAPM 1 "15 December 1998"
.SH NAME .SH NAME
WMAPM \- Dockable APM/Battery Monitor WMAPM \- Dockable APM/Battery Monitor
.SH SYNOPSIS .SH SYNOPSIS
@ -16,7 +16,7 @@ application.
.PP .PP
WMAPM provides the following information: battery or AC operation, battery WMAPM provides the following information: battery or AC operation, battery
life remaining (both in percentage and bar), time left until life remaining (both in percentage and bar), time left until
battery-depletion (Linux only), charging status, and battery status battery-depletion (Linux only), charging status, and battery status
(high - green, low - yellow, or critical - red) as reported by the (high - green, low - yellow, or critical - red) as reported by the
the APM BIOS. the APM BIOS.
.SH OPTIONS .SH OPTIONS

View file

@ -2,13 +2,13 @@
* wmapm-3.1 * wmapm-3.1
* *
* A WindowMaker dockable application that allows laptop users * A WindowMaker dockable application that allows laptop users
* to graphically monitor the status of their power source. * to graphically monitor the status of their power source.
* (I.e. whether or not AC or battery is in use as well as * (I.e. whether or not AC or battery is in use as well as
* how long it will take to drain or charge the battery.) * how long it will take to drain or charge the battery.)
* *
* Originally written (and copyrighted under GPL) by * Originally written (and copyrighted under GPL) by
* Chris D. Faulhaber <jedgar@fxp.org>. Version 3.0 * Chris D. Faulhaber <jedgar@fxp.org>. Version 3.0
* is an extensively modified version of version 2.0 * is an extensively modified version of version 2.0
* by Michael G. Henderson <mghenderson@lanl.gov>. * by Michael G. Henderson <mghenderson@lanl.gov>.
* *
* *
@ -30,7 +30,7 @@
* Portions of code derived from: * Portions of code derived from:
* apm/apmd/libapm : (c) 1996 Rickard E. Faith (r.faith@ieee.org) * apm/apmd/libapm : (c) 1996 Rickard E. Faith (r.faith@ieee.org)
* wmmon : (c) 1998 Martijn Pieterse (pieterse@xs4all.nl) and * wmmon : (c) 1998 Martijn Pieterse (pieterse@xs4all.nl) and
* Antoine Nulle (warp@xs4all.nl) * Antoine Nulle (warp@xs4all.nl)
* *
* Thanx to Timecop <timecop@linuxwarez.com> for pointing out/helping to * Thanx to Timecop <timecop@linuxwarez.com> for pointing out/helping to
* Toggle fix the meter mismatch. * Toggle fix the meter mismatch.
@ -53,18 +53,18 @@
* on laptops. There are a *lot* of laptops out there that are only * on laptops. There are a *lot* of laptops out there that are only
* 8-bit. Use the "-l" command-line option to invoke. * 8-bit. Use the "-l" command-line option to invoke.
* *
* *
* 3.0 -Released: December 15, 1998. * 3.0 -Released: December 15, 1998.
* A Major overhaul performed. Changes include; * A Major overhaul performed. Changes include;
* *
* + Added buttons to place laptop into "Suspend" (button labeled `Z') * + Added buttons to place laptop into "Suspend" (button labeled `Z')
* or "Standby" (button labeled `S') mode. Buttons are separated * or "Standby" (button labeled `S') mode. Buttons are separated
* by status LEDs to minimize accidentally clicking on the wrong * by status LEDs to minimize accidentally clicking on the wrong
* one. I used `Z' for suspend because its like the laptop is * one. I used `Z' for suspend because its like the laptop is
* catching some Zs (i.e. going to sleep). * catching some Zs (i.e. going to sleep).
* *
* + Replaced the 3 rectangular red/yellow/green status indicators * + Replaced the 3 rectangular red/yellow/green status indicators
* with 3 small round LEDs and moved them to a viewport at the * with 3 small round LEDs and moved them to a viewport at the
* bottom between the two buttons. This array of LEDs could in future * bottom between the two buttons. This array of LEDs could in future
* be moved to a single LED in the main viewport to make room for * be moved to a single LED in the main viewport to make room for
* other things at this location (perhaps more buttons if apm supports * other things at this location (perhaps more buttons if apm supports
@ -97,11 +97,11 @@
* charging up or draining down. (+ means you have that much battery life * charging up or draining down. (+ means you have that much battery life
* left before its discharged. - means you have that much time to wait until * left before its discharged. - means you have that much time to wait until
* the battery is fully charged.) * the battery is fully charged.)
* *
* + Fixed a problem with very large "TimeLeft" values. If the time is greater * + Fixed a problem with very large "TimeLeft" values. If the time is greater
* than the maximum time displayable 99 hours and 59 minutes, a ---:-- is * than the maximum time displayable 99 hours and 59 minutes, a ---:-- is
* listed instead. Since the time is based on measured charge/discharge rates, * listed instead. Since the time is based on measured charge/discharge rates,
* when the battery is doing neither, the time is essentially infinite. On my * when the battery is doing neither, the time is essentially infinite. On my
* (M Henderson's) laptop, the time left indicated 32766 when this happened. * (M Henderson's) laptop, the time left indicated 32766 when this happened.
* FreeBSD systems should also show a ---:-- indicator. Dont have FreeBSD though * FreeBSD systems should also show a ---:-- indicator. Dont have FreeBSD though
* so I couldnt test it.... * so I couldnt test it....
@ -118,9 +118,9 @@
* *
* + Various sundry code cleanups. * + Various sundry code cleanups.
* *
* *
* 2.0 - Added FreeBSD support. * 2.0 - Added FreeBSD support.
* *
* 1.3 - Fixed an annoying little problem with the the meter * 1.3 - Fixed an annoying little problem with the the meter
* not properly lowering as the battery is depleted. * not properly lowering as the battery is depleted.
* Also did some code cleanup, enhanced the Makefile which * Also did some code cleanup, enhanced the Makefile which
@ -133,7 +133,7 @@
* Thanx to Brice Ruth <bruth@ltic.com> for pointing out/helping fix the * Thanx to Brice Ruth <bruth@ltic.com> for pointing out/helping fix the
* 100% bug (err...feature). * 100% bug (err...feature).
* Released 980731 * Released 980731
* *
* 1.1 - Removed libapm dependency; tweaked some code. * 1.1 - Removed libapm dependency; tweaked some code.
* Released 980729 * Released 980729
* *
@ -156,7 +156,7 @@
#include <sys/file.h> #include <sys/file.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <machine/apm_bios.h> #include <machine/apm_bios.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -204,16 +204,16 @@ float CAlertRate = 120.0; /* send alert every 2 minutes when Critical */
/* /*
* main * main
*/ */
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
struct my_apm_info my_cur_info; struct my_apm_info my_cur_info;
int time_left, int time_left,
hour_left, hour_left,
min_left, min_left,
digit; digit;
#ifdef FreeBSD #ifdef FreeBSD
struct apm_info temp_info; struct apm_info temp_info;
@ -234,7 +234,7 @@ int main(int argc, char *argv[]) {
/* /*
* Parse any command line arguments. * Parse any command line arguments.
*/ */
@ -242,7 +242,7 @@ int main(int argc, char *argv[]) {
BlinkRate = (BlinkRate >= 0.0) ? BlinkRate : -1.0*BlinkRate; BlinkRate = (BlinkRate >= 0.0) ? BlinkRate : -1.0*BlinkRate;
UpdateRate = (UpdateRate >= 0.0) ? UpdateRate : -1.0*UpdateRate; UpdateRate = (UpdateRate >= 0.0) ? UpdateRate : -1.0*UpdateRate;
nMax = (int)( 1.0e6/(2.0*UpdateRate*DELAY) ); nMax = (int)( 1.0e6/(2.0*UpdateRate*DELAY) );
mMax = (BlinkRate > 0.0) ? (int)( 1.0e6/(2.0*BlinkRate*DELAY) ) : nMax; mMax = (BlinkRate > 0.0) ? (int)( 1.0e6/(2.0*BlinkRate*DELAY) ) : nMax;
@ -257,9 +257,9 @@ int main(int argc, char *argv[]) {
/* /*
* Check for APM support * Check for APM support
*/ */
if (!apm_exists()) { if (!apm_exists()) {
#ifdef Linux #ifdef Linux
fprintf(stderr, "No APM support in kernel\n"); fprintf(stderr, "No APM support in kernel\n");
@ -271,7 +271,7 @@ int main(int argc, char *argv[]) {
if (UseLowColorPixmap) if (UseLowColorPixmap)
openXwindow(argc, argv, wmapm_master_LowColor, wmapm_mask_bits, wmapm_mask_width, wmapm_mask_height); openXwindow(argc, argv, wmapm_master_LowColor, wmapm_mask_bits, wmapm_mask_width, wmapm_mask_height);
else else
@ -279,7 +279,7 @@ int main(int argc, char *argv[]) {
/* /*
* Loop until we die... * Loop until we die...
*/ */
@ -292,9 +292,9 @@ int main(int argc, char *argv[]) {
/* /*
* Only process apm info only every nMax cycles of this * Only process apm info only every nMax cycles of this
* loop. We run it faster to catch the xevents like button * loop. We run it faster to catch the xevents like button
* presses and expose events, etc... * presses and expose events, etc...
* *
* DELAY is set at 0.00625 seconds, so process apm info * DELAY is set at 0.00625 seconds, so process apm info
* every 1.25 seconds... * every 1.25 seconds...
* *
@ -321,35 +321,35 @@ int main(int argc, char *argv[]) {
my_cur_info.battery_percentage = (int)temp_info.ai_batt_life; my_cur_info.battery_percentage = (int)temp_info.ai_batt_life;
my_cur_info.battery_time = (int)temp_info.ai_batt_time; my_cur_info.battery_time = (int)temp_info.ai_batt_time;
#endif #endif
/*
/*
* Check AC status. * Check AC status.
*/ */
switch (my_cur_info.ac_line_status) { switch (my_cur_info.ac_line_status) {
case 1: case 1:
/* /*
* AC on-line. I.e. we are "plugged-in". * AC on-line. I.e. we are "plugged-in".
*/ */
copyXPMArea(68, 6, 26, 7, 31, 35); copyXPMArea(68, 6, 26, 7, 31, 35);
break; break;
default: default:
/* /*
* AC off-line. I.e. we are using battery. * AC off-line. I.e. we are using battery.
*/ */
copyXPMArea(68, 20, 26, 7, 31, 35); copyXPMArea(68, 20, 26, 7, 31, 35);
} }
/*
/*
* Paste up the default charge status and time * Paste up the default charge status and time
*/ */
copyXPMArea(104, 6, 5, 7, 6, 7); copyXPMArea(104, 6, 5, 7, 6, 7);
@ -371,9 +371,9 @@ int main(int argc, char *argv[]) {
copyXPMArea(75, 81, 1, 2, 17, 9); copyXPMArea(75, 81, 1, 2, 17, 9);
copyXPMArea(75, 81, 1, 2, 17, 12); copyXPMArea(75, 81, 1, 2, 17, 12);
} }
@ -389,11 +389,11 @@ int main(int argc, char *argv[]) {
/* /*
* Paste up the "Time Left". This time means: * Paste up the "Time Left". This time means:
* *
* If not charging: Time left before battery drains to 0% * If not charging: Time left before battery drains to 0%
* If charging: Time left before battery gets to maximum * If charging: Time left before battery gets to maximum
* *
*/ */
@ -408,7 +408,7 @@ int main(int argc, char *argv[]) {
/* /*
* If battery_time is too large, it likely means that there is * If battery_time is too large, it likely means that there is
* no charging or discharging going on. So just display a "null" * no charging or discharging going on. So just display a "null"
* indicator (--:--). * indicator (--:--).
* *
*/ */
copyXPMArea(83, 106, 41, 9, 15, 7); copyXPMArea(83, 106, 41, 9, 15, 7);
@ -432,12 +432,12 @@ int main(int argc, char *argv[]) {
copyXPMArea((min_left % 10) * 7 + 5, 93, 7, 9, 50, 7); /* Show 1's (min) */ copyXPMArea((min_left % 10) * 7 + 5, 93, 7, 9, 50, 7); /* Show 1's (min) */
} }
/*
/*
* Do Battery Percentage. * Do Battery Percentage.
*/ */
copyXPMArea(76, 81, 19, 7, 7, 34); /* Show Default % */ copyXPMArea(76, 81, 19, 7, 7, 34); /* Show Default % */
@ -460,9 +460,9 @@ int main(int argc, char *argv[]) {
*/ */
k = my_cur_info.battery_percentage * 49 / 100; k = my_cur_info.battery_percentage * 49 / 100;
copyXPMArea(66, 42, k, 9, 7, 21); copyXPMArea(66, 42, k, 9, 7, 21);
if (k%2) if (k%2)
copyXPMArea(66+k-1, 52, 1, 9, 7+k-1, 21); copyXPMArea(66+k-1, 52, 1, 9, 7+k-1, 21);
else else
copyXPMArea(66+k, 52, 1, 9, 7+k, 21); copyXPMArea(66+k, 52, 1, 9, 7+k, 21);
} }
@ -471,7 +471,7 @@ int main(int argc, char *argv[]) {
} else { } else {
/* /*
* Update the counter. When it hits nMax, we will * Update the counter. When it hits nMax, we will
* process /proc/apm information again. * process /proc/apm information again.
*/ */
++n; ++n;
@ -533,7 +533,7 @@ int main(int argc, char *argv[]) {
} else { } else {
/* /*
* Update the counter. * Update the counter.
*/ */
++m; ++m;
@ -559,7 +559,7 @@ int main(int argc, char *argv[]) {
} else { } else {
/* /*
* Update the counter. * Update the counter.
*/ */
++s; ++s;
@ -578,7 +578,7 @@ int main(int argc, char *argv[]) {
} else { } else {
/* /*
* Update the counter. * Update the counter.
*/ */
++r; ++r;
@ -589,7 +589,7 @@ int main(int argc, char *argv[]) {
/* /*
* Process any pending X events. * Process any pending X events.
*/ */
while(XPending(display)){ while(XPending(display)){
@ -610,9 +610,9 @@ int main(int argc, char *argv[]) {
/* /*
* Redraw and wait for next update * Redraw and wait for next update
*/ */
RedrawWindow(); RedrawWindow();
usleep(DELAY); usleep(DELAY);
@ -644,12 +644,12 @@ int main(int argc, char *argv[]) {
/* /*
* This routine handles button presses. Pressing the 'S' button * This routine handles button presses. Pressing the 'S' button
* invokes 'apm -S' to place the machine into standby mode. And * invokes 'apm -S' to place the machine into standby mode. And
* pressing the 'Z' buton invokes 'apm -s' to place the machine * pressing the 'Z' buton invokes 'apm -s' to place the machine
* into suspend mode. * into suspend mode.
* *
* Note: in order for users other than root to be able to run * Note: in order for users other than root to be able to run
* 'apm -s' and 'apm -S', you need to make apm suid (i.e. * 'apm -s' and 'apm -S', you need to make apm suid (i.e.
* run 'chmod +s /usr/bin/apm' as root). This will allow * run 'chmod +s /usr/bin/apm' as root). This will allow
* 'normal' users to execute apm with root privilages. * 'normal' users to execute apm with root privilages.
* *
@ -704,10 +704,10 @@ void pressEvent(XButtonEvent *xev){
/* /*
* apm_exists() * apm_exists()
* - Check to see if /proc/apm exists... * - Check to see if /proc/apm exists...
* *
*/ */
int apm_exists() int apm_exists()
{ {
@ -728,8 +728,8 @@ int apm_exists()
/* /*
* apm_read() * apm_read()
* - Read in the information found in /proc/apm... * - Read in the information found in /proc/apm...
* *
*/ */
@ -740,7 +740,7 @@ int apm_read(struct my_apm_info *i){
char units[10]; char units[10];
char buffer[100]; char buffer[100];
int retcode = 0; int retcode = 0;
/* /*
* Open /proc/apm for reading * Open /proc/apm for reading
*/ */
@ -774,7 +774,7 @@ int apm_read(struct my_apm_info *i){
/* /*
* Old Style * Old Style
*/ */
if (i->driver_version[0] == 'B') { if (i->driver_version[0] == 'B') {
strcpy((char *)i->driver_version, "pre-0.7"); strcpy((char *)i->driver_version, "pre-0.7");
i->apm_version_major = 0; i->apm_version_major = 0;
i->apm_version_minor = 0; i->apm_version_minor = 0;
@ -788,7 +788,7 @@ int apm_read(struct my_apm_info *i){
sscanf(buffer, "BIOS version: %d.%d", &i->apm_version_major, &i->apm_version_minor); sscanf(buffer, "BIOS version: %d.%d", &i->apm_version_major, &i->apm_version_minor);
fgets(buffer, sizeof(buffer) - 1, str); fgets(buffer, sizeof(buffer) - 1, str);
@ -804,13 +804,13 @@ int apm_read(struct my_apm_info *i){
if (!strncmp(buffer+4, "off line", 8)) i->ac_line_status = 0; if (!strncmp(buffer+4, "off line", 8)) i->ac_line_status = 0;
else if (!strncmp(buffer+4, "on line", 7)) i->ac_line_status = 1; else if (!strncmp(buffer+4, "on line", 7)) i->ac_line_status = 1;
else if (!strncmp(buffer+4, "on back", 7)) i->ac_line_status = 2; else if (!strncmp(buffer+4, "on back", 7)) i->ac_line_status = 2;
fgets(buffer, sizeof(buffer) - 1, str); fgets(buffer, sizeof(buffer) - 1, str);
if (!strncmp(buffer+16, "high", 4)) i->battery_status = 0; if (!strncmp(buffer+16, "high", 4)) i->battery_status = 0;
else if (!strncmp(buffer+16, "low", 3)) i->battery_status = 1; else if (!strncmp(buffer+16, "low", 3)) i->battery_status = 1;
else if (!strncmp(buffer+16, "crit", 4)) i->battery_status = 2; else if (!strncmp(buffer+16, "crit", 4)) i->battery_status = 2;
else if (!strncmp(buffer+16, "charg", 5)) i->battery_status = 3; else if (!strncmp(buffer+16, "charg", 5)) i->battery_status = 3;
fgets(buffer, sizeof(buffer) - 1, str); fgets(buffer, sizeof(buffer) - 1, str);
if (strncmp(buffer+14, "unknown", 7)) i->battery_percentage = atoi(buffer + 14); if (strncmp(buffer+14, "unknown", 7)) i->battery_percentage = atoi(buffer + 14);
@ -825,14 +825,14 @@ int apm_read(struct my_apm_info *i){
} }
} }
} }
/*
/*
* Take care of battery percentages > 100% * Take care of battery percentages > 100%
*/ */
if (i->battery_percentage > 100) i->battery_percentage = -1; if (i->battery_percentage > 100) i->battery_percentage = -1;
fclose(str); fclose(str);
return retcode; return retcode;
@ -842,7 +842,7 @@ int apm_read(struct my_apm_info *i){
int apm_read(apm_info_t temp_info) { int apm_read(apm_info_t temp_info) {
int fd; int fd;
if ( (fd = open(APMDEV, O_RDWR)) < 0){ if ( (fd = open(APMDEV, O_RDWR)) < 0){
return(1); return(1);
@ -861,7 +861,7 @@ int apm_read(apm_info_t temp_info) {
} }
# endif # endif
#endif #endif
#ifdef SunOS #ifdef SunOS
int apm_read(struct my_apm_info *i) { int apm_read(struct my_apm_info *i) {
@ -874,15 +874,15 @@ int apm_read(struct my_apm_info *i) {
perror("open"); perror("open");
exit(1); exit(1);
} }
if (ioctl(fd,BATT_STATUS,&info) < 0) return(1); if (ioctl(fd,BATT_STATUS,&info) < 0) return(1);
close(fd); close(fd);
i->battery_percentage = info.capacity; i->battery_percentage = info.capacity;
i->battery_time = info.discharge_time; i->battery_time = info.discharge_time;
i->using_minutes = 0; i->using_minutes = 0;
/* convert to internal status: /* convert to internal status:
* *
* 0 = high * 0 = high
@ -908,7 +908,7 @@ int apm_read(struct my_apm_info *i) {
i->battery_status = 2; i->battery_status = 2;
break; break;
} }
switch(info.charge) { switch(info.charge) {
case DISCHARGE: /* Battery is discharging (i.e. in use) */ case DISCHARGE: /* Battery is discharging (i.e. in use) */
i->ac_line_status = 0; i->ac_line_status = 0;
@ -919,61 +919,61 @@ int apm_read(struct my_apm_info *i) {
i->ac_line_status = 1; i->ac_line_status = 1;
break; break;
} }
if (i->battery_percentage > 100) i->battery_percentage = 100; if (i->battery_percentage > 100) i->battery_percentage = 100;
/* Not sure what else we can fill in right now. /* Not sure what else we can fill in right now.
* Relevant information is: * Relevant information is:
* *
* info.id_string = type of battery (internal, external, etc) * info.id_string = type of battery (internal, external, etc)
* info.total = total capacity (mWhrs) * info.total = total capacity (mWhrs)
*/ */
return(0); return(0);
} }
#endif #endif
/* /*
* ParseCMDLine() * ParseCMDLine()
*/ */
void ParseCMDLine(int argc, char *argv[]) { void ParseCMDLine(int argc, char *argv[]) {
char *cmdline; char *cmdline;
int i,j; int i,j;
char puke[20]; char puke[20];
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
cmdline = argv[i]; cmdline = argv[i];
if (cmdline[0] == '-') { if (cmdline[0] == '-') {
switch(cmdline[1]) { switch(cmdline[1]) {
case 'd': case 'd':
++i; ++i;
break; break;
case 'A': case 'A':
Alert = 1; Alert = 1;
LAlertRate = atof(argv[++i]); LAlertRate = atof(argv[++i]);
CAlertRate = atof(argv[++i]); CAlertRate = atof(argv[++i]);
break; break;
case 'b': case 'b':
BlinkRate = atof(argv[++i]); BlinkRate = atof(argv[++i]);
break; break;
case 'C': case 'C':
CriticalLevel = atoi(argv[++i]); CriticalLevel = atoi(argv[++i]);
break; break;
case 'L': case 'L':
LowLevel = atoi(argv[++i]); LowLevel = atoi(argv[++i]);
break; break;
case 'l': case 'l':
UseLowColorPixmap = 1; UseLowColorPixmap = 1;
break; break;
case 'B': case 'B':
Beep = 1; Beep = 1;
Volume = atoi(argv[++i]); Volume = atoi(argv[++i]);
break; break;
default: default:
printf("\nwmapm version: %s\n", WMAPM_VERSION); printf("\nwmapm version: %s\n", WMAPM_VERSION);
printf("usage:\n"); printf("usage:\n");
printf("\t-display <display>\tUse alternate display.\n"); printf("\t-display <display>\tUse alternate display.\n");

View file

@ -10,18 +10,18 @@ VMGlobe
1.2 released 9/04/2000 1.2 released 9/04/2000
- WindowMaker 0.62 compliancy - WindowMaker 0.62 compliancy
1.1 not released 1.1 not released
- another floating point exception bug solved (Alpha) - another floating point exception bug solved (Alpha)
- little optimizations and rewriting in rend.c - little optimizations and rewriting in rend.c
- -sun option - -sun option
- -moon option - -moon option
- -mk marker option - -mk marker option
1.0 released 30/05/99 1.0 released 30/05/99
- option -stable : latitude never change of sign - option -stable : latitude never change of sign
- change email to jerome.dumonteil@linuxfr.org - change email to jerome.dumonteil@linuxfr.org
- modify a few typo in doc - modify a few typo in doc
0.5 released 6/02/99 0.5 released 6/02/99
- floating point exception bug solved - floating point exception bug solved
- many minor bugs solved (earth displaying, mouse, time management) - many minor bugs solved (earth displaying, mouse, time management)
@ -34,7 +34,7 @@ VMGlobe
- option selection through parameters screens (right button) - option selection through parameters screens (right button)
- approximation of date & time of view point - approximation of date & time of view point
- new default map (bigger, better) - new default map (bigger, better)
- display of time uses setlocale() - display of time uses setlocale()
- option -dawn value : enhance dawn borderline - option -dawn value : enhance dawn borderline
- option -time : change date displayed - option -time : change date displayed
- option -nonimap - option -nonimap
@ -43,7 +43,7 @@ VMGlobe
- modify comportment of -rand option when zooming - modify comportment of -rand option when zooming
- change left button comportment : only change longitude - change left button comportment : only change longitude
- shift+left button : change longitude & latitude - shift+left button : change longitude & latitude
- man page - man page
0.3.1 released 5/01/99 0.3.1 released 5/01/99
- option -austral - option -austral
@ -62,7 +62,7 @@ VMGlobe
left click = change longitude left click = change longitude
middle click = zoom in / zoom out middle click = zoom in / zoom out
right click = change latitude right click = change latitude
- a few hints for compile on *BSD - a few hints for compile on *BSD
0.1 released 31/12/98 0.1 released 31/12/98

View file

@ -2,7 +2,7 @@ INC = -I/usr/X11R6/include
LIBS = -lXext -lX11 -lm -L/usr/X11R6/lib \ LIBS = -lXext -lX11 -lm -L/usr/X11R6/lib \
-ltiff -lXpm -lpng -lz -ljpeg -lungif -lwraster -ltiff -lXpm -lpng -lz -ljpeg -lungif -lwraster
OBJS = src/wmglobe.o src/rend.o src/wmgutil.o \ OBJS = src/wmglobe.o src/rend.o src/wmgutil.o \
src/sunpos.o src/myconvert.o src/mycontext.o src/sunpos.o src/myconvert.o src/mycontext.o
.c.o : .c.o :
@ -12,11 +12,11 @@ all: wmglobe
clean: clean:
rm -f src/*.o wmglobe rm -f src/*.o wmglobe
wmglobe : $(OBJS) wmglobe : $(OBJS)
gcc -O2 -Wall $(OBJS) -o wmglobe $(LIBS) gcc -O2 -Wall $(OBJS) -o wmglobe $(LIBS)
strip wmglobe strip wmglobe
install : install :
install wmglobe /usr/local/bin install wmglobe /usr/local/bin
install wmglobe.1 /usr/local/man/man1 install wmglobe.1 /usr/local/man/man1

View file

@ -16,20 +16,20 @@ rendered on a sphere by raytracing. Yes, for a 64x64 pixel result :-)
Installation Installation
---------------------------------------- ----------------------------------------
You need WindowMaker to build WMGlobe. WMGlobe needs libwraster to compile, You need WindowMaker to build WMGlobe. WMGlobe needs libwraster to compile,
this lib is built by WindowMaker. No more need at run time if statically this lib is built by WindowMaker. No more need at run time if statically
linked, but then, you need WindowMaker to get the full magic :-) linked, but then, you need WindowMaker to get the full magic :-)
Warning : this version won't work with WindowMaker < 0.62 Warning : this version won't work with WindowMaker < 0.62
tar -xvzf wmglobe-1.3.tar.gz tar -xvzf wmglobe-1.3.tar.gz
cd wmglobe-1.3 cd wmglobe-1.3
make make
then move wmglobe in /usr/local/bin and man page somewhere or do then move wmglobe in /usr/local/bin and man page somewhere or do
(as root) : (as root) :
make install make install
If it doesn't work, look for the graphic libraries. If it doesn't work, look for the graphic libraries.
The Makefile is quite crude... The Makefile is quite crude...
@ -37,14 +37,14 @@ WMGlobe is developped on Linux (WMaker 0.65.1 and linux 2.4.x/ix86).
If you are successful on other platforms, please tell me so. If you are successful on other platforms, please tell me so.
platforms with successfull built reported (wmglobe 1.0 for older WMaker): platforms with successfull built reported (wmglobe 1.0 for older WMaker):
NetBSD 1.3.2 / SPARC (wmaker 0.20.3) , with Makefile adaptations for libs NetBSD 1.3.2 / SPARC (wmaker 0.20.3) , with Makefile adaptations for libs
Linux 2.0.36 / RedHat 5.1 Linux 2.0.36 / RedHat 5.1
Linux 2.0.36 / SuSE 5.3 (wmaker 0.20.3) , -lungif -> -lgif Linux 2.0.36 / SuSE 5.3 (wmaker 0.20.3) , -lungif -> -lgif
Linux 2.0.36 / RedHat 5.2 (wmaker 0.53) Linux 2.0.36 / RedHat 5.2 (wmaker 0.53)
Linux 2.2.0-pre4 / Debian :-) Linux 2.2.0-pre4 / Debian :-)
FreeBSD-3.0 with -ltiff -> -ltiff34 and -lungif -> -lgif FreeBSD-3.0 with -ltiff -> -ltiff34 and -lungif -> -lgif
Solaris 2.6 / Sun Sparc (wmaker 0.20.3) , with Makefile adaptations for libs Solaris 2.6 / Sun Sparc (wmaker 0.20.3) , with Makefile adaptations for libs
AIX 4.2.1 / IBM RS/6000-250 (wmaker 0.50.2) AIX 4.2.1 / IBM RS/6000-250 (wmaker 0.50.2)
Linux 2.3.14 / Mandrake (wmaker but also blackbox !) Linux 2.3.14 / Mandrake (wmaker but also blackbox !)
@ -56,41 +56,41 @@ RPM & DEBIAN linux packages coming soon. Or you can directly use the binary.
compile time problems : compile time problems :
Xlib.h, Xpm.h ... : Xlib.h, Xpm.h ... :
If you compile wmglobe on a computer installed with packages (.rpm), you may If you compile wmglobe on a computer installed with packages (.rpm), you may
lack of these header files. Just install the "xxx-dev.rpm" packages for XFree86 lack of these header files. Just install the "xxx-dev.rpm" packages for XFree86
and graphics libs, or install a rpm version of wmglobe. and graphics libs, or install a rpm version of wmglobe.
libwraster : libwraster :
WindowMaker 0.20.3 uses a libwraster.a , so if you use it, you can execute WindowMaker 0.20.3 uses a libwraster.a , so if you use it, you can execute
the binary on a computer without WindowMaker on it, and displaying on a the binary on a computer without WindowMaker on it, and displaying on a
remote computer (this one using WindowMaker). WM > 0.51.0 creates a dynamic remote computer (this one using WindowMaker). WM > 0.51.0 creates a dynamic
libwraster.so, so it's necessary to have it on the computer running wmglobe libwraster.so, so it's necessary to have it on the computer running wmglobe
if you buit WMGlobe with this one. Both versions of WMGlobe run on WM 0.20.3 if you buit WMGlobe with this one. Both versions of WMGlobe run on WM 0.20.3
and 0.51.0 and 0.51.0
For wmglobe 1.2+, you need WMaker 0.62 or more recent. And wmglobe 1.0 won't For wmglobe 1.2+, you need WMaker 0.62 or more recent. And wmglobe 1.0 won't
run on these recent versions of WindowMaker. You need to have wraster.h run on these recent versions of WindowMaker. You need to have wraster.h
in the include path to compile wmglobe. in the include path to compile wmglobe.
For wmglobe 1.3+, you probably need WMaker 0.64 or more recent. For wmglobe 1.3+, you probably need WMaker 0.64 or more recent.
graphic libs : graphic libs :
you can use libgif or libungif. If your version of WindowMaker is built you can use libgif or libungif. If your version of WindowMaker is built
without support for some graphic type, you don't need it (just remove it without support for some graphic type, you don't need it (just remove it
from the makefile). from the makefile).
This problem may happen with RedHat 5.2, if you get this kind of message, This problem may happen with RedHat 5.2, if you get this kind of message,
just add a libtiff to your system : just add a libtiff to your system :
/usr/local/lib/libwraster.so: undefined reference to `TIFFReadDirectory' /usr/local/lib/libwraster.so: undefined reference to `TIFFReadDirectory'
... ...
make: *** [wmglobe] Error 1 make: *** [wmglobe] Error 1
compile time options : compile time options :
You can modify the file wmgoption.h where many options are set up in defines : You can modify the file wmgoption.h where many options are set up in defines :
To disable the builtin default map, just comment out the line in wmgoptions.h To disable the builtin default map, just comment out the line in wmgoptions.h
#define DEFMAPOK #define DEFMAPOK
to remove the shift+left/left method of rotate earth, uncomment the lines to remove the shift+left/left method of rotate earth, uncomment the lines
#define MOUSE_LAT_FULL #define MOUSE_LAT_FULL
you can also suppress some options screen in wmgoption.h (or even suppress you can also suppress some options screen in wmgoption.h (or even suppress
new features of wmglobe 1.2) new features of wmglobe 1.2)
@ -98,10 +98,10 @@ new features of wmglobe 1.2)
Maps Maps
---------------------------------------- ----------------------------------------
Like XGlobe, WMGlobe needs a longitude/latitude map to work. By default, Like XGlobe, WMGlobe needs a longitude/latitude map to work. By default,
it uses a low quality built-in map of earth. But you will probably want it uses a low quality built-in map of earth. But you will probably want
to use better ones. to use better ones.
You can get maps usable with WMGlobe on the net. See the LINKS chapter. You can get maps usable with WMGlobe on the net. See the LINKS chapter.
@ -119,16 +119,16 @@ Configuration options
---------------------------------------- ----------------------------------------
Configuration is done through command line options. Configuration is done through command line options.
-v version -v version
-h short help -h short help
-zoom zoom_value Value > 1 to magnify the view, value < 1 to lower. -zoom zoom_value Value > 1 to magnify the view, value < 1 to lower.
Default : 1.0 Default : 1.0
-pos latitude long. Initial viewing fixed at this position, don't follow -pos latitude long. Initial viewing fixed at this position, don't follow
the sun rotation. Accepted values in the form the sun rotation. Accepted values in the form
45°12'36 or 45.21 or 45:12:36 45°12'36 or 45.21 or 45:12:36
Default : the initial position is "under" the sun, and Default : the initial position is "under" the sun, and
the point of view follows the sun. the point of view follows the sun.
@ -136,25 +136,25 @@ Configuration is done through command line options.
-moon The point of view follows the Moon (i.e. you see the -moon The point of view follows the Moon (i.e. you see the
Earth as you were on the Moon). Earth as you were on the Moon).
-rand New random position at every refresh of screen -rand New random position at every refresh of screen
-map map_file Map used for the rendering. Can be JPEG, GIF, XPM -map map_file Map used for the rendering. Can be JPEG, GIF, XPM
PNM, TIFF but none BMP PNM, TIFF but none BMP
Default : use internal map of earth. Default : use internal map of earth.
-nimap night_file Map used for the dark side of the earth. Must be of -nimap night_file Map used for the dark side of the earth. Must be of
the same width x height as the day side map. the same width x height as the day side map.
Default : if the default internal day map is used, use Default : if the default internal day map is used, use
a default internal night file (see -nonimap option). a default internal night file (see -nonimap option).
-defnimap Use the default night map (with a custom map). -defnimap Use the default night map (with a custom map).
-nonimap Don't use the default night map. -nonimap Don't use the default night map.
-delay seconds Time in seconds between each calculation of a new -delay seconds Time in seconds between each calculation of a new
position. Limited to 0.04 at compile time (25 frames position. Limited to 0.04 at compile time (25 frames
per second should be enough). The sun position move per second should be enough). The sun position move
only once per minute, so if you use wmglobe without only once per minute, so if you use wmglobe without
-dlong or -accel option, the CPU cost of WMGlobe is -dlong or -accel option, the CPU cost of WMGlobe is
*very* low. The use of very low value for -delay plus *very* low. The use of very low value for -delay plus
@ -162,29 +162,29 @@ Configuration is done through command line options.
Default : 1.0 sec. Default : 1.0 sec.
-dlat delta_latitude Move the point of view by delta_lat degrees per second, -dlat delta_latitude Move the point of view by delta_lat degrees per second,
with a value of 6 the earth make a full rotation in with a value of 6 the earth make a full rotation in
one minute. The value can be formated as -pos option. one minute. The value can be formated as -pos option.
Default : 0°0'0 Default : 0°0'0
-dlong delta_long Move the point of view by delta_long degrees per -dlong delta_long Move the point of view by delta_long degrees per
second. With a value of -0°0'15" the earth make a full second. With a value of -0°0'15" the earth make a full
rotation in 24 hours toward the west. By default, rotation in 24 hours toward the west. By default,
-dlong and -dlat are null. If they are used, the view -dlong and -dlat are null. If they are used, the view
follow their values. Going back to "follow sun" mode follow their values. Going back to "follow sun" mode
in parameters screen put -dlat and -dlong to zero. in parameters screen put -dlat and -dlong to zero.
-light light_value Level of light of the dark side when there is no -light light_value Level of light of the dark side when there is no
night map, from 0 to 1. night map, from 0 to 1.
Default : 0.25 Default : 0.25
-dawn dawn_value Level of continuity for dawn limit, from 0 to 1. With -dawn dawn_value Level of continuity for dawn limit, from 0 to 1. With
a value of 1, the border line between night and day is a value of 1, the border line between night and day is
at maximum contrast. at maximum contrast.
Default : 0.2 Default : 0.2
-bord border_num 0 1 or 2. There are 3 different borders for the icon. -bord border_num 0 1 or 2. There are 3 different borders for the icon.
Default : 0 Default : 0
-accel time_multi Time warp factor. With -accel 24, the sun make a full -accel time_multi Time warp factor. With -accel 24, the sun make a full
rotation in one hour (or the earth, I'm not sure). rotation in one hour (or the earth, I'm not sure).
Default : 1.0 Default : 1.0
@ -195,22 +195,22 @@ Configuration is done through command line options.
Negative values for dates before 1970 accepted. Negative values for dates before 1970 accepted.
Default : not set, use current time. Default : not set, use current time.
-mk latitude long. Put a fixed marker at latitude/longitude. -mk latitude long. Put a fixed marker at latitude/longitude.
-mk sun : put a marker under the Sun position. -mk sun : put a marker under the Sun position.
-mk moon : put a marker under the Moon. -mk moon : put a marker under the Moon.
5 markers can be defined simultaneously, so you can 5 markers can be defined simultaneously, so you can
use wmglobe to predict when Moon will meet the Sun :-) use wmglobe to predict when Moon will meet the Sun :-)
-fun dx dy Move the earth image by dx dy pixels in the icon. See -fun dx dy Move the earth image by dx dy pixels in the icon. See
puzzle.sh to understand why. puzzle.sh to understand why.
-oz Start in "austral" mode (for "down under" people) -oz Start in "austral" mode (for "down under" people)
-stable Keep the globe from going over the poles. -stable Keep the globe from going over the poles.
-d display Select another display -d display Select another display
-w -shape Useless, since it is set by default (WMaker dockable -w -shape Useless, since it is set by default (WMaker dockable
application) application)
mouse : mouse :
@ -223,13 +223,13 @@ right button Displays 7 screens of parameters. On every screen, just
clic with left or right button on the figures to change clic with left or right button on the figures to change
their value. The TIME screen shows an approximation their value. The TIME screen shows an approximation
of date and time of the earth zone currently displayed, of date and time of the earth zone currently displayed,
using GMT time + longitude offset, it's close to the using GMT time + longitude offset, it's close to the
real local time by one or two hours. Others options real local time by one or two hours. Others options
don't need more help. Intuitive they said... don't need more help. Intuitive they said...
Links : Some sites dealing with WindowMaker
Links : Some sites dealing with WindowMaker
------------------------------------------- -------------------------------------------
Official Window Maker Website : Official Window Maker Website :
@ -274,7 +274,7 @@ Livingearth Inc. has some nice (day and night) images on their web pages.
With these you can test the -nightmap option of XEarth. Unfortunately With these you can test the -nightmap option of XEarth. Unfortunately
they are pretty low-res (400x200). they are pretty low-res (400x200).
You can find a higher-resolution (but heavily compressed) version of this You can find a higher-resolution (but heavily compressed) version of this
day map at the "Earth View" page: day map at the "Earth View" page:
http://www.fourmilab.ch/cgi-bin/uncgi/Earth http://www.fourmilab.ch/cgi-bin/uncgi/Earth
@ -311,7 +311,7 @@ Bugs
- if you use the --enable-single-icon compile time option of WindowMaker, - if you use the --enable-single-icon compile time option of WindowMaker,
you can not display more than one WMGlobe. you can not display more than one WMGlobe.
- WMGlobe hopes that an overflow of a long integer dont generate an error - WMGlobe hopes that an overflow of a long integer dont generate an error
and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel
when the date go over year 2038. The expected result is wmglobe when the date go over year 2038. The expected result is wmglobe
continuing smoothly from 1901. continuing smoothly from 1901.
- Using WMGlobe at high speed through a LAN may induce some load on the net. - Using WMGlobe at high speed through a LAN may induce some load on the net.
@ -319,8 +319,8 @@ Bugs
License License
---------------------------------------- ----------------------------------------
WMGlobe is Copyright (C) 1998,99,2000,2001 by Jerome Dumonteil and licensed WMGlobe is Copyright (C) 1998,99,2000,2001 by Jerome Dumonteil and licensed
through the GNU General Public License. through the GNU General Public License.
Read the COPYING file for the complete GNU license. Read the COPYING file for the complete GNU license.
@ -361,14 +361,14 @@ The code in 'sunpos.cpp' is taken from Xearth by Kirk Lauritz Johnson.
The rendering engine is taken from XGlobe by Thorsten Scheuermann The rendering engine is taken from XGlobe by Thorsten Scheuermann
XGlobe Homepage: http://www.uni-karlsruhe.de/~uddn/xglobe XGlobe Homepage: http://www.uni-karlsruhe.de/~uddn/xglobe
Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker
<http://windowmaker.org> by A. K. Kojima, Dan Pascu, Matthew Hawkins & team <http://windowmaker.org> by A. K. Kojima, Dan Pascu, Matthew Hawkins & team
Feedback Feedback
---------------------------------------- ----------------------------------------
For your questions, bugs, remarks, please contact our representative on For your questions, bugs, remarks, please contact our representative on
planet Earth : jerome dumonteil <jerome.dumonteil@linuxfr.org> planet Earth : jerome dumonteil <jerome.dumonteil@linuxfr.org>

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#just for the fun, solve the puzzle and put it on the clip :) #just for the fun, solve the puzzle and put it on the clip :)
if [ -x ./wmglobe ] if [ -x ./wmglobe ]
then then
WMG="nice ./wmglobe" WMG="nice ./wmglobe"
else else

View file

@ -4,19 +4,19 @@
*/ */
/* context.c - X context management /* context.c - X context management
* Raster graphics library * Raster graphics library
* *
* Copyright (c) 1997 Alfredo K. Kojima * Copyright (c) 1997 Alfredo K. Kojima
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version. * version 2 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details. * Library General Public License for more details.
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free * License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -31,14 +31,14 @@
* #include <X11/Xlib.h> * #include <X11/Xlib.h>
* #include <X11/Xutil.h> * #include <X11/Xutil.h>
* #include <X11/Xatom.h> * #include <X11/Xatom.h>
* *
* #include <stdio.h> * #include <stdio.h>
* #include <stdlib.h> * #include <stdlib.h>
* #include <string.h> * #include <string.h>
* #include <assert.h> * #include <assert.h>
* *
* #include <math.h> * #include <math.h>
* *
* #include "wraster.h" * #include "wraster.h"
*/ */
@ -139,7 +139,7 @@ static XColor *allocatePseudoColor(RContext * ctx)
colors[i].flags = DoRed | DoGreen | DoBlue; colors[i].flags = DoRed | DoGreen | DoBlue;
} }
} }
/* try to allocate close values for the colors that couldn't /* try to allocate close values for the colors that couldn't
* be allocated before */ * be allocated before */
avncolors = (1 << ctx->depth > 256 ? 256 : 1 << ctx->depth); avncolors = (1 << ctx->depth > 256 ? 256 : 1 << ctx->depth);
for (i = 0; i < avncolors; i++) for (i = 0; i < avncolors; i++)
@ -244,7 +244,7 @@ static XColor *allocateGrayScale(RContext * ctx)
#endif #endif
} }
} }
/* try to allocate close values for the colors that couldn't /* try to allocate close values for the colors that couldn't
* be allocated before */ * be allocated before */
avncolors = (1 << ctx->depth > 256 ? 256 : 1 << ctx->depth); avncolors = (1 << ctx->depth > 256 ? 256 : 1 << ctx->depth);
for (i = 0; i < avncolors; i++) for (i = 0; i < avncolors; i++)

View file

@ -6,18 +6,18 @@
/* convert.c - convert RImage to Pixmap /* convert.c - convert RImage to Pixmap
* Raster graphics library * Raster graphics library
* *
* Copyright (c) 1997 Alfredo K. Kojima * Copyright (c) 1997 Alfredo K. Kojima
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version. * version 2 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details. * Library General Public License for more details.
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free * License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -90,11 +90,11 @@ static RXImage *image2TrueColor(RContext * ctx, RImage * image)
puts("err "); puts("err ");
return NULL; return NULL;
} }
red = image->data; red = image->data;
grn = image->data + 1; grn = image->data + 1;
blu = image->data + 2; blu = image->data + 2;
roffs = ctx->red_offset; roffs = ctx->red_offset;
goffs = ctx->green_offset; goffs = ctx->green_offset;
boffs = ctx->blue_offset; boffs = ctx->blue_offset;
@ -139,7 +139,7 @@ static RXImage *image2TrueColor(RContext * ctx, RImage * image)
const int dg = 0xff / gmask; const int dg = 0xff / gmask;
const int db = 0xff / bmask; const int db = 0xff / bmask;
register int x1; register int x1;
#ifdef DEBUG #ifdef DEBUG
puts("true color dither"); puts("true color dither");
#endif #endif
@ -309,7 +309,7 @@ static RXImage *image2PseudoColor(RContext * ctx, RImage * image)
const int dg = 0xff / gmask; const int dg = 0xff / gmask;
const int db = 0xff / bmask; const int db = 0xff / bmask;
register int x1; register int x1;
#ifdef DEBUG #ifdef DEBUG
printf("pseudo color dithering with %d colors per channel\n", cpc); printf("pseudo color dithering with %d colors per channel\n", cpc);
#endif #endif

View file

@ -1,23 +1,23 @@
/* WMGlobe 1.3 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/ ***************************************************************************/
/* this code was based on XGlobe : /* this code was based on XGlobe :
renderer.cpp renderer.cpp
* *
* This file is part of XGlobe. See README for details. * This file is part of XGlobe. See README for details.
* *
* Copyright (C) 1998 Thorsten Scheuermann * Copyright (C) 1998 Thorsten Scheuermann
@ -26,8 +26,8 @@
* it under the terms of the GNU General Public Licenses as published by * it under the terms of the GNU General Public Licenses as published by
* the Free Software Foundation. * the Free Software Foundation.
************************************************************************/ ************************************************************************/
/* /*
Some parts of this files should be rewritten to not depend on Some parts of this files should be rewritten to not depend on
WindowMaker version WindowMaker version
*/ */
@ -383,7 +383,7 @@ void renderFrame()
if (solution == FALSE) if (solution == FALSE)
RClearImage(small, &noir); RClearImage(small, &noir);
/* /*
* rotation matrix * rotation matrix
*/ */
m11 = cos(v_long); m11 = cos(v_long);
@ -477,7 +477,7 @@ void renderFrame()
wurzel = sqrt(udroot); wurzel = sqrt(udroot);
s1 = (-b_coef + wurzel) / (2. * a); s1 = (-b_coef + wurzel) / (2. * a);
s2 = (-b_coef - wurzel) / (2. * a); s2 = (-b_coef - wurzel) / (2. * a);
s = (s1 < s2) ? s1 : s2; /* smaller solution belongs s = (s1 < s2) ? s1 : s2; /* smaller solution belongs
to nearer intersection */ to nearer intersection */
solu[px + funx][py + funy][0] = s * dir_x; solu[px + funx][py + funy][0] = s * dir_x;
solu[px + funx][py + funy][1] = s * dir_y; solu[px + funx][py + funy][1] = s * dir_y;
@ -488,7 +488,7 @@ void renderFrame()
} }
} }
if (tabsolu[px + funx][py + funy]) { /* solution exists <=> if (tabsolu[px + funx][py + funy]) { /* solution exists <=>
intersection exists */ intersection exists */
sp_x = solu[px + funx][py + funy][0]; /* sp = camera pos + s*dir */ sp_x = solu[px + funx][py + funy][0]; /* sp = camera pos + s*dir */
sp_y = solu[px + funx][py + funy][1]; sp_y = solu[px + funx][py + funy][1];
@ -599,8 +599,8 @@ void renderFrame()
wurzel = sqrt(udroot); wurzel = sqrt(udroot);
s1 = (-b_coef + wurzel) / (2. * a); s1 = (-b_coef + wurzel) / (2. * a);
s2 = (-b_coef - wurzel) / (2. * a); s2 = (-b_coef - wurzel) / (2. * a);
s = (s1 < s2) ? s1 : s2; /* smaller solution s = (s1 < s2) ? s1 : s2; /* smaller solution
belongs to nearer belongs to nearer
intersection */ intersection */
/* sp = camera pos + s*dir */ /* sp = camera pos + s*dir */
solu[px][py][0] = s * dir_x; solu[px][py][0] = s * dir_x;
@ -611,7 +611,7 @@ void renderFrame()
tabsolu[DIAMETRE - 1 - px][py] = 0; tabsolu[DIAMETRE - 1 - px][py] = 0;
} }
} }
if (tabsolu[px][py]) { /* solution exists <=> if (tabsolu[px][py]) { /* solution exists <=>
intersection exists */ intersection exists */
sp_x = solu[px][py][0]; sp_x = solu[px][py][0];
sp_y = solu[px][py][1]; sp_y = solu[px][py][1];
@ -673,8 +673,8 @@ void renderFrame()
myRPutPixel(px, py, &teinte); myRPutPixel(px, py, &teinte);
/* /*
* mirror the left half-circle of the globe: * mirror the left half-circle of the globe:
* we need a new position and have to recalc. the * we need a new position and have to recalc. the
* light intensity * light intensity
*/ */
@ -698,8 +698,8 @@ void renderFrame()
&teinte); &teinte);
/* /*
* mirror the left half-circle of the globe: * mirror the left half-circle of the globe:
* we need a new position and have * we need a new position and have
* to recalc. the light intensity * to recalc. the light intensity
*/ */

View file

@ -204,10 +204,10 @@ static double sun_ecliptic_longitude(time_t ssue)
static void ecliptic_to_equatorial(double lambda, double beta, static void ecliptic_to_equatorial(double lambda, double beta,
double *alpha, double *delta) double *alpha, double *delta)
/* /*
* double lambda; ecliptic longitude * double lambda; ecliptic longitude
* double beta; ecliptic latitude * double beta; ecliptic latitude
* double *alpha; (return) right ascension * double *alpha; (return) right ascension
* double *delta; (return) declination * double *delta; (return) declination
*/ */
{ {
double sin_e, cos_e; double sin_e, cos_e;
@ -227,9 +227,9 @@ static void ecliptic_to_equatorial(double lambda, double beta,
*/ */
static double julian_date(int y, int m, int d) static double julian_date(int y, int m, int d)
/* /*
* int y; year (e.g. 19xx) * int y; year (e.g. 19xx)
* int m; month (jan=1, feb=2, ...) * int m; month (jan=1, feb=2, ...)
* int d; day of month * int d; day of month
*/ */
{ {
int A, B, C, D; int A, B, C, D;

View file

@ -1,27 +1,27 @@
/* WMGlobe 1.3 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/ ***************************************************************************/
/* /*
* I used many functions of wmgeneral.c ("openXwindow") * I used many functions of wmgeneral.c ("openXwindow")
* for the main function of wmglobe.c * for the main function of wmglobe.c
* wmgeneral.c was taken from wmaker applet wmtune-1.0 : * wmgeneral.c was taken from wmaker applet wmtune-1.0 :
* Author: Martijn Pieterse (pieterse@xs4all.nl) * Author: Martijn Pieterse (pieterse@xs4all.nl)
* *
* wmglobe.c uses functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib * wmglobe.c uses functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib
***************************************************************************/ ***************************************************************************/
#include "wmglobe.h" #include "wmglobe.h"

View file

@ -1,21 +1,21 @@
/* WMGlobe 1.3 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/ ***************************************************************************/
/* it uses some functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib /* it uses some functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib
***************************************************************************/ ***************************************************************************/
@ -131,7 +131,7 @@ double delay, time_multi;
/* /*
* struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim, * struct timeval delta_tim, last_tim, next_tim, render_tim, base_tim,
* vec_tim; * vec_tim;
* *
* time_t beg_time, ini_time,t1901; * time_t beg_time, ini_time,t1901;
*/ */
struct timeval tlast, tnext, trend, tdelay, tini, tbase; struct timeval tlast, tnext, trend, tdelay, tini, tbase;
@ -139,7 +139,7 @@ time_t tsunpos;
int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr; int sens, fun, funx, funy, oknimap, mratiox, mratioy, gotoscr;
int typecadre, p_type, use_nightmap, use_default_nightmap, use_nmap_ini, int typecadre, p_type, use_nightmap, use_default_nightmap, use_nmap_ini,
firstTime, stoprand, do_something, iop; firstTime, stoprand, do_something, iop;
double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long; double v_lat, v_long, old_dvlat, old_dvlong, dv_lat, dv_long;
@ -205,7 +205,7 @@ void setViewPos(double lat, double lon);
int ripalpha(RImage * image); int ripalpha(RImage * image);
RImage* RImage*
RScaleImage(RImage *image, unsigned new_width, unsigned new_height); RScaleImage(RImage *image, unsigned new_width, unsigned new_height);
void void
RReleaseImage(RImage *image); RReleaseImage(RImage *image);
#endif #endif

View file

@ -1,16 +1,16 @@
/* WMGlobe 1.3 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -95,6 +95,6 @@
#define DEFAULT_DAWN 0.9 #define DEFAULT_DAWN 0.9
/* change this if not 64x64 icons (not deep tested) you will need to change /* change this if not 64x64 icons (not deep tested) you will need to change
the cadrex.xbm too and a few other things for the parameters menus the cadrex.xbm too and a few other things for the parameters menus
--- DIAMETRE must be a multiple of 2 --- */ --- DIAMETRE must be a multiple of 2 --- */
#define DIAMETRE 64 #define DIAMETRE 64

View file

@ -1,27 +1,27 @@
/* WMGlobe 1.3 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/ ***************************************************************************/
/* /*
* I used many functions of wmgeneral.c ("openXwindow") * I used many functions of wmgeneral.c ("openXwindow")
* for the main function of wmglobe.c * for the main function of wmglobe.c
* wmgeneral.c was taken from wmaker applet wmtune-1.0 : * wmgeneral.c was taken from wmaker applet wmtune-1.0 :
* Author: Martijn Pieterse (pieterse@xs4all.nl) * Author: Martijn Pieterse (pieterse@xs4all.nl)
* *
* wmglobe.c uses functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib * wmglobe.c uses functions of : Xglobe, Xearth, wmgeneral, wmaker/wrlib
***************************************************************************/ ***************************************************************************/
#include "wmglobe.h" #include "wmglobe.h"
@ -64,7 +64,7 @@ static void move_dlat(int factor);
static void move_dlong(int factor); static void move_dlong(int factor);
/************************************************************************** /**************************************************************************
* TIME FUNCTIONS * TIME FUNCTIONS
*************************************************************************/ *************************************************************************/
struct timeval diftimev(struct timeval t1, struct timeval t2) struct timeval diftimev(struct timeval t1, struct timeval t2)
@ -103,7 +103,7 @@ struct timeval getimev()
} }
/*************************************************************************** /***************************************************************************
* INIT FUNCTIONS * INIT FUNCTIONS
* *
* defaults, commandline * defaults, commandline
@ -663,7 +663,7 @@ void cmdline(int argc, char *argv[])
/**************************************************************************** /****************************************************************************
* X functions, mouse selection * X functions, mouse selection
* *
****************************************************************************/ ****************************************************************************/
@ -727,7 +727,7 @@ int CheckMouseRegion(int x, int y)
/**************************************************************************** /****************************************************************************
* GRAPHIC : pixmap writing of letters & numbers * GRAPHIC : pixmap writing of letters & numbers
* *
****************************************************************************/ ****************************************************************************/
static void chiffre(int ch, int xx, int yy) static void chiffre(int ch, int xx, int yy)
@ -1166,7 +1166,7 @@ static void display_pos(double la, double lo)
void rotation_terre(int x, int y, int lat_flag) void rotation_terre(int x, int y, int lat_flag)
{ {
/* /*
* earth rotate after (while) a clic * earth rotate after (while) a clic
*/ */
double mx, my; double mx, my;
mx = mx =

View file

@ -1,16 +1,16 @@
/* WMGlobe 1.3 - All the Earth on a WMaker Icon /* WMGlobe 1.3 - All the Earth on a WMaker Icon
* copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org> * copyright (C) 1998,99,2000,01 Jerome Dumonteil <jerome.dumonteil@linuxfr.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

View file

@ -1,6 +1,6 @@
.TH WMGlobe 1.3 "august 2001" .TH WMGlobe 1.3 "august 2001"
.SH NAME .SH NAME
WMGlobe - The Whole Earth spinning on you desktop... WMGlobe - The Whole Earth spinning on you desktop...
as a dockable app for WindowMaker as a dockable app for WindowMaker
.SH SYNOPSIS .SH SYNOPSIS
.B wmglobe .B wmglobe
@ -23,16 +23,16 @@ short help
Value > 1 to magnify the view, value < 1 to lower. Default: 1.0 Value > 1 to magnify the view, value < 1 to lower. Default: 1.0
.TP .TP
.B \-pos \fI latitude longitude\fP .B \-pos \fI latitude longitude\fP
Initial viewing fixed at this position, don't follow Initial viewing fixed at this position, don't follow
the sun rotation. Accepted values in the form 45°12'36 or 45.21 or 45:12:36 . the sun rotation. Accepted values in the form 45°12'36 or 45.21 or 45:12:36 .
Default: the initial position is "under" the sun, and Default: the initial position is "under" the sun, and
the point of view follows the sun. the point of view follows the sun.
.TP .TP
.B \-sun .B \-sun
The point of view follows the Sun (default). The point of view follows the Sun (default).
.TP .TP
.B \-moon .B \-moon
The point of view follows the Moon (i.e. you see the Earth as you The point of view follows the Moon (i.e. you see the Earth as you
were on the Moon). were on the Moon).
.TP .TP
.B \-rand .B \-rand
@ -40,49 +40,49 @@ New random position at every refresh of screen.
.TP .TP
.B \-map \fI map_file\fP .B \-map \fI map_file\fP
Map used for the rendering. Can be JPEG, GIF, XPM Map used for the rendering. Can be JPEG, GIF, XPM
PNM, TIFF but none BMP. PNM, TIFF but none BMP.
Default: use internal map of earth. Default: use internal map of earth.
.TP .TP
.B \-nimap \fI night_file\fP .B \-nimap \fI night_file\fP
Map used for the dark side of the earth. Must be of Map used for the dark side of the earth. Must be of
the same width x height as the day side map. the same width x height as the day side map.
Default: if the default internal day map is used, use Default: if the default internal day map is used, use
a default internal night file (see -nonimap option). a default internal night file (see -nonimap option).
.TP .TP
.B \-defnimap .B \-defnimap
Use the default night map (with a custom map). Use the default night map (with a custom map).
.TP .TP
.B \-nonimap .B \-nonimap
Don't use the default night map. Don't use the default night map.
.TP .TP
.B \-delay \fI seconds\fP .B \-delay \fI seconds\fP
Time in seconds between each calculation of a new Time in seconds between each calculation of a new
position. Limited to 0.04 at compile time (25 frames position. Limited to 0.04 at compile time (25 frames
per second should be enough). The sun position move per second should be enough). The sun position move
only once per minute, so if you use wmglobe without only once per minute, so if you use wmglobe without
-dlong or -accel option, the CPU cost of WMGlobe is -dlong or -accel option, the CPU cost of WMGlobe is
*very* low. The use of very low value for -delay plus *very* low. The use of very low value for -delay plus
-dlong and -accel can be CPU costly (but very nice...). -dlong and -accel can be CPU costly (but very nice...).
Default: 1.0 sec. Default: 1.0 sec.
.TP .TP
.B \-dlat \fI delta_latitude\fP .B \-dlat \fI delta_latitude\fP
Move the point of view by delta_lat degrees per second, Move the point of view by delta_lat degrees per second,
with a value of 6 the earth make a full rotation in with a value of 6 the earth make a full rotation in
one minute. The value can be formated as -pos option. one minute. The value can be formated as -pos option.
Default: 0°0'0 Default: 0°0'0
.TP .TP
.B \-dlong \fI delta_long\fP .B \-dlong \fI delta_long\fP
Move the point of view by delta_long degrees per Move the point of view by delta_long degrees per
second. With a value of -0°0'15" the earth make a full second. With a value of -0°0'15" the earth make a full
rotation in 24 hours toward the west. By default, rotation in 24 hours toward the west. By default,
-dlong and -dlat are null. If they are used, the view -dlong and -dlat are null. If they are used, the view
follow their values. Going back to "follow sun" mode follow their values. Going back to "follow sun" mode
in parameters screen put -dlat and -dlong to zero. in parameters screen put -dlat and -dlong to zero.
.TP .TP
.B \-light \fI light_value\fP .B \-light \fI light_value\fP
Level of light of the dark side when there is no Level of light of the dark side when there is no
night map, from 0 to 1. night map, from 0 to 1.
Default: 0.25 Default: 0.25
.TP .TP
.B \-dawn \fI dawn_value\fP .B \-dawn \fI dawn_value\fP
Level of continuity for dawn limit, from 0 to 1. With Level of continuity for dawn limit, from 0 to 1. With
@ -91,9 +91,9 @@ at maximum contrast.
Default: 0.2 Default: 0.2
.TP .TP
.B \-bord \fI border_num\fP .B \-bord \fI border_num\fP
0 1 or 2. There are 3 different borders for the icon. 0 1 or 2. There are 3 different borders for the icon.
Default: 2 Default: 2
.TP .TP
.B \-accel \fI time_multi\fP .B \-accel \fI time_multi\fP
Time warp factor. With -accel 24, the sun make a full Time warp factor. With -accel 24, the sun make a full
rotation in one hour (or the earth, I'm not sure). Default: 1.0 rotation in one hour (or the earth, I'm not sure). Default: 1.0
@ -106,9 +106,9 @@ Negative values for dates before 1970 accepted.
Default: not set, use current time. Default: not set, use current time.
.TP .TP
.B \-mk \fI latitude longitude\fP .B \-mk \fI latitude longitude\fP
Put a fixed marker at latitude/longitude. Put a fixed marker at latitude/longitude.
-mk sun : put a marker under the Sun position. -mk sun : put a marker under the Sun position.
-mk moon : put a marker under the Moon. -mk moon : put a marker under the Moon.
5 markers can be defined simultaneously, so you can 5 markers can be defined simultaneously, so you can
use wmglobe to predict when Moon will meet the Sun :-) use wmglobe to predict when Moon will meet the Sun :-)
.TP .TP
@ -117,7 +117,7 @@ Move the earth image by dx dy pixels in the icon. See
puzzle.sh to understand why. puzzle.sh to understand why.
.TP .TP
.B \-oz .B \-oz
Start in "austral" mode (for "down under" people) Start in "austral" mode (for "down under" people)
.TP .TP
.B \-stable .B \-stable
Keep the globe from going over the poles. Keep the globe from going over the poles.
@ -125,8 +125,8 @@ Keep the globe from going over the poles.
.B \-d \fI display\fP .B \-d \fI display\fP
Select another display Select another display
.TP .TP
.B \-w \-shape .B \-w \-shape
Useless, since it is set by default (WMaker dockable Useless, since it is set by default (WMaker dockable
application) application)
.SH "MOUSE OPTIONS" .SH "MOUSE OPTIONS"
.TP .TP
@ -142,27 +142,27 @@ Displays 7 screens of parameters. On every screen, just
clic with left or right button on the figures to change clic with left or right button on the figures to change
their value. The TIME screen shows an approximation their value. The TIME screen shows an approximation
of date and time of the earth zone currently displayed, of date and time of the earth zone currently displayed,
using GMT time + longitude offset, it's close to the using GMT time + longitude offset, it's close to the
real local time by one or two hours. Others options real local time by one or two hours. Others options
don't need more help. Intuitive they said... don't need more help. Intuitive they said...
.SH "FILES" .SH "FILES"
.TP .TP
.B MAPS .B MAPS
Like XGlobe, WMGlobe needs a longitude/latitude map to work. By default, Like XGlobe, WMGlobe needs a longitude/latitude map to work. By default,
it uses a low quality built-in map of earth. But you will probably want it uses a low quality built-in map of earth. But you will probably want
to use better ones. to use better ones.
You can get maps usable with WMGlobe on the net. See the links below. You can get maps usable with WMGlobe on the net. See the links below.
using custom maps: using custom maps:
For the image to be mapped correctly, position 0°North 0°West must be in For the image to be mapped correctly, position 0°North 0°West must be in
the center of the image and the latitude must be linear from 90°N to 90°S. the center of the image and the latitude must be linear from 90°N to 90°S.
When using a night map, make sure that day and night map have the same When using a night map, make sure that day and night map have the same
dimensions. dimensions.
.TP .TP
.B Links: Where to find maps and similar softs .B Links: Where to find maps and similar softs
where to find the sources of wmglobe: where to find the sources of wmglobe:
the web page of WMGlobe (made by Sylvestre Taburet): the web page of WMGlobe (made by Sylvestre Taburet):
<http://perso.linuxfr.org/jdumont/wmg/> <http://perso.linuxfr.org/jdumont/wmg/>
@ -181,7 +181,7 @@ XGlobe Homepage: (many links to map of earth)
<http://www.uni-karlsruhe.de/~uddn/xglobe> <http://www.uni-karlsruhe.de/~uddn/xglobe>
Xearth Homepage: Xearth Homepage:
<http://www.cs.colorado.edu/~tuna/xearth/> <http://www.cs.colorado.edu/~tuna/xearth/>
@ -200,16 +200,16 @@ The Window Maker User Guide
The Window Maker FAQ The Window Maker FAQ
.SH "AUTHOR" .SH "AUTHOR"
jerome dumonteil <jerome.dumonteil@linuxfr.org> jerome dumonteil <jerome.dumonteil@linuxfr.org>
Patches, bug reports, and suggestions are welcome. Patches, bug reports, and suggestions are welcome.
.SH "CREDITS" .SH "CREDITS"
WMGlobe is Copyright (C) 1998,99 by Jerome Dumonteil and licensed through WMGlobe is Copyright (C) 1998,99 by Jerome Dumonteil and licensed through
the GNU General Public License. the GNU General Public License.
Read the COPYING file for the complete GNU license. Read the COPYING file for the complete GNU license.
Original idea, tests, logos: Original idea, tests, logos:
Sylvestre Taburet <Sylvestre.Taburet@free.fr> Sylvestre Taburet <Sylvestre.Taburet@free.fr>
@ -245,7 +245,7 @@ documentation.
The rendering engine is taken from XGlobe by Thorsten Scheuermann The rendering engine is taken from XGlobe by Thorsten Scheuermann
XGlobe Homepage: http://www.uni-karlsruhe.de/~uddn/xglobe XGlobe Homepage: http://www.uni-karlsruhe.de/~uddn/xglobe
Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker Raster graphics library by Alfredo K. Kojima, & stuff of Window Maker
<http://windowmaker.org> by A. K. Kojima, Dan Pascu, Matthew Hawkins & team <http://windowmaker.org> by A. K. Kojima, Dan Pascu, Matthew Hawkins & team
@ -255,7 +255,7 @@ If you use the --enable-single-icon compile time option of WindowMaker,
you can not display more than one WMGlobe. you can not display more than one WMGlobe.
WMGlobe hopes that an overflow of a long integer dont generate an error WMGlobe hopes that an overflow of a long integer dont generate an error
and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel and that LONG_MAX +1 = LONG_MIN . This happens with high values of -accel
when the date go over year 2038. The expected result is wmglobe when the date go over year 2038. The expected result is wmglobe
continuing smoothly from 1901. continuing smoothly from 1901.

View file

@ -24,7 +24,7 @@
--- ---
* separated the look&feel code from the main code. Creating different * separated the look&feel code from the main code. Creating different
skins is now much easier. Expect them in the next version :)) (sorry, I'm skins is now much easier. Expect them in the next version :)) (sorry, I'm
completely out of time for now). completely out of time for now).
1.6 1.6

View file

@ -5,7 +5,7 @@ Compiling and installing wmisdn:
2. Type "make" 2. Type "make"
3. Copy the wmisdn binary to a directory of your choice 3. Copy the wmisdn binary to a directory of your choice
or or
Type "make install" - this puts wmisdn into /usr/local/sbin Type "make install" - this puts wmisdn into /usr/local/sbin
4. Type "make clean" to clean the source directory 4. Type "make clean" to clean the source directory
NOTE : In order to operate properly, wmisdn must have access to NOTE : In order to operate properly, wmisdn must have access to
@ -24,21 +24,21 @@ II. The secure method:
3. Add the accounts, that should be able to use wmisdn (and generally dial out or controll the isdn connection in some other way), to this group 3. Add the accounts, that should be able to use wmisdn (and generally dial out or controll the isdn connection in some other way), to this group
4. Type "chgrp net /dev/isdninfo /dev/isdnctrl* /sbin/isdnctrl" 4. Type "chgrp net /dev/isdninfo /dev/isdnctrl* /sbin/isdnctrl"
5. Type "chmod g=rw /dev/isdninfo /dev/isdnctrl*" 5. Type "chmod g=rw /dev/isdninfo /dev/isdnctrl*"
I recommend the second method, since it protects your systems against bug I recommend the second method, since it protects your systems against bug
exploits in wmisdn (I hope they don't exist, but I can't guarantee that to 100%). exploits in wmisdn (I hope they don't exist, but I can't guarantee that to 100%).
It is the method recommended by Tom Berger on his site "www.mandrakeuser.org" It is the method recommended by Tom Berger on his site "www.mandrakeuser.org"
(/connect/cisdn2.html). (/connect/cisdn2.html).
wmisdn currently compiles only under Linux. I have tested it on wmisdn currently compiles only under Linux. I have tested it on
* SuSE 6.0 - Kernel 2.0.36, glibc 2.0.7, XFree 3.3.4 * SuSE 6.0 - Kernel 2.0.36, glibc 2.0.7, XFree 3.3.4
* SuSE 6.2 - Kernel 2.2.10, glibc 2.1, XFree 3.3.4 * SuSE 6.2 - Kernel 2.2.10, glibc 2.1, XFree 3.3.4
It has been reported to work on RedHat and Mandrake systems too and should It has been reported to work on RedHat and Mandrake systems too and should
actually compile and run on every Linux system with the kernel includes and actually compile and run on every Linux system with the kernel includes and
isdn4linux on it. isdn4linux on it.
If you use WindowMaker, useful options for the info panel of the extended If you use WindowMaker, useful options for the info panel of the extended
look are: look are:
NoTitlebar = Yes; NoTitlebar = Yes;
NoResizebar = Yes; NoResizebar = Yes;

View file

@ -9,9 +9,9 @@ What it is about and how to use it:
wmisdn is a small isdn monitor that can be docked on the WindowMaker dock, wmisdn is a small isdn monitor that can be docked on the WindowMaker dock,
the Afterstep Wharf or KDE2 kappdock, or used in any other window manager as a the Afterstep Wharf or KDE2 kappdock, or used in any other window manager as a
standalone window app. It gives some information about a specified ippp standalone window app. It gives some information about a specified ippp
device and lets the user control the connection. device and lets the user control the connection.
wmisdn supports all current connection modes of an ippp device wmisdn supports all current connection modes of an ippp device
(as of Kernel 2.2.10) (as of Kernel 2.2.10)
off - the ippp defice has no connection and dialing is disabled off - the ippp defice has no connection and dialing is disabled
@ -24,11 +24,11 @@ voice - ippp serving voice call
modem - ippp working as a modem device modem - ippp working as a modem device
raw - ippp working as a raw device raw - ippp working as a raw device
Every of the 5 connection states that indicate a connection mode has two Every of the 5 connection states that indicate a connection mode has two
modes - incoming and outgoing. modes - incoming and outgoing.
Additional information about the connection is displayed on a panel toggled Additional information about the connection is displayed on a panel toggled
by the small horizontal arrow located on the lower left corner of the main by the small horizontal arrow located on the lower left corner of the main
window. It containts the local and remote ip of the connection, the peer phone window. It containts the local and remote ip of the connection, the peer phone
number and channel bundling information. number and channel bundling information.
@ -38,26 +38,26 @@ The connection can be controlled using the three buttons on the upper side of
the main window. The can be toggled either using the small vertical arrow on the main window. The can be toggled either using the small vertical arrow on
the lower left corner or using the -lamps command line option (see below). the lower left corner or using the -lamps command line option (see below).
The buttons are green, yellow and red. The yellow one cuts the current connection. The buttons are green, yellow and red. The yellow one cuts the current connection.
The red one does the same, as well as disabling the dialing for the specified The red one does the same, as well as disabling the dialing for the specified
device. The green one triggers the dialing for the specified device. device. The green one triggers the dialing for the specified device.
For those of you who find the lamps to be too small and hard to hit :)) - use For those of you who find the lamps to be too small and hard to hit :)) - use
the middle mouse button anywhere on the status display to trigger the the middle mouse button anywhere on the status display to trigger the
connection on/off. connection on/off.
Channel bundling (aka MPPP): Channel bundling (aka MPPP):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If the device shown is a master mppp device (for channel bundling), then the If the device shown is a master mppp device (for channel bundling), then the
left mouse button is used to control the master connection and the right mouse left mouse button is used to control the master connection and the right mouse
button is used to control the slave connection, i.e. if ippp1 is shown and it button is used to control the slave connection, i.e. if ippp1 is shown and it
is the master device of ippp2, then pressing the green lamp with the left is the master device of ippp2, then pressing the green lamp with the left
mouse button starts the connection of ippp1 (master) while the right mouse mouse button starts the connection of ippp1 (master) while the right mouse
button starts the connection of ippp2 (slave). The same applies to the yellow button starts the connection of ippp2 (slave). The same applies to the yellow
lamp. lamp.
Please note that starting a slave connection while the master is offline Please note that starting a slave connection while the master is offline
automatically starts the master connection too. Respectively: stopping the automatically starts the master connection too. Respectively: stopping the
master connection while the slave is on autimatically stops the slave too. master connection while the slave is on autimatically stops the slave too.
Another useful thing to know is that you can start/stop your slave connection Another useful thing to know is that you can start/stop your slave connection
while the master connection is on without corrupting any downloads in progress. while the master connection is on without corrupting any downloads in progress.
The only effect you notice is that your connection becomes faster or slower, The only effect you notice is that your connection becomes faster or slower,
and a small label "bundled" beneath the status display. and a small label "bundled" beneath the status display.
@ -68,13 +68,13 @@ NOTE: You must have configured your ISDN system for channel bundling for these
Multiple devices: Multiple devices:
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
As of version 1.7, wmisdn can handle different devices, which can be toggled As of version 1.7, wmisdn can handle different devices, which can be toggled
by pressing on the device name at the lower right corner of the main window. by pressing on the device name at the lower right corner of the main window.
Compiling and installing: Compiling and installing:
------------------------- -------------------------
If you downloaded wmisdn as a binary, just put it anywhere you want. I'd If you downloaded wmisdn as a binary, just put it anywhere you want. I'd
recommend /usr/local/bin, but it's only a matter of taste, as long as your recommend /usr/local/bin, but it's only a matter of taste, as long as your
system knows where it is. Please note, that as wmisdn highly depends on the system knows where it is. Please note, that as wmisdn highly depends on the
kernel (especially on the isdn4linux subsystem), a downloaded binary may not kernel (especially on the isdn4linux subsystem), a downloaded binary may not
@ -99,13 +99,13 @@ defualt setting 'auto' is assumed.
The -device option tells which ippp devices should be monitored. The devices The -device option tells which ippp devices should be monitored. The devices
are expected as a comma separated list of device names with NO BLANKS in it, are expected as a comma separated list of device names with NO BLANKS in it,
i.e. "-device ippp0,ippp1,ippp5". The order of the device names is not i.e. "-device ippp0,ippp1,ippp5". The order of the device names is not
important. On most systems the only configured device is ippp0 and this is important. On most systems the only configured device is ippp0 and this is
the default setting if none specified. the default setting if none specified.
If you want to monitor a slave device (for mppp), you should also specify If you want to monitor a slave device (for mppp), you should also specify
it using this option. it using this option.
The -lamps option causes the connection control buttons to be displayed The -lamps option causes the connection control buttons to be displayed
directly upon startup, as if some magic hand has pressed the directly upon startup, as if some magic hand has pressed the
vertical-arrow-button that toggles them. It is intended for users who need vertical-arrow-button that toggles them. It is intended for users who need
them permanently. If you have set the hangup timeouts and the default routes them permanently. If you have set the hangup timeouts and the default routes
@ -116,7 +116,7 @@ better without them, they don't appear on the default display mode.
The -font option can be used to specify a different font for the info window The -font option can be used to specify a different font for the info window
and the device display (the default font is the LED-builtin). The font name and the device display (the default font is the LED-builtin). The font name
must follow the X11 font naming conventions and must be placed in quotation must follow the X11 font naming conventions and must be placed in quotation
marks (take a look at xfontsel if you don't know the font names on your marks (take a look at xfontsel if you don't know the font names on your
system). system).
The -usescripts and -path options deal with the scripting feature of wmisdn. The -usescripts and -path options deal with the scripting feature of wmisdn.
@ -145,16 +145,16 @@ uname -a
as well as the name of the Linux distribution you are using. as well as the name of the Linux distribution you are using.
If you are missing features like real time packet flow graphs or load If you are missing features like real time packet flow graphs or load
diagrams then take a look at wmifs or wmnd. These are really fine applets diagrams then take a look at wmifs or wmnd. These are really fine applets
that implement these features for any network device, not only ippp and that implement these features for any network device, not only ippp and
since they work fine and look good, I'm not planning to implement the same since they work fine and look good, I'm not planning to implement the same
things in wmisdn. things in wmisdn.
Credits: Credits:
-------- --------
Klaus Steven - he did a lot of work for bringing 1.7 to 1.8, especially Klaus Steven - he did a lot of work for bringing 1.7 to 1.8, especially
an importang bugfix for wmisdn/aplha and the scripting an importang bugfix for wmisdn/aplha and the scripting
feature, and gave me good ideas and advises throughout feature, and gave me good ideas and advises throughout
Tom Berger - for helping me with the very early version of wmisdn (0.1 :)) Tom Berger - for helping me with the very early version of wmisdn (0.1 :))
and giving good ideas (Dialing mode, etc) and giving good ideas (Dialing mode, etc)
@ -174,7 +174,7 @@ I should keep maintaining it.
--------------------------------- ---------------------------------
Tasho Tasho
tasho.kaletha@gmx.de tasho.kaletha@gmx.de

View file

@ -1,13 +1,13 @@
This file concerns the usage of scripts with wmisdn. This file concerns the usage of scripts with wmisdn.
---------------------------------------------------- ----------------------------------------------------
NOTE: The wmisdn scripting is ONLY for ADVANCED unix users. I can't give any NOTE: The wmisdn scripting is ONLY for ADVANCED unix users. I can't give any
support for user-made scripts. support for user-made scripts.
Ok, if you're still here, then you know what you're doing, so I won't go into
details explaining well known things about Linux. Ok, if you're still here, then you know what you're doing, so I won't go into
details explaining well known things about Linux.
As of version 1.8, wmisdn can use scripts to control the connection instead of As of version 1.8, wmisdn can use scripts to control the connection instead of
direct ioctl calls. If you want to use scripts, then put the "-usescripts" direct ioctl calls. If you want to use scripts, then put the "-usescripts"
@ -21,8 +21,8 @@ They must be located in /etc/isdn/, or in a directory specified by the
"-path" command line option. "-path" command line option.
The first two are called when the green resp. yellow lamp is pressed. These The first two are called when the green resp. yellow lamp is pressed. These
two scripts recieve two parameters. The first one is the name of the two scripts recieve two parameters. The first one is the name of the
ippp-device and the second is the script mode. ippp-device and the second is the script mode.
The script mode is an integer, which corresponds to a line in the file The script mode is an integer, which corresponds to a line in the file
wmisdn-scriptmodes. Every line in this file defines one script mode - the first wmisdn-scriptmodes. Every line in this file defines one script mode - the first
@ -40,12 +40,12 @@ update web-page
where the wmisdn-up script uses the second command line argument to differ where the wmisdn-up script uses the second command line argument to differ
between these modes (0,1 or 2 resp.). The -up/-down scripts should contain between these modes (0,1 or 2 resp.). The -up/-down scripts should contain
the line the line
/usr/sbin/isdnctrl dial $1 /usr/sbin/isdnctrl dial $1
or or
/usr/sbin/isdnctrl hangup $1 /usr/sbin/isdnctrl hangup $1
respectively. respectively.
I might consider putting some scripts on my web-page in the near future. I'd I might consider putting some scripts on my web-page in the near future. I'd
also wellcome any user-made working scripts. also wellcome any user-made working scripts.
Good luck and have fun! Good luck and have fun!

View file

@ -7,11 +7,11 @@ struct region
int id; int id;
int x, y, w, h; int x, y, w, h;
bool enabled; bool enabled;
void (*mouse_in)( int ); void (*mouse_in)( int );
void (*mouse_out)( int ); void (*mouse_out)( int );
void (*mouse_click)( int, unsigned int ); void (*mouse_click)( int, unsigned int );
struct region *next; struct region *next;
}; };
@ -36,7 +36,7 @@ void region_init( Display *_dpy )
dpy = _dpy; dpy = _dpy;
} }
void region_add( Window win, int id, int x, int y, int w, int h, void region_add( Window win, int id, int x, int y, int w, int h,
void (*mouse_in)(int), void (*mouse_out)(int), void (*mouse_click)(int, unsigned int) ) void (*mouse_in)(int), void (*mouse_out)(int), void (*mouse_click)(int, unsigned int) )
{ {
/* cerate the region and set its fields */ /* cerate the region and set its fields */
@ -50,7 +50,7 @@ void region_add( Window win, int id, int x, int y, int w, int h,
reg->mouse_in = mouse_in; reg->mouse_in = mouse_in;
reg->mouse_out = mouse_out; reg->mouse_out = mouse_out;
reg->mouse_click = mouse_click; reg->mouse_click = mouse_click;
/* find the regioned_win and insert the new region into its list of regions */ /* find the regioned_win and insert the new region into its list of regions */
struct regioned_window *reg_win = region_get_win(win); struct regioned_window *reg_win = region_get_win(win);
reg->next = reg_win->first_reg; reg->next = reg_win->first_reg;
@ -70,7 +70,7 @@ void region_disable( Window win, int id )
if( reg != NULL ) if( reg != NULL )
reg->enabled = false; reg->enabled = false;
} }
bool region_in( Window win, int x, int y ) bool region_in( Window win, int x, int y )
{ {
@ -108,7 +108,7 @@ void region_mouse_click( Window win, int x, int y, unsigned int button )
static struct region *region_locate( Window win, int x, int y ) static struct region *region_locate( Window win, int x, int y )
{ {
struct region *reg = region_get_win(win)->first_reg; struct region *reg = region_get_win(win)->first_reg;
while( reg != NULL ) while( reg != NULL )
{ {
if( (x >= reg->x) && (x <= reg->x+reg->w) && if( (x >= reg->x) && (x <= reg->x+reg->w) &&
@ -123,7 +123,7 @@ static struct region *region_locate( Window win, int x, int y )
static struct region *region_find( Window win, int id ) static struct region *region_find( Window win, int id )
{ {
struct region *reg = region_get_win(win)->first_reg; struct region *reg = region_get_win(win)->first_reg;
while( reg != NULL ) while( reg != NULL )
{ {
if( reg->id == id ) if( reg->id == id )
@ -132,18 +132,18 @@ static struct region *region_find( Window win, int id )
} }
return NULL; return NULL;
} }
static struct regioned_window *region_get_win( Window win ) static struct regioned_window *region_get_win( Window win )
{ {
struct regioned_window *reg_win = regioned_windows; struct regioned_window *reg_win = regioned_windows;
while( reg_win != NULL ) while( reg_win != NULL )
{ {
if( reg_win->win == win ) if( reg_win->win == win )
return reg_win; return reg_win;
reg_win = reg_win->next; reg_win = reg_win->next;
} }
reg_win = new regioned_window; reg_win = new regioned_window;
reg_win->win = win; reg_win->win = win;
reg_win->first_reg = NULL; reg_win->first_reg = NULL;

View file

@ -6,7 +6,7 @@
void region_init( Display *dpy ); void region_init( Display *dpy );
void region_add( Window win, int id, int x, int y, int w, int h, void region_add( Window win, int id, int x, int y, int w, int h,
void (*mouse_in)(int), void (*mouse_out)(int), void (*mouse_click)(int, unsigned int) ); void (*mouse_in)(int), void (*mouse_out)(int), void (*mouse_click)(int, unsigned int) );
void region_enable( Window win, int id ); void region_enable( Window win, int id );

View file

@ -1,17 +1,17 @@
/* wmisdn - an ISDN monitor applet for windowmaker/afterstep /* wmisdn - an ISDN monitor applet for windowmaker/afterstep
* Copyright (c) 2000-2001 Tasho Statev Kaletha * Copyright (c) 2000-2001 Tasho Statev Kaletha
* tasho.kaletha@gmx.de * tasho.kaletha@gmx.de
* *
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
@ -271,19 +271,19 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
readScriptModes(); readScriptModes();
initXWin(argc, argv); initXWin(argc, argv);
loadPixmaps(); loadPixmaps();
createRegions(); createRegions();
disp = XCreatePixmap(dpy, Root, MainWinDim.w, MainWinDim.h, DefaultDepth(dpy,DefaultScreen(dpy))); disp = XCreatePixmap(dpy, Root, MainWinDim.w, MainWinDim.h, DefaultDepth(dpy,DefaultScreen(dpy)));
disp_info = XCreatePixmap(dpy, Root, InfoWinDim.w, InfoWinDim.h, DefaultDepth(dpy,DefaultScreen(dpy))); disp_info = XCreatePixmap(dpy, Root, InfoWinDim.w, InfoWinDim.h, DefaultDepth(dpy,DefaultScreen(dpy)));
XGCValues gcv; XGCValues gcv;
unsigned long gcm; unsigned long gcm;
gcm = GCGraphicsExposures|GCBackground; gcm = GCGraphicsExposures|GCBackground;
gcv.graphics_exposures = True; gcv.graphics_exposures = True;
gcv.background = getColor( WindowBackgroundColor ); gcv.background = getColor( WindowBackgroundColor );
if( strlen(txtfont) != 0 ) if( strlen(txtfont) != 0 )
{ {
textFont = XLoadQueryFont( dpy, txtfont ); textFont = XLoadQueryFont( dpy, txtfont );
@ -305,8 +305,8 @@ int main(int argc, char *argv[])
if(!(wmaker || ushape)) if(!(wmaker || ushape))
XSetClipMask(dpy, WinGC, dmsk); XSetClipMask(dpy, WinGC, dmsk);
else else
XShapeCombineMask(dpy, Win[activeWin], ShapeBounding, 0, 0, dmsk, ShapeSet); XShapeCombineMask(dpy, Win[activeWin], ShapeBounding, 0, 0, dmsk, ShapeSet);
XSetClipOrigin(dpy, WinGC, 0, 0); XSetClipOrigin(dpy, WinGC, 0, 0);
XSetClipMask(dpy, WinGC, None); XSetClipMask(dpy, WinGC, None);
@ -322,12 +322,12 @@ int main(int argc, char *argv[])
switch(event.type){ switch(event.type){
case ButtonPress : pressEvent(&event.xbutton); break; case ButtonPress : pressEvent(&event.xbutton); break;
case MotionNotify : motionEvent(&event.xmotion); break; case MotionNotify : motionEvent(&event.xmotion); break;
case ClientMessage : case ClientMessage :
if((Atom)event.xclient.data.l[0]==WM_DELETE_WINDOW) if((Atom)event.xclient.data.l[0]==WM_DELETE_WINDOW)
finished=true; finished=true;
break; break;
case Expose : exposeEvent( &event.xexpose ); break; case Expose : exposeEvent( &event.xexpose ); break;
} }
} }
@ -407,43 +407,43 @@ void freeXWin()
void loadPixmaps() void loadPixmaps()
{ {
createPixmap(cover_xpm, &coverPixmap, &dmsk ); createPixmap(cover_xpm, &coverPixmap, &dmsk );
createPixmap(dialing_xpm, &dialingPixmap, NULL ); createPixmap(dialing_xpm, &dialingPixmap, NULL );
createPixmap(unknown_xpm, &unknownPixmap, NULL ); createPixmap(unknown_xpm, &unknownPixmap, NULL );
createPixmap(disabled_xpm, &disabledPixmap, NULL ); createPixmap(disabled_xpm, &disabledPixmap, NULL );
createPixmap(off_xpm, &offPixmap, NULL ); createPixmap(off_xpm, &offPixmap, NULL );
createPixmap(incoming_xpm, &incomingPixmap, NULL ); createPixmap(incoming_xpm, &incomingPixmap, NULL );
createPixmap(outgoing_xpm, &outgoingPixmap, NULL ); createPixmap(outgoing_xpm, &outgoingPixmap, NULL );
createPixmap(bundling_xpm, &bundlingPixmap, NULL ); createPixmap(bundling_xpm, &bundlingPixmap, NULL );
createPixmap(bundled_xpm, &bundledPixmap, NULL ); createPixmap(bundled_xpm, &bundledPixmap, NULL );
createPixmap(slave_xpm, &slavePixmap, NULL ); createPixmap(slave_xpm, &slavePixmap, NULL );
createPixmap(offline_xpm, &statusPixmaps[ISDN_USAGE_NONE], NULL ); createPixmap(offline_xpm, &statusPixmaps[ISDN_USAGE_NONE], NULL );
createPixmap(raw_xpm, &statusPixmaps[ISDN_USAGE_RAW], NULL ); createPixmap(raw_xpm, &statusPixmaps[ISDN_USAGE_RAW], NULL );
createPixmap(modem_xpm, &statusPixmaps[ISDN_USAGE_MODEM], NULL ); createPixmap(modem_xpm, &statusPixmaps[ISDN_USAGE_MODEM], NULL );
createPixmap(online_xpm, &statusPixmaps[ISDN_USAGE_NET], NULL ); createPixmap(online_xpm, &statusPixmaps[ISDN_USAGE_NET], NULL );
createPixmap(voice_xpm, &statusPixmaps[ISDN_USAGE_VOICE], NULL ); createPixmap(voice_xpm, &statusPixmaps[ISDN_USAGE_VOICE], NULL );
createPixmap(fax_xpm, &statusPixmaps[ISDN_USAGE_FAX], NULL ); createPixmap(fax_xpm, &statusPixmaps[ISDN_USAGE_FAX], NULL );
createPixmap(lamps_xpm, &lampsPixmap, NULL ); createPixmap(lamps_xpm, &lampsPixmap, NULL );
createPixmap(info_sw_xpm, &infoSWPixmap, NULL ); createPixmap(info_sw_xpm, &infoSWPixmap, NULL );
createPixmap(lamps_sw_xpm, &lampsSWPixmap, NULL ); createPixmap(lamps_sw_xpm, &lampsSWPixmap, NULL );
loadLeds( leds_xpm, &ledsPixmap, InfoTextColor, WindowBackgroundColor ); loadLeds( leds_xpm, &ledsPixmap, InfoTextColor, WindowBackgroundColor );
} }
void freePixmaps() void freePixmaps()
{ {
XFreePixmap(dpy, coverPixmap); XFreePixmap(dpy, coverPixmap);
XFreePixmap(dpy, dialingPixmap); XFreePixmap(dpy, dialingPixmap);
XFreePixmap(dpy, unknownPixmap); XFreePixmap(dpy, unknownPixmap);
XFreePixmap(dpy, disabledPixmap); XFreePixmap(dpy, disabledPixmap);
XFreePixmap(dpy, offPixmap); XFreePixmap(dpy, offPixmap);
XFreePixmap(dpy, incomingPixmap); XFreePixmap(dpy, incomingPixmap);
XFreePixmap(dpy, outgoingPixmap); XFreePixmap(dpy, outgoingPixmap);
XFreePixmap(dpy, bundlingPixmap); XFreePixmap(dpy, bundlingPixmap);
XFreePixmap(dpy, bundledPixmap); XFreePixmap(dpy, bundledPixmap);
XFreePixmap(dpy, slavePixmap); XFreePixmap(dpy, slavePixmap);
for( int i=ISDN_USAGE_NONE; i < ISDN_USAGE_FAX; i++ ) for( int i=ISDN_USAGE_NONE; i < ISDN_USAGE_FAX; i++ )
XFreePixmap( dpy, statusPixmaps[i] ); XFreePixmap( dpy, statusPixmaps[i] );
@ -451,14 +451,14 @@ void freePixmaps()
XFreePixmap(dpy, ledsPixmap); XFreePixmap(dpy, ledsPixmap);
XFreePixmap(dpy, lampsPixmap); XFreePixmap(dpy, lampsPixmap);
XFreePixmap(dpy, infoSWPixmap); XFreePixmap(dpy, infoSWPixmap);
XFreePixmap(dpy, lampsSWPixmap); XFreePixmap(dpy, lampsSWPixmap);
} }
void createMainWin( Window *win ) void createMainWin( Window *win )
{ {
*win = XCreateSimpleWindow(dpy, Root, 10, 10, MainWinDim.w, MainWinDim.h,0,0,0); *win = XCreateSimpleWindow(dpy, Root, 10, 10, MainWinDim.w, MainWinDim.h,0,0,0);
XClassHint classHint; XClassHint classHint;
classHint.res_name = NAME; classHint.res_name = NAME;
classHint.res_class = CLASS; classHint.res_class = CLASS;
XSetClassHint(dpy, *win, &classHint); XSetClassHint(dpy, *win, &classHint);
@ -471,8 +471,8 @@ void createInfoPanel( Window *win )
XSizeHints shints; XSizeHints shints;
shints.flags = PPosition; shints.flags = PPosition;
XSetWMNormalHints( dpy, *win, &shints ); XSetWMNormalHints( dpy, *win, &shints );
XClassHint classHint; XClassHint classHint;
classHint.res_name = "Info"; classHint.res_name = "Info";
classHint.res_class = CLASS; classHint.res_class = CLASS;
XSetClassHint(dpy, *win, &classHint); XSetClassHint(dpy, *win, &classHint);
@ -485,9 +485,9 @@ void createRegions()
region_add( Win[activeWin], ID_LAMP_GREEN, LampsRect[ID_LAMP_GREEN].pos.x, LampsRect[ID_LAMP_GREEN].pos.y, LampsRect[ID_LAMP_GREEN].dim.w, LampsRect[ID_LAMP_GREEN].dim.h, mouseInLamp, mouseOutLamp, mouseClickLamp ); region_add( Win[activeWin], ID_LAMP_GREEN, LampsRect[ID_LAMP_GREEN].pos.x, LampsRect[ID_LAMP_GREEN].pos.y, LampsRect[ID_LAMP_GREEN].dim.w, LampsRect[ID_LAMP_GREEN].dim.h, mouseInLamp, mouseOutLamp, mouseClickLamp );
region_add( Win[activeWin], ID_LAMP_YELLOW, LampsRect[ID_LAMP_YELLOW].pos.x, LampsRect[ID_LAMP_YELLOW].pos.y, LampsRect[ID_LAMP_YELLOW].dim.w, LampsRect[ID_LAMP_YELLOW].dim.h, mouseInLamp, mouseOutLamp, mouseClickLamp ); region_add( Win[activeWin], ID_LAMP_YELLOW, LampsRect[ID_LAMP_YELLOW].pos.x, LampsRect[ID_LAMP_YELLOW].pos.y, LampsRect[ID_LAMP_YELLOW].dim.w, LampsRect[ID_LAMP_YELLOW].dim.h, mouseInLamp, mouseOutLamp, mouseClickLamp );
region_add( Win[activeWin], ID_LAMP_RED, LampsRect[ID_LAMP_RED].pos.x, LampsRect[ID_LAMP_RED].pos.y, LampsRect[ID_LAMP_RED].dim.w, LampsRect[ID_LAMP_RED].dim.h, mouseInLamp, mouseOutLamp, mouseClickLamp ); region_add( Win[activeWin], ID_LAMP_RED, LampsRect[ID_LAMP_RED].pos.x, LampsRect[ID_LAMP_RED].pos.y, LampsRect[ID_LAMP_RED].dim.w, LampsRect[ID_LAMP_RED].dim.h, mouseInLamp, mouseOutLamp, mouseClickLamp );
region_add( Win[activeWin], ID_SWITCH_INFO, InfoSWRect.pos.x, InfoSWRect.pos.y, InfoSWRect.dim.w, InfoSWRect.dim.h, mouseInInfoSw, mouseOutInfoSw, mouseClickInfoSw ); region_add( Win[activeWin], ID_SWITCH_INFO, InfoSWRect.pos.x, InfoSWRect.pos.y, InfoSWRect.dim.w, InfoSWRect.dim.h, mouseInInfoSw, mouseOutInfoSw, mouseClickInfoSw );
region_add( Win[activeWin], ID_SWITCH_LAMPS, LampsSWRect.pos.x, LampsSWRect.pos.y, LampsSWRect.dim.w, LampsSWRect.dim.h, mouseInLampsSw, mouseOutLampsSw, mouseClickLampsSw ); region_add( Win[activeWin], ID_SWITCH_LAMPS, LampsSWRect.pos.x, LampsSWRect.pos.y, LampsSWRect.dim.w, LampsSWRect.dim.h, mouseInLampsSw, mouseOutLampsSw, mouseClickLampsSw );
region_add( Win[activeWin], ID_DEVICE, DeviceRect.pos.x, DeviceRect.pos.y, DeviceRect.dim.w, DeviceRect.dim.h, mouseInDevice, mouseOutDevice, mouseClickDevice ); region_add( Win[activeWin], ID_DEVICE, DeviceRect.pos.x, DeviceRect.pos.y, DeviceRect.dim.w, DeviceRect.dim.h, mouseInDevice, mouseOutDevice, mouseClickDevice );
region_add( Win[activeWin], ID_SWITCH_STATUS, StatusPixmapRect.pos.x, StatusPixmapRect.pos.y, StatusPixmapRect.dim.w, StatusPixmapRect.dim.h, mouseInStatusSw, mouseOutStatusSw, mouseClickStatusSw ); region_add( Win[activeWin], ID_SWITCH_STATUS, StatusPixmapRect.pos.x, StatusPixmapRect.pos.y, StatusPixmapRect.dim.w, StatusPixmapRect.dim.h, mouseInStatusSw, mouseOutStatusSw, mouseClickStatusSw );
@ -528,12 +528,12 @@ void printUsage( char *prog_name )
fprintf( stderr, " -w use WithdrawnState (for WindowMaker)\n" ); fprintf( stderr, " -w use WithdrawnState (for WindowMaker)\n" );
fprintf( stderr, " -s shaped window\n" ); fprintf( stderr, " -s shaped window\n" );
fprintf( stderr, " -display display select target display (see X manual pages)\n" ); fprintf( stderr, " -display display select target display (see X manual pages)\n" );
fprintf( stderr, " -font font select the font for displaying status information\n" ); fprintf( stderr, " -font font select the font for displaying status information\n" );
fprintf( stderr, " -dialmode mode select dial mode for offline mode (auto or manual)\n" ); fprintf( stderr, " -dialmode mode select dial mode for offline mode (auto or manual)\n" );
fprintf( stderr, " -device device select ippp devices to monitor\n" ); fprintf( stderr, " -device device select ippp devices to monitor\n" );
fprintf( stderr, " (a list of comma-separated device names is expected containing __no blanks__)\n" ); fprintf( stderr, " (a list of comma-separated device names is expected containing __no blanks__)\n" );
fprintf( stderr, " -lamps activate the line control switches upon startup\n" ); fprintf( stderr, " -lamps activate the line control switches upon startup\n" );
fprintf( stderr, " -usescripts use user scripts for dialing/hanging up instead of direct ioctl calls\n" ); fprintf( stderr, " -usescripts use user scripts for dialing/hanging up instead of direct ioctl calls\n" );
fprintf( stderr, " -path path select directory with the up-/down-scripts\n\n" ); fprintf( stderr, " -path path select directory with the up-/down-scripts\n\n" );
} }
@ -546,7 +546,7 @@ void parseDeviceNames( char *name_list )
{ {
char *ptr1, *ptr2; char *ptr1, *ptr2;
int i; int i;
ptr1 = name_list; ptr1 = name_list;
for( i = 0; i < ISDN_MAX_CHANNELS; i++ ) for( i = 0; i < ISDN_MAX_CHANNELS; i++ )
@ -556,7 +556,7 @@ void parseDeviceNames( char *name_list )
ptr2 = &name_list[strlen(name_list)]; ptr2 = &name_list[strlen(name_list)];
strncpy( devices[i], ptr1, ptr2-ptr1 ); strncpy( devices[i], ptr1, ptr2-ptr1 );
devices[i][ptr2-ptr1] = 0; devices[i][ptr2-ptr1] = 0;
devices[i+1][0] = 0; devices[i+1][0] = 0;
if( !validIppp(devices[i]) ) if( !validIppp(devices[i]) )
fprintf( stderr, "Warning : \"%s\" doesn't seem to be a valid ippp device. wmisdn may not work properly\n", devices[i] ); fprintf( stderr, "Warning : \"%s\" doesn't seem to be a valid ippp device. wmisdn may not work properly\n", devices[i] );
if( ptr2[0] == 0 ) if( ptr2[0] == 0 )
@ -564,12 +564,12 @@ void parseDeviceNames( char *name_list )
ptr1 = ptr2+1; ptr1 = ptr2+1;
} }
} }
bool scanArgs(int argc, char *argv[]) bool scanArgs(int argc, char *argv[])
{ {
bool dialmode_set = false; bool dialmode_set = false;
for(int i=1;i<argc;i++) for(int i=1;i<argc;i++)
{ {
if(strcmp(argv[i],"-h")==0 || strcmp(argv[i],"-help")==0 || strcmp(argv[i],"--help")==0) if(strcmp(argv[i],"-h")==0 || strcmp(argv[i],"-help")==0 || strcmp(argv[i],"--help")==0)
@ -622,7 +622,7 @@ bool scanArgs(int argc, char *argv[])
else if( strcmp(argv[i], "manual")==0 ) else if( strcmp(argv[i], "manual")==0 )
dialmode = ISDN_NET_DM_MANUAL; dialmode = ISDN_NET_DM_MANUAL;
else { else {
fprintf( stderr, "Unknown dial mode \"%s\"\n", argv[i] ); fprintf( stderr, "Unknown dial mode \"%s\"\n", argv[i] );
return false; return false;
} }
dialmode_set = true; dialmode_set = true;
@ -659,7 +659,7 @@ bool scanArgs(int argc, char *argv[])
fprintf( stderr, "Unknown option \"%s\"\n", argv[i] ); fprintf( stderr, "Unknown option \"%s\"\n", argv[i] );
return false; return false;
} }
} }
if( !dialmode_set ) if( !dialmode_set )
isdnInitDefaultDialmode(); isdnInitDefaultDialmode();
@ -669,7 +669,7 @@ bool scanArgs(int argc, char *argv[])
devices[1][0] = 0; devices[1][0] = 0;
selected_device = 0; selected_device = 0;
} }
return true; return true;
} }
@ -690,7 +690,7 @@ void readScriptModes()
scriptmodestrings = (char **)malloc( sizeof(char*) ); scriptmodestrings = (char **)malloc( sizeof(char*) );
scriptmodestrings[0] = (char *)malloc( sizeof("go online") ); scriptmodestrings[0] = (char *)malloc( sizeof("go online") );
strcpy(scriptmodestrings[0], "go online" ); strcpy(scriptmodestrings[0], "go online" );
if( f != NULL ) if( f != NULL )
fclose(f); fclose(f);
return; return;
} }
@ -708,7 +708,7 @@ void readScriptModes()
} while( fgets(buf,sizeof(buf),f) != NULL ); } while( fgets(buf,sizeof(buf),f) != NULL );
fclose(f); fclose(f);
} }
void advanceScriptMode() void advanceScriptMode()
{ {
scriptmode++; scriptmode++;
@ -717,7 +717,7 @@ void advanceScriptMode()
update(); update();
} }
/* press event /* press event
* - if a lamp is pressed then the corresponding actions are taken. * - if a lamp is pressed then the corresponding actions are taken.
* - outside a lamp the extended view is turned on or off * - outside a lamp the extended view is turned on or off
*/ */
@ -781,7 +781,7 @@ inline void drawInfoSwitch( int active )
int pixmap_index = (infoPanelActive ? 2:0) + active; int pixmap_index = (infoPanelActive ? 2:0) + active;
int offset_x = pixmap_index * InfoSWRect.dim.w; int offset_x = pixmap_index * InfoSWRect.dim.w;
XCopyArea( dpy, infoSWPixmap, disp, WinGC, offset_x, 0, InfoSWRect.dim.w, InfoSWRect.dim.h, InfoSWRect.pos.x, InfoSWRect.pos.y ); XCopyArea( dpy, infoSWPixmap, disp, WinGC, offset_x, 0, InfoSWRect.dim.w, InfoSWRect.dim.h, InfoSWRect.pos.x, InfoSWRect.pos.y );
repaint( Win[activeWin], InfoSWRect.pos.x, InfoSWRect.pos.y, InfoSWRect.dim.w, InfoSWRect.dim.h ); repaint( Win[activeWin], InfoSWRect.pos.x, InfoSWRect.pos.y, InfoSWRect.dim.w, InfoSWRect.dim.h );
} }
void mouseInInfoSw( int id ) void mouseInInfoSw( int id )
@ -809,10 +809,10 @@ void mouseClickInfoSw( int id, unsigned int button )
inline void drawLampsSwitch( int active ) inline void drawLampsSwitch( int active )
{ {
int pixmap_index = (lampsActive ? 2:0) + active; int pixmap_index = (lampsActive ? 2:0) + active;
int offset_x = pixmap_index * LampsSWRect.dim.w; int offset_x = pixmap_index * LampsSWRect.dim.w;
XCopyArea( dpy, lampsSWPixmap, disp, WinGC, offset_x, 0, LampsSWRect.dim.w, LampsSWRect.dim.w, LampsSWRect.pos.x, LampsSWRect.pos.y ); XCopyArea( dpy, lampsSWPixmap, disp, WinGC, offset_x, 0, LampsSWRect.dim.w, LampsSWRect.dim.w, LampsSWRect.pos.x, LampsSWRect.pos.y );
repaint( Win[activeWin], LampsSWRect.pos.x, LampsSWRect.pos.y, LampsSWRect.dim.w, LampsSWRect.dim.h ); repaint( Win[activeWin], LampsSWRect.pos.x, LampsSWRect.pos.y, LampsSWRect.dim.w, LampsSWRect.dim.h );
} }
void mouseInLampsSw( int id ) void mouseInLampsSw( int id )
@ -837,7 +837,7 @@ void activateLamps( bool active )
{ {
drawLamp( 0, INACTIVE ); drawLamp( 0, INACTIVE );
drawLamp( 1, INACTIVE ); drawLamp( 1, INACTIVE );
drawLamp( 2, INACTIVE ); drawLamp( 2, INACTIVE );
region_enable( Win[activeWin], ID_LAMP_GREEN ); region_enable( Win[activeWin], ID_LAMP_GREEN );
region_enable( Win[activeWin], ID_LAMP_YELLOW ); region_enable( Win[activeWin], ID_LAMP_YELLOW );
region_enable( Win[activeWin], ID_LAMP_RED ); region_enable( Win[activeWin], ID_LAMP_RED );
@ -861,13 +861,13 @@ void drawSwitches()
void mouseInDevice( int id ) void mouseInDevice( int id )
{ {
drawDevice(ACTIVE); drawDevice(ACTIVE);
repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h ); repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h );
} }
void mouseOutDevice( int id ) void mouseOutDevice( int id )
{ {
drawDevice(INACTIVE); drawDevice(INACTIVE);
repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h ); repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h );
} }
void mouseClickDevice( int id, unsigned int button ) void mouseClickDevice( int id, unsigned int button )
@ -905,17 +905,17 @@ void getWindowPosition( Window win, int *x, int *y )
{ {
XWindowAttributes winAttr; XWindowAttributes winAttr;
Window dummy; Window dummy;
XGetWindowAttributes( dpy, win, &winAttr ); XGetWindowAttributes( dpy, win, &winAttr );
XTranslateCoordinates( dpy, win, winAttr.root, XTranslateCoordinates( dpy, win, winAttr.root,
-winAttr.border_width, -winAttr.border_width, -winAttr.border_width, -winAttr.border_width,
x, y, &dummy ); x, y, &dummy );
} }
void getWindowDimension( Window win, int *w, int *h ) void getWindowDimension( Window win, int *w, int *h )
{ {
XWindowAttributes winAttr; XWindowAttributes winAttr;
XGetWindowAttributes( dpy, win, &winAttr ); XGetWindowAttributes( dpy, win, &winAttr );
*w = winAttr.width; *w = winAttr.width;
*h = winAttr.height; *h = winAttr.height;
} }
@ -928,11 +928,11 @@ void repaint( Window win, int x, int y, int w, int h )
else if( win == Win[2] ) else if( win == Win[2] )
src = disp_info; src = disp_info;
else { else {
syslog( LOG_DEBUG, "Oops! Unknown window given to repaint\n" ); syslog( LOG_DEBUG, "Oops! Unknown window given to repaint\n" );
return; return;
} }
//bade code end //bade code end
XCopyArea( dpy, src, win, WinGC, x, y, w, h, x, y ); XCopyArea( dpy, src, win, WinGC, x, y, w, h, x, y );
XFlush(dpy); XFlush(dpy);
} }
@ -968,14 +968,14 @@ void update()
repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h ); repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h );
} }
updateInfoPanel(); updateInfoPanel();
repaint( Win[2], 0, 0, InfoWinDim.w, InfoWinDim.h ); repaint( Win[2], 0, 0, InfoWinDim.w, InfoWinDim.h );
} }
/* set the appropriate pixmap on the main window */ /* set the appropriate pixmap on the main window */
void setStatusPixmap() void setStatusPixmap()
{ {
Pixmap statusPixmap, directionPixmap; Pixmap statusPixmap, directionPixmap;
if( curStatus.usage > ISDN_USAGE_NONE && curStatus.usage <= ISDN_USAGE_FAX ) if( curStatus.usage > ISDN_USAGE_NONE && curStatus.usage <= ISDN_USAGE_FAX )
{ {
statusPixmap = statusPixmaps[curStatus.usage]; statusPixmap = statusPixmaps[curStatus.usage];
@ -989,13 +989,13 @@ void setStatusPixmap()
} }
} }
else { else {
switch( curStatus.usage ) switch( curStatus.usage )
{ {
case STAT_OFF : statusPixmap = offPixmap; break; case STAT_OFF : statusPixmap = offPixmap; break;
case ISDN_USAGE_NONE: statusPixmap = statusPixmaps[ISDN_USAGE_NONE]; break; case ISDN_USAGE_NONE: statusPixmap = statusPixmaps[ISDN_USAGE_NONE]; break;
case STAT_DISABLED : statusPixmap = disabledPixmap; break; case STAT_DISABLED : statusPixmap = disabledPixmap; break;
case STAT_DIALING : statusPixmap = dialingPixmap; break; case STAT_DIALING : statusPixmap = dialingPixmap; break;
case STAT_UNKNOWN : statusPixmap = unknownPixmap; break; case STAT_UNKNOWN : statusPixmap = unknownPixmap; break;
default : syslog( LOG_DEBUG, "Ooops! curStatus.usage has an invalid value\n" ); statusPixmap = 0; default : syslog( LOG_DEBUG, "Ooops! curStatus.usage has an invalid value\n" ); statusPixmap = 0;
} }
directionPixmap = 0; directionPixmap = 0;
@ -1003,9 +1003,9 @@ void setStatusPixmap()
if( statusPixmap != 0 ) if( statusPixmap != 0 )
XCopyArea(dpy, statusPixmap, disp, WinGC, StatusPixmapRect.pos.x, StatusPixmapRect.pos.y, StatusPixmapRect.dim.w, StatusPixmapRect.dim.h, StatusPixmapRect.pos.x, StatusPixmapRect.pos.y); XCopyArea(dpy, statusPixmap, disp, WinGC, StatusPixmapRect.pos.x, StatusPixmapRect.pos.y, StatusPixmapRect.dim.w, StatusPixmapRect.dim.h, StatusPixmapRect.pos.x, StatusPixmapRect.pos.y);
if( directionPixmap != 0 ) if( directionPixmap != 0 )
XCopyArea(dpy, directionPixmap, disp, WinGC, DirectionPixmapRect.pos.x, DirectionPixmapRect.pos.y, DirectionPixmapRect.dim.w, DirectionPixmapRect.dim.h, DirectionPixmapRect.pos.x, DirectionPixmapRect.pos.y); XCopyArea(dpy, directionPixmap, disp, WinGC, DirectionPixmapRect.pos.x, DirectionPixmapRect.pos.y, DirectionPixmapRect.dim.w, DirectionPixmapRect.dim.h, DirectionPixmapRect.pos.x, DirectionPixmapRect.pos.y);
} }
/* update the info panel */ /* update the info panel */
void updateInfoPanel() void updateInfoPanel()
{ {
@ -1026,11 +1026,11 @@ void updateInfoPanel()
getRemoteIP( &a, &b, &c, &d ); getRemoteIP( &a, &b, &c, &d );
sprintf( line, "remote ip: %d.%d.%d.%d", a, b, c, d ); sprintf( line, "remote ip: %d.%d.%d.%d", a, b, c, d );
drawText( line, disp_info, 5, 35 ); drawText( line, disp_info, 5, 35 );
} }
else if( curStatus.usage == STAT_OFF ) else if( curStatus.usage == STAT_OFF )
drawText( "dialing disabled", disp_info, 5, 5 ); drawText( "dialing disabled", disp_info, 5, 5 );
else if( curStatus.usage == STAT_DISABLED ) else if( curStatus.usage == STAT_DISABLED )
drawText( "device disabled", disp_info, 5, 5 ); drawText( "device disabled", disp_info, 5, 5 );
else if( curStatus.usage == ISDN_USAGE_NONE ) else if( curStatus.usage == ISDN_USAGE_NONE )
{ {
drawText( "not connected", disp_info, 5, 5 ); drawText( "not connected", disp_info, 5, 5 );
@ -1061,12 +1061,12 @@ unsigned long getColor( const char *colorname )
color.flags=DoRed | DoGreen | DoBlue; color.flags=DoRed | DoGreen | DoBlue;
XAllocColor(dpy, winattr.colormap, &color); XAllocColor(dpy, winattr.colormap, &color);
return color.pixel; return color.pixel;
} }
void createPixmap(char *data[], Pixmap *image, Pixmap *mask ) void createPixmap(char *data[], Pixmap *image, Pixmap *mask )
{ {
XpmAttributes pixatt; XpmAttributes pixatt;
pixatt.exactColors=false; pixatt.exactColors=false;
pixatt.closeness=40000; pixatt.closeness=40000;
pixatt.valuemask=XpmExactColors | XpmCloseness | XpmSize; pixatt.valuemask=XpmExactColors | XpmCloseness | XpmSize;
@ -1077,18 +1077,18 @@ void loadLeds( char *data[], Pixmap *image, const char *led_color, const char *b
{ {
XpmAttributes pixatt; XpmAttributes pixatt;
unsigned long color[4]; unsigned long color[4];
color[0] = mixColor(led_color, 0, back_color, 100); color[0] = mixColor(led_color, 0, back_color, 100);
color[1] = mixColor(led_color, 100, back_color, 0); color[1] = mixColor(led_color, 100, back_color, 0);
color[2] = mixColor(led_color, 60, back_color, 40); color[2] = mixColor(led_color, 60, back_color, 40);
color[3] = mixColor(led_color, 25, back_color, 75); color[3] = mixColor(led_color, 25, back_color, 75);
XpmColorSymbol xpmcsym[4]={{"led_color_back", NULL, color[0] }, XpmColorSymbol xpmcsym[4]={{"led_color_back", NULL, color[0] },
{"led_color_high", NULL, color[1]}, {"led_color_high", NULL, color[1]},
{"led_color_med", NULL, color[2]}, {"led_color_med", NULL, color[2]},
{"led_color_low", NULL, color[3]}}; {"led_color_low", NULL, color[3]}};
pixatt.numsymbols = 4; pixatt.numsymbols = 4;
pixatt.colorsymbols = xpmcsym; pixatt.colorsymbols = xpmcsym;
pixatt.exactColors = false; pixatt.exactColors = false;
@ -1155,15 +1155,15 @@ void drawText( char *text, Pixmap dst, int x, int y, const char *color )
void drawLamp( int lamp, int active ) void drawLamp( int lamp, int active )
{ {
int disp_x, disp_y, lamp_x=0; int disp_x, disp_y, lamp_x=0;
disp_x = LampsRect[lamp].pos.x; disp_x = LampsRect[lamp].pos.x;
disp_y = LampsRect[lamp].pos.y; disp_y = LampsRect[lamp].pos.y;
/* find the offset of the lamp pixmap in the pixmap of all lamps */ /* find the offset of the lamp pixmap in the pixmap of all lamps */
for( int i=0; i < lamp; i++ ) for( int i=0; i < lamp; i++ )
lamp_x += LampsRect[i].dim.w*2; lamp_x += LampsRect[i].dim.w*2;
lamp_x += active*LampsRect[lamp].dim.w; lamp_x += active*LampsRect[lamp].dim.w;
XCopyArea( dpy, lampsPixmap, disp, WinGC, lamp_x, 0, LampsRect[lamp].dim.w, LampsRect[lamp].dim.h, disp_x, disp_y ); XCopyArea( dpy, lampsPixmap, disp, WinGC, lamp_x, 0, LampsRect[lamp].dim.w, LampsRect[lamp].dim.h, disp_x, disp_y );
} }
@ -1178,7 +1178,7 @@ void isdnInitDefaultDialmode()
dialmode = cfg.dialmode; dialmode = cfg.dialmode;
else else
dialmode = ISDN_NET_DM_AUTO; /* for the sake of cleanness, we'll get an error msg soon anyway */ dialmode = ISDN_NET_DM_AUTO; /* for the sake of cleanness, we'll get an error msg soon anyway */
if( dialmode == ISDN_NET_DM_OFF ) if( dialmode == ISDN_NET_DM_OFF )
dialmode = ISDN_NET_DM_AUTO; /* use auto as default dialmode if device disabled */ dialmode = ISDN_NET_DM_AUTO; /* use auto as default dialmode if device disabled */
seteuid( getuid() ); seteuid( getuid() );
@ -1194,13 +1194,13 @@ int isdn_ioctl( int func, void *arg, const char *errmsg, const char *filename )
syslog( LOG_NOTICE, "Couldn't open %s : %m\n", filename ); syslog( LOG_NOTICE, "Couldn't open %s : %m\n", filename );
return -1; return -1;
} }
int res = ioctl( fd, func, arg ); int res = ioctl( fd, func, arg );
if( res == -1 && errmsg != NULL ) if( res == -1 && errmsg != NULL )
syslog( LOG_NOTICE, "%s : %m\n", errmsg ); syslog( LOG_NOTICE, "%s : %m\n", errmsg );
close(fd); close(fd);
return res; return res;
} }
@ -1208,12 +1208,12 @@ inline void isdn_dial()
{ {
if( !usescripts ) if( !usescripts )
isdn_ioctl( IIOCNETDIL, devices[selected_device], "Couldn't dial" ); isdn_ioctl( IIOCNETDIL, devices[selected_device], "Couldn't dial" );
else else
{ {
int handle; int handle;
char command[MAX_ARG_LEN]; char command[MAX_ARG_LEN];
strcpy(command, scriptpath); strcpy(command, scriptpath);
strcat(command, "/"); strcat(command, "/");
strcat(command, SCRIPT_UP); strcat(command, SCRIPT_UP);
@ -1225,22 +1225,22 @@ inline void isdn_dial()
system(command); system(command);
} }
} }
update(); update();
} }
inline void isdn_hangup() inline void isdn_hangup()
{ {
if( !usescripts ) if( !usescripts )
isdn_ioctl( IIOCNETHUP, devices[selected_device], "Couldn't hang up" ); isdn_ioctl( IIOCNETHUP, devices[selected_device], "Couldn't hang up" );
else else
{ {
int handle; int handle;
char command[MAX_ARG_LEN]; char command[MAX_ARG_LEN];
strcpy(command, scriptpath); strcpy(command, scriptpath);
strcat(command, "/"); strcat(command, "/");
strcat(command, SCRIPT_DOWN); strcat(command, SCRIPT_DOWN);
if ((handle = open(command, O_RDONLY)) == -1) if ((handle = open(command, O_RDONLY)) == -1)
syslog( LOG_NOTICE, "Couldn't open %s : %m\n", SCRIPT_DOWN ); syslog( LOG_NOTICE, "Couldn't open %s : %m\n", SCRIPT_DOWN );
else { else {
@ -1313,7 +1313,7 @@ inline void manage_slave()
} }
} }
/* react upon a lamp press /* react upon a lamp press
* - green opens a connection and sets the device in dial_auto mode * - green opens a connection and sets the device in dial_auto mode
* - yellow ends the connection and sets the device in dial_auto mode * - yellow ends the connection and sets the device in dial_auto mode
* - red ends the connection and sets the device in dial_off mode * - red ends the connection and sets the device in dial_off mode
@ -1322,9 +1322,9 @@ inline void manage_slave()
inline void _pressGreenLamp( int button ) inline void _pressGreenLamp( int button )
{ {
/* middle button - just change the script mode */ /* middle button - just change the script mode */
if( button == 2 ) if( button == 2 )
{ {
advanceScriptMode(); advanceScriptMode();
return; return;
} }
/* online request of slave - add a channel to the master */ /* online request of slave - add a channel to the master */
@ -1338,19 +1338,19 @@ inline void _pressGreenLamp( int button )
/* if device is dialing or online - ignore button */ /* if device is dialing or online - ignore button */
if( curStatus.usage == STAT_DIALING || curStatus.usage == ISDN_USAGE_NET ) if( curStatus.usage == STAT_DIALING || curStatus.usage == ISDN_USAGE_NET )
return; return;
if( curStatus.usage == STAT_OFF ) if( curStatus.usage == STAT_OFF )
isdn_enable(); isdn_enable();
isdn_dial(); isdn_dial();
} }
} }
inline void _pressYellowLamp( int button ) inline void _pressYellowLamp( int button )
{ {
if( curStatus.usage == ISDN_USAGE_NONE ) if( curStatus.usage == ISDN_USAGE_NONE )
return; return;
if( curStatus.usage == STAT_OFF ) if( curStatus.usage == STAT_OFF )
isdn_enable(); isdn_enable();
else else
{ {
if( (button == 3) || (button == 1) && (curStatus.mpppMode == master) ) if( (button == 3) || (button == 1) && (curStatus.mpppMode == master) )
isdn_hangup_slave( devices[selected_device] ); isdn_hangup_slave( devices[selected_device] );
@ -1366,10 +1366,10 @@ inline void _pressYellowLamp( int button )
inline void _pressRedLamp( int button ) inline void _pressRedLamp( int button )
{ {
if( (curStatus.usage == STAT_OFF) || (button != 1) ) if( (curStatus.usage == STAT_OFF) || (button != 1) )
return; return;
_pressYellowLamp( button ); _pressYellowLamp( button );
isdn_disable(); isdn_disable();
} }
void pressLamp( int lamp_id, int button ) void pressLamp( int lamp_id, int button )
@ -1391,7 +1391,7 @@ void pressStatusSw()
{ {
seteuid( rootUID ); seteuid( rootUID );
setegid( rootGID ); setegid( rootGID );
if( curStatus.usage == ISDN_USAGE_NONE ) if( curStatus.usage == ISDN_USAGE_NONE )
_pressGreenLamp(1); _pressGreenLamp(1);
else if(curStatus.usage == ISDN_USAGE_NET ) else if(curStatus.usage == ISDN_USAGE_NET )
@ -1414,7 +1414,7 @@ void getLocalIP( int *a, int *b, int *c, int *d )
int res = ioctl(fd, SIOCGIFADDR, &ifr); int res = ioctl(fd, SIOCGIFADDR, &ifr);
close(fd); close(fd);
translateIP( &(ifr.ifr_ifru.ifru_addr), a, b, c, d ); translateIP( &(ifr.ifr_ifru.ifru_addr), a, b, c, d );
if( res != 0 ) if( res != 0 )
syslog( LOG_NOTICE, "Oops! Couldn't get local IP of device %s. ioctl() call failed : %m\n", devices[selected_device] ); syslog( LOG_NOTICE, "Oops! Couldn't get local IP of device %s. ioctl() call failed : %m\n", devices[selected_device] );
} }
@ -1423,7 +1423,7 @@ void getRemoteIP( int *a, int *b, int *c, int *d )
{ {
struct ifreq ifr; struct ifreq ifr;
int fd = socket( AF_INET, SOCK_DGRAM, 0 ); int fd = socket( AF_INET, SOCK_DGRAM, 0 );
strcpy( ifr.ifr_ifrn.ifrn_name, devices[selected_device] ); strcpy( ifr.ifr_ifrn.ifrn_name, devices[selected_device] );
ifr.ifr_ifru.ifru_addr.sa_family = AF_INET; ifr.ifr_ifru.ifru_addr.sa_family = AF_INET;
int res = ioctl( fd, SIOCGIFDSTADDR, &ifr ); int res = ioctl( fd, SIOCGIFDSTADDR, &ifr );
@ -1450,7 +1450,7 @@ bool extractIsdnInfoData( const char *all_data, const char *key, char buffer[ISD
{ {
char temp[100]; /* buffer the key string */ char temp[100]; /* buffer the key string */
char *ptr; char *ptr;
ptr = strstr( all_data, key ); ptr = strstr( all_data, key );
if( ptr == NULL ) if( ptr == NULL )
{ {
@ -1471,7 +1471,7 @@ bool getPeerPhone( char *ippp, char *phone )
{ {
isdn_net_ioctl_phone ippp_phone; isdn_net_ioctl_phone ippp_phone;
int res; int res;
strcpy( ippp_phone.name, ippp ); strcpy( ippp_phone.name, ippp );
res = isdn_ioctl( IIOCNETGPN, &ippp_phone, NULL, "/dev/isdninfo" ); res = isdn_ioctl( IIOCNETGPN, &ippp_phone, NULL, "/dev/isdninfo" );
if( res < 0 ) if( res < 0 )
@ -1498,7 +1498,7 @@ bool findBChannel( char *phone, char all_phones[ISDN_MAX_CHANNELS][100], int &ch
void getMPPPSettings( isdn_net_ioctl_cfg *cfg, isdnStatus *stat ) void getMPPPSettings( isdn_net_ioctl_cfg *cfg, isdnStatus *stat )
{ {
stat->mpppMode = none; stat->mpppMode = none;
if( strlen(cfg->master) != 0 ) if( strlen(cfg->master) != 0 )
{ {
stat->mpppMode = slave; stat->mpppMode = slave;
@ -1510,14 +1510,14 @@ void getMPPPSettings( isdn_net_ioctl_cfg *cfg, isdnStatus *stat )
strcpy( stat->mpppPartner, cfg->slave ); strcpy( stat->mpppPartner, cfg->slave );
} }
} }
/* get the status of the ippp device: /* get the status of the ippp device:
* *
* - isOff if dialing is disabled * - isOff if dialing is disabled
* - isOffline if dialing is enabled but no connection is established * - isOffline if dialing is enabled but no connection is established
* - isOnline if device has established a connection * - isOnline if device has established a connection
* - isDialing if device is dialing the remote but no connection is established * - isDialing if device is dialing the remote but no connection is established
* - isUnknown if no stat info available * - isUnknown if no stat info available
*/ */
void getStatus( char *device, isdnStatus *stat ) void getStatus( char *device, isdnStatus *stat )
{ {
@ -1539,7 +1539,7 @@ void getStatus( char *device, isdnStatus *stat )
stat->usage = STAT_UNKNOWN; stat->usage = STAT_UNKNOWN;
stat->direction = INCOMING; stat->direction = INCOMING;
if( res == -1 ) if( res == -1 )
{ {
warning_count++; warning_count++;
@ -1552,8 +1552,8 @@ void getStatus( char *device, isdnStatus *stat )
stat->usage = ISDN_USAGE_NONE; stat->usage = ISDN_USAGE_NONE;
stat->bundled = false; stat->bundled = false;
getMPPPSettings( &cfg, stat ); getMPPPSettings( &cfg, stat );
/* read the device flags from /dev/isdninfo */ /* read the device flags from /dev/isdninfo */
fd = open( "/dev/isdninfo", O_RDONLY|O_NDELAY ); fd = open( "/dev/isdninfo", O_RDONLY|O_NDELAY );
if( fd == -1 ) if( fd == -1 )
@ -1578,21 +1578,21 @@ void getStatus( char *device, isdnStatus *stat )
return; return;
if( !extractIsdnInfoData( buf, "usage:", channel_info ) ) if( !extractIsdnInfoData( buf, "usage:", channel_info ) )
return; return;
channel_usage = atoi(channel_info[channel]); channel_usage = atoi(channel_info[channel]);
if( (channel_usage & ISDN_USAGE_DISABLED) != 0 ) if( (channel_usage & ISDN_USAGE_DISABLED) != 0 )
stat->usage = STAT_DISABLED; stat->usage = STAT_DISABLED;
else else
stat->usage = channel_usage & ISDN_USAGE_MASK; stat->usage = channel_usage & ISDN_USAGE_MASK;
stat->direction = (channel_usage & ISDN_USAGE_OUTGOING) == 0 ? INCOMING : OUTGOING; stat->direction = (channel_usage & ISDN_USAGE_OUTGOING) == 0 ? INCOMING : OUTGOING;
/* check if device is still dialing or already online */ /* check if device is still dialing or already online */
if( stat->usage == ISDN_USAGE_NET ) if( stat->usage == ISDN_USAGE_NET )
{ {
if( !extractIsdnInfoData( buf, "flags:", channel_info ) ) if( !extractIsdnInfoData( buf, "flags:", channel_info ) )
return; return;
if( ((atoi(channel_info[0]) >> channel) & 1) == 0 ) if( ((atoi(channel_info[0]) >> channel) & 1) == 0 )
stat->usage = STAT_DIALING; stat->usage = STAT_DIALING;
} }
@ -1601,8 +1601,8 @@ void getStatus( char *device, isdnStatus *stat )
{ {
isdnStatus slaveStatus; isdnStatus slaveStatus;
getStatus( stat->mpppPartner, &slaveStatus ); getStatus( stat->mpppPartner, &slaveStatus );
if( (stat->usage == slaveStatus.usage) && (stat->direction == slaveStatus.direction) && if( (stat->usage == slaveStatus.usage) && (stat->direction == slaveStatus.direction) &&
(strcmp(stat->peerPhone,slaveStatus.peerPhone)==0) ) (strcmp(stat->peerPhone,slaveStatus.peerPhone)==0) )
stat->bundled = true; stat->bundled = true;
} }
} }

View file

@ -4,7 +4,7 @@ Wed Sep 15 00:29:10 EDT 1999
s/([0-9]+)([0-9]{9})/$2/g := just gimme the last 9 digits... work on that. s/([0-9]+)([0-9]{9})/$2/g := just gimme the last 9 digits... work on that.
This forces a rollover on 9 digits, simultaneously causing correct operation This forces a rollover on 9 digits, simultaneously causing correct operation
999999999 out of 10000000000 times (assuming a 1 byte per second xfer rate and 999999999 out of 10000000000 times (assuming a 1 byte per second xfer rate and
an update delay of 1 second). It also causes an error on the rollover (fixed an update delay of 1 second). It also causes an error on the rollover (fixed
after the next update. This is not an elegant solution, but, it is after the next update. This is not an elegant solution, but, it is
satisfactory for now. satisfactory for now.

View file

@ -10,25 +10,25 @@ Jettero Heller
The inspiration and some of the code for wmstock came from wmWeather (v1.30), The inspiration and some of the code for wmstock came from wmWeather (v1.30),
an excellent dock application. wmWeather was written by Mike Henderson an excellent dock application. wmWeather was written by Mike Henderson
and it is available from: and it is available from:
http://nis-www.lanl.gov/~mgh/WindowMaker/DockApps.shtml http://nis-www.lanl.gov/~mgh/WindowMaker/DockApps.shtml
*** I no longer use this PERL package, but I did take some code from it, *** I no longer use this PERL package, but I did take some code from it,
and used it for versions 0.01 and 0.02 *** and used it for versions 0.01 and 0.02 ***
I also used some code from the Finance::YahooQuotes PERL Module, which is I also used some code from the Finance::YahooQuotes PERL Module, which is
written by Dj Padzensky <djpadz@padz.net> The Finance::YahooQuote home page can written by Dj Padzensky <djpadz@padz.net> The Finance::YahooQuote home page can
be found at http://www.padz.net/~djpadz/YahooQuote/ be found at http://www.padz.net/~djpadz/YahooQuote/
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
As I learned more about writing dock apps, I produced more and more of As I learned more about writing dock apps, I produced more and more of
my own code, and fixed what I believe were engineering flaws in wmWeather, my own code, and fixed what I believe were engineering flaws in wmWeather,
however, I recommend to anyone who wants to get started in dock app programming however, I recommend to anyone who wants to get started in dock app programming
to start with wmWeather, and perhaps also check out this page: to start with wmWeather, and perhaps also check out this page:
http://www.inria.fr/koala/lehors/xpm.html (info about XPMs) http://www.inria.fr/koala/lehors/xpm.html (info about XPMs)
Also, for those of you using XPMs in your code, I found its easier to start Also, for those of you using XPMs in your code, I found its easier to start

View file

@ -3,7 +3,7 @@ Installation instructions for wmjiface.
Requirements Requirements
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
wmjiface requires the Xpm library (which should be available on most machines wmjiface requires the Xpm library (which should be available on most machines
with XFree86 installed). You'll also need some version of perl 5+ running. with XFree86 installed). You'll also need some version of perl 5+ running.
Installation Installation

View file

@ -1,6 +1,6 @@
ifacechck is the program called by wmjiface to get your ifacechck is the program called by wmjiface to get your
interface statistics. It uses /proc/net/dev to gather the interface statistics. It uses /proc/net/dev to gather the
info. info.
If you do not have a /proc/net/dev, you should e-mail me, If you do not have a /proc/net/dev, you should e-mail me,
cuz I don't know what to do with you. cuz I don't know what to do with you.

View file

@ -17,7 +17,7 @@ $staname="$ENV{HOME}/.wmjiface.stat.$ppid";
@statusFiles=`ls $ENV{HOME}/.wmjiface.stat.* 2>/dev/null`; @statusFiles=`ls $ENV{HOME}/.wmjiface.stat.* 2>/dev/null`;
foreach (@statusFiles) { foreach (@statusFiles) {
s/^.*[.]wmjiface[.]stat[.]//; s/^.*[.]wmjiface[.]stat[.]//;
chomp; chomp;
system("rm $ENV{HOME}/.wmjiface.stat.$_") if not ( -d "/proc/$_" ); system("rm $ENV{HOME}/.wmjiface.stat.$_") if not ( -d "/proc/$_" );
} }
@ -66,8 +66,8 @@ sub write_stat() {
printf sta "%i\n", $now; printf sta "%i\n", $now;
foreach (keys %statsc) { foreach (keys %statsc) {
printf sta "%s:%i:%i:%i:%i:%i\n", printf sta "%s:%i:%i:%i:%i:%i\n",
$_, $_,
$statsc{$_}{bytesi}, $statsc{$_}{bytesi},
$statsc{$_}{byteso}, $statsc{$_}{byteso},
$statsc{$_}{packetsi}, $statsc{$_}{packetsi},
@ -80,7 +80,7 @@ sub write_stat() {
sub read_stat() { sub read_stat() {
open sta, "$staname" or return (); open sta, "$staname" or return ();
$then = <sta>; $then = <sta>;
chomp $then; chomp $then;
while(<sta>) { while(<sta>) {
@ -113,12 +113,12 @@ sub read_proc() {
s/([0-9]+)([0-9]{9})/$2/g; s/([0-9]+)([0-9]{9})/$2/g;
($face, ($face,
$bytesi, $packetsi, $errsi, $dropi, $fifoi, $frame, $compressedi, $multicast, $bytesi, $packetsi, $errsi, $dropi, $fifoi, $frame, $compressedi, $multicast,
$byteso, $packetso, $errso, $dropo, $fifoo, $colls, $carrier, $compressedo $byteso, $packetso, $errso, $dropo, $fifoo, $colls, $carrier, $compressedo
) = split ":"; ) = split ":";
if($devfilesexist !~ /^$/ and $face =~ /ppp/) { if($devfilesexist !~ /^$/ and $face =~ /ppp/) {
$tosser = `grep $face /var/run/*.dev /dev/null | head -1`; $tosser = `grep $face /var/run/*.dev /dev/null | head -1`;
chomp $tosser; chomp $tosser;
$tosser =~ s/^[^-]*-//; $tosser =~ s/^[^-]*-//;
$tosser =~ s/.dev:.*//; $tosser =~ s/.dev:.*//;

View file

@ -12,7 +12,7 @@ int main(int argc, char **argv) {
initXwindow(argc, argv); initXwindow(argc, argv);
openXwindow(argc, argv, jDockApp_main_xpm, jDockApp_mask_xpm, openXwindow(argc, argv, jDockApp_main_xpm, jDockApp_mask_xpm,
mask_width, mask_height, "#000000", "#000000", "#000000", mask_width, mask_height, "#000000", "#000000", "#000000",
"#000000", "#000000" "#000000", "#000000"
); );
@ -37,11 +37,11 @@ int main(int argc, char **argv) {
RedrawWindow(); RedrawWindow();
break; break;
case EnterNotify: case EnterNotify:
XSetInputFocus(display, XSetInputFocus(display,
PointerRoot, RevertToParent, CurrentTime); PointerRoot, RevertToParent, CurrentTime);
break; break;
case LeaveNotify: case LeaveNotify:
XSetInputFocus(display, XSetInputFocus(display,
PointerRoot, RevertToParent, CurrentTime); PointerRoot, RevertToParent, CurrentTime);
break; break;
} }

View file

@ -131,10 +131,10 @@ void jprintf_internal(int color, const char *line) {
if(copy_start) copyXPMArea( if(copy_start) copyXPMArea(
copy_start, copy_start,
color, color,
copy_width, copy_width,
char_height, char_height,
start_x+line_position, start_x+line_position,
start_y start_y
); );

View file

@ -15,7 +15,7 @@ sub print_stuff {
## Run the farqin thing: ## Run the farqin thing:
$bn = `basename $0`; $bn = `basename $0`;
`killall -v -q -1 $bn`; `killall -v -q -1 $bn`;
if (fork) { if (fork) {

View file

@ -22,7 +22,7 @@ $staname="$ENV{HOME}/.wmjiface.stat.$ppid";
@statusFiles=`ls $ENV{HOME}/.wmjiface.stat.* 2>/dev/null`; @statusFiles=`ls $ENV{HOME}/.wmjiface.stat.* 2>/dev/null`;
foreach (@statusFiles) { foreach (@statusFiles) {
s/^.*[.]wmjiface[.]stat[.]//; s/^.*[.]wmjiface[.]stat[.]//;
chomp; chomp;
system("rm $ENV{HOME}/.wmjiface.stat.$_") if not ( -d "/proc/$_" ); system("rm $ENV{HOME}/.wmjiface.stat.$_") if not ( -d "/proc/$_" );
} }
@ -71,8 +71,8 @@ sub write_stat() {
printf sta "%i\n", $now; printf sta "%i\n", $now;
foreach (keys %statsc) { foreach (keys %statsc) {
printf sta "%s:%i:%i:%i:%i:%i\n", printf sta "%s:%i:%i:%i:%i:%i\n",
$_, $_,
$statsc{$_}{bytesi}, $statsc{$_}{bytesi},
$statsc{$_}{byteso}, $statsc{$_}{byteso},
$statsc{$_}{packetsi}, $statsc{$_}{packetsi},
@ -85,7 +85,7 @@ sub write_stat() {
sub read_stat() { sub read_stat() {
open sta, "$staname" or return (); open sta, "$staname" or return ();
$then = <sta>; $then = <sta>;
chomp $then; chomp $then;
while(<sta>) { while(<sta>) {
@ -125,12 +125,12 @@ sub read_proc() {
s/([0-9]+)([0-9]{9})/$2/g; s/([0-9]+)([0-9]{9})/$2/g;
($face, ($face,
$bytesi, $packetsi, $errsi, $dropi, $fifoi, $frame, $compressedi, $multicast, $bytesi, $packetsi, $errsi, $dropi, $fifoi, $frame, $compressedi, $multicast,
$byteso, $packetso, $errso, $dropo, $fifoo, $colls, $carrier, $compressedo $byteso, $packetso, $errso, $dropo, $fifoo, $colls, $carrier, $compressedo
) = split ":"; ) = split ":";
if($devfilesexist !~ /^$/ and $face =~ /ppp/) { if($devfilesexist !~ /^$/ and $face =~ /ppp/) {
$tosser = `grep $face /var/run/*.dev /dev/null | head -1`; $tosser = `grep $face /var/run/*.dev /dev/null | head -1`;
chomp $tosser; chomp $tosser;
$tosser =~ s/^[^-]*-//; $tosser =~ s/^[^-]*-//;
$tosser =~ s/.dev:.*//; $tosser =~ s/.dev:.*//;

View file

@ -32,7 +32,7 @@ void show_help() {
void setup(int argc, char** argv) { void setup(int argc, char** argv) {
//char c; //char c;
int c; // thanx to a PowerPC user named Carine Bournez int c; // thanx to a PowerPC user named Carine Bournez
int i = 0; int i = 0;
while( -1 != (c = getopt(argc, argv, "hoADua:b:s:l:1:2:"))) { while( -1 != (c = getopt(argc, argv, "hoADua:b:s:l:1:2:"))) {
@ -81,20 +81,20 @@ void do_print_one_dev(char iface[5], char io, int bps_, int row) {
jprintf(CYAN, ":", io); jprintf(CYAN, ":", io);
if(bps_ >= 0) { if(bps_ >= 0) {
if(bps_ > 1000) { display = (bps_)/1024.0; letter = 'k'; } if(bps_ > 1000) { display = (bps_)/1024.0; letter = 'k'; }
else { display = bps_; letter = ' '; } else { display = bps_; letter = ' '; }
display += 0.5; /* Round Up */ display += 0.5; /* Round Up */
if(!bps_) { color = BLUE; } if(!bps_) { color = BLUE; }
else if(bps_ < hw1) { /* 2000 default */ color = GREEN; } else if(bps_ < hw1) { /* 2000 default */ color = GREEN; }
else if(bps_ < hw2) { /* 4000 default */ color = YELLOW; } else if(bps_ < hw2) { /* 4000 default */ color = YELLOW; }
else { color = RED; } else { color = RED; }
if(letter=='k' && display<100) { if(letter=='k' && display<100) {
jpprintf(6, row, color, "%.1f", display); jpprintf(6, row, color, "%.1f", display);
} else { } else {
jpprintf(6, row, color, "%.0f", display); jpprintf(6, row, color, "%.0f", display);
} }
jprintf(ORANGE, "%c", letter); jprintf(ORANGE, "%c", letter);
@ -124,7 +124,7 @@ void do_update() {
while(1 + fscanf(f, "%s%i%i", iface, &bps_in, &bps_out)) { while(1 + fscanf(f, "%s%i%i", iface, &bps_in, &bps_out)) {
if(use_expavg) { if(use_expavg) {
exp_avg[IN][c] = exp_avg[IN][c] =
(Fal0d(bps_in)*bps_in) + (1-Fal0d(bps_in))*exp_avg[IN][c]; (Fal0d(bps_in)*bps_in) + (1-Fal0d(bps_in))*exp_avg[IN][c];
exp_avg[OUT][c] = exp_avg[OUT][c] =
(Fal0d(bps_out)*bps_out) + (1-Fal0d(bps_out))*exp_avg[OUT][c]; (Fal0d(bps_out)*bps_out) + (1-Fal0d(bps_out))*exp_avg[OUT][c];
@ -142,9 +142,9 @@ void do_update() {
} else { } else {
if(row > 5) break; if(row > 5) break;
do_print_one_dev( do_print_one_dev(
iface, iface,
(out) ? 'o':'i', (out) ? 'o':'i',
(out) ? toshow_out : toshow_in, (out) ? toshow_out : toshow_in,
row++ row++
); );
} }
@ -157,7 +157,7 @@ void do_update() {
void do_expose() { void do_expose() {
do_update(); do_update();
} }
void do_button_release() { void do_button_release() {
do_update(); do_update();
} }

View file

@ -1,10 +1,10 @@
/* /*
* xutils.c - A collection of X-windows utilties for creating WindowMAker * xutils.c - A collection of X-windows utilties for creating WindowMAker
* DockApps. * DockApps.
* *
* This file contains alot of the lower-level X windows routines. Origins * This file contains alot of the lower-level X windows routines. Origins
* with wmppp (by Martijn Pieterse (pieterse@xs4all.nl)), but its been * with wmppp (by Martijn Pieterse (pieterse@xs4all.nl)), but its been
* hacked up quite a bit and passed on from one new DockApp to the next. * hacked up quite a bit and passed on from one new DockApp to the next.
* *
* *
* *
@ -27,7 +27,7 @@
* *
* *
* *
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -42,7 +42,7 @@
/* /*
* X11 Variables * X11 Variables
*/ */
int x_fd; int x_fd;
XSizeHints mysizehints; XSizeHints mysizehints;
@ -85,7 +85,7 @@ static int flush_expose(Window w) {
* RedrawWindowXY * RedrawWindowXY
*/ */
void RedrawWindow(void) { void RedrawWindow(void) {
flush_expose(iconwin); flush_expose(iconwin);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 0,0, wmgen.attributes.width, wmgen.attributes.height, 0, 0); XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 0,0, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
@ -95,7 +95,7 @@ void RedrawWindow(void) {
} }
void RedrawWindowXY(int x, int y) { void RedrawWindowXY(int x, int y) {
flush_expose(iconwin); flush_expose(iconwin);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, x,y, wmgen.attributes.width, wmgen.attributes.height, 0, 0); XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, x,y, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
@ -165,8 +165,8 @@ void initXwindow(int argc, char *argv[]){
/* /*
* openXwindow * openXwindow
*/ */
void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits,
int pixmask_width, int pixmask_height, char *BackColor, char *LabelColor, int pixmask_width, int pixmask_height, char *BackColor, char *LabelColor,
char *WindGustColor, char *DataColor, char *StationTimeColor) { char *WindGustColor, char *DataColor, char *StationTimeColor) {
unsigned int borderwidth = 1; unsigned int borderwidth = 1;
@ -183,9 +183,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
{"StationTimeColor", NULL, 0} }; {"StationTimeColor", NULL, 0} };
/*
/*
* Create Pixmap * Create Pixmap
*/ */
cols[0].pixel = getColor(BackColor, 1.0); cols[0].pixel = getColor(BackColor, 1.0);
@ -197,9 +197,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
wmgen.attributes.colorsymbols = cols; wmgen.attributes.colorsymbols = cols;
wmgen.attributes.exactColors = False; wmgen.attributes.exactColors = False;
wmgen.attributes.closeness = 40000; wmgen.attributes.closeness = 40000;
wmgen.attributes.valuemask = XpmReturnPixels | XpmReturnExtensions | XpmColorSymbols wmgen.attributes.valuemask = XpmReturnPixels | XpmReturnExtensions | XpmColorSymbols
| XpmExactColors | XpmCloseness | XpmSize; | XpmExactColors | XpmCloseness | XpmSize;
if (XpmCreatePixmapFromData(display, Root, pixmap_bytes, if (XpmCreatePixmapFromData(display, Root, pixmap_bytes,
&(wmgen.pixmap), &(wmgen.mask), &(wmgen.attributes)) != XpmSuccess){ &(wmgen.pixmap), &(wmgen.mask), &(wmgen.attributes)) != XpmSuccess){
fprintf(stderr, "Not enough free colorcells.\n"); fprintf(stderr, "Not enough free colorcells.\n");
exit(1); exit(1);
@ -208,8 +208,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
/* /*
* Create a window * Create a window
*/ */
mysizehints.flags = USSize | USPosition; mysizehints.flags = USSize | USPosition;
mysizehints.x = 0; mysizehints.x = 0;
@ -223,19 +223,19 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
mysizehints.width = 64; mysizehints.width = 64;
mysizehints.height = 64; mysizehints.height = 64;
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y, win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y, iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
/* /*
* Activate hints * Activate hints
*/ */
XSetWMNormalHints(display, win, &mysizehints); XSetWMNormalHints(display, win, &mysizehints);
classHint.res_name = wname; classHint.res_name = wname;
@ -250,11 +250,11 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
* effect. I.e. for some you will need to Grab the focus and then return * effect. I.e. for some you will need to Grab the focus and then return
* it after you are done... * it after you are done...
*/ */
XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask
| PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask
| KeyPressMask | KeyReleaseMask); | KeyPressMask | KeyReleaseMask);
XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask
| PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask
| KeyPressMask | KeyReleaseMask); | KeyPressMask | KeyReleaseMask);
@ -266,8 +266,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
XSetWMName(display, win, &name); XSetWMName(display, win, &name);
/* /*
* Create Graphics Context (GC) for drawing * Create Graphics Context (GC) for drawing
*/ */
gcm = GCForeground | GCBackground | GCGraphicsExposures; gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = fore_pix; gcv.foreground = fore_pix;

View file

@ -4,7 +4,7 @@
/* /*
* Typedefs * Typedefs
*/ */
typedef struct { typedef struct {
Pixmap pixmap; Pixmap pixmap;
@ -21,7 +21,7 @@ typedef struct {
Display *display; Display *display;
Window Root; Window Root;
Window iconwin, win; Window iconwin, win;
int screen; int screen;
int DisplayDepth; int DisplayDepth;