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) {
if(!strncmp(temp,"MemTotal:", 9))
if(!strncmp(temp,"MemTotal:", 9))
fscanf(fp_memory, "%Ld", &m_total);
if(!strncmp(temp,"MemFree:", 8))
if(!strncmp(temp,"MemFree:", 8))
fscanf(fp_memory, "%Ld", &m_free);
if(!strncmp(temp,"Cached:", 7))
if(!strncmp(temp,"Cached:", 7))
fscanf(fp_memory, "%Ld", &m_cached);
}
@ -175,7 +175,7 @@ struct timeval timeout;
fp_loadavg = fopen("/proc/loadavg", "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.hisaddcnt = 0;
@ -197,14 +197,14 @@ struct timeval timeout;
cpu_device.idlelast = idle;
if (show_memory) {
dcl_draw_string(6, 5, "cpu", FONT_NORMAL, 3);
dcl_draw_string(6, 12, "mem", FONT_NORMAL, 3);
dcl_copy_xpm_area(5, 57, 54, 1, 5, 18);
get_mem_statistics(&free_memory);
draw_memory_meter();
draw_stats(cpu_device.his, V_WIDTH, V_HEIGHT_MEM, 5, 55);
} else {
dcl_draw_string(6, 5, "cpu", FONT_LARGE, 3);
@ -220,7 +220,7 @@ struct timeval timeout;
waitpid(0, NULL, WNOHANG);
update_stat_cpu(&cpu_device);
/* cpu meter */
dcl_copy_xpm_area(0, 64, 32, 7-(show_memory*2), 26, 5);
@ -246,7 +246,7 @@ struct timeval timeout;
draw_memory_meter();
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);
cpu_device.his[V_WIDTH] = 0;
@ -289,7 +289,7 @@ struct timeval timeout;
break;
case ButtonRelease:
i = dcl_check_mouse_region(Event.xbutton.x, Event.xbutton.y);
if(!i && Event.xbutton.button == LMB && cmd_lmb)
dcl_execute_command(command_lmb, 0);
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)) {
dcl_prefs_put_int ("update_period", update_period);
dcl_prefs_put_int ("show_memory", show_memory);
dcl_prefs_put_string ("command_lmb", command_lmb);
dcl_prefs_put_string ("command_rmb", command_rmb);
}
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)) {
@ -336,7 +336,7 @@ void cputnik_read_prefs(void)
if(strlen(command_rmb)) cmd_rmb = 1;
dcl_prefs_closefile ();
} else {
update_period = 2;
@ -353,7 +353,7 @@ void cputnik_read_prefs(void)
int main(int argc, char **argv)
{
cputnik_read_prefs();
cputnik_read_prefs();
cputnik_routine(argc, argv);
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;
int err;
@ -59,7 +59,7 @@ int err;
err = XpmCreatePixmapFromData(display, Root, pixmap_bytes, &(wmgen->pixmap),
&(wmgen->mask), &(wmgen->attributes));
if (err != XpmSuccess) {
fprintf(stderr, "ERROR: Not enough free colorcells.\n");
exit(1);
@ -73,7 +73,7 @@ int err;
*
******************************************************************************/
Pixel dcl_get_color (char *name)
Pixel dcl_get_color (char *name)
{
XColor color;
XWindowAttributes attributes;
@ -96,7 +96,7 @@ XWindowAttributes attributes;
*
******************************************************************************/
int dcl_flush_expose (Window w)
int dcl_flush_expose (Window w)
{
XEvent dummy;
int i=0;
@ -113,11 +113,11 @@ int i=0;
*
******************************************************************************/
void dcl_redraw_window (void)
void dcl_redraw_window (void)
{
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);
dcl_flush_expose(win);
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);
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
dcl_flush_expose(win);
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) {
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;
@ -265,7 +265,7 @@ unsigned long gcm;
int dummy=0, i, flags;
for (i=1; argv[i]; i++) {
if (!strcmp(argv[i], "-display"))
if (!strcmp(argv[i], "-display"))
display_name = argv[i+1];
}
@ -297,10 +297,10 @@ int dummy=0, i, flags;
mysizehints.width = 64;
mysizehints.height = 64;
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
@ -323,7 +323,7 @@ int dummy=0, i, flags;
XSetWMName(display, win, &name);
/* Create GC for drawing */
gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = fore_pix;
gcv.background = back_pix;
@ -408,7 +408,7 @@ void* dcl_prefs_openfile (char *filename, int openmode)
prefs_filehandle = fopen (filename, "rb");
else if (openmode == P_WRITE)
prefs_filehandle = fopen (filename, "wb");
return prefs_filehandle;
}
@ -501,20 +501,20 @@ static char prfline[MAX_LINE_LEN];
int i;
char c;
fseek (prefs_filehandle, 0, SEEK_SET);
fseek (prefs_filehandle, 0, SEEK_SET);
while (!feof (prefs_filehandle)) {
i = 0;
while (((c = fgetc (prefs_filehandle)) != '\n') && c!= EOF && i < MAX_LINE_LEN)
prfline[i++] = c;
prfline[i] = '\0';
if (prfline[0] != '#')
if (!strncmp (tagname, prfline, strlen (tagname))) break;
}
return prfline;
}
@ -536,7 +536,7 @@ int i;
if ((valpos = strchr (dcl_prefs_get_line_with_tag (tagname), '='))) {
while((c = valpos[i+1]) != '\0' && i < MAX_VALUE_LEN) valuestr[i++] = c;
}
valuestr[i] = '\0';
return valuestr;
}
@ -605,7 +605,7 @@ int len;
(int)(len-maxlength), src);
len = maxlength;
}
memcpy(dest, src, len);
dest[len] = 0;
return dest;
@ -639,7 +639,7 @@ int src_len, dest_len;
(int)(src_len + dest_len - maxlength), src);
src_len = maxlength - dest_len;
}
memcpy(&dest[dest_len], src, src_len);
dest[dest_len + src_len] = 0;
return dest;
@ -687,7 +687,7 @@ int k, font_line, font_width, font_height;
if(toupper(z)==ctable[k]) {
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)
len = strlen(string);
else
else
len = length;
if(len <= 0 || len > MAX_STRING_LEN) {
@ -745,7 +745,7 @@ char a;
return true;
}
/******************************************************************************
*

View File

@ -89,7 +89,7 @@ enum { /* don't change the order! */
RED,
MAGENTA,
BROWN,
WHITE
WHITE
} led_colors;
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.
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
displaying battery time remaining without a
corresponding percentage), please first check the
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.

View File

@ -2,7 +2,7 @@ WMAPM changes.
Version Description
---------------------------------------------------------------------------------------------
3.1 -Released: Jan 11, 2000.
+ Added support for time left on FreeBSD 3.x/4.x
(Chris D. Faulhaber <jedgar@fxp.org>)
@ -12,87 +12,87 @@ WMAPM changes.
3.0 -Released: December 15, 1998.
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
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).
+ 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
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
more things like truning off LCD, etc).
+ Created user-definable LowLevel and CriticalLevel thresholds. Yellow LED
comes on when Battery Percentage hits the LowLevel threshold. Red comes on
when you reach CriticalLevel threshold.
+ Made red status LED blink for extra noticability. User can define blink rate.
A BlinkRate of 0 turns off blinking.
+ Moved all of the other indicators into a single viewport above the
buttons and status LEDs.
+ 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
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
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.
+ Changed the `CHARGING' indicator with a single red `C' indicator at the
upper left of the APP.
+ Changed percentage indicator so that it can display 100%. (Used to only go
up to 99% max).
+ Changed time indicator to have a +/- sign depending on whether you are
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
the battery is fully charged.)
+ 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
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
+ 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
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
(M Henderson's) laptop, the time left indicated 32766 when this happened.
FreeBSD systems should also show a ---:-- indicator. Dont have FreeBSD though
so I couldnt test it....
+ Changed Makefile to suid the apm program. This is needed to allow users to
invoke the standby and suspend capabilities in apm.
+ Sped up the loop to catch button press and expose events. But the querying of
/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
via wall. T1 and T2 are the time in seconds between updates for Low and Critical
status. By default the alerts are turned off.
+ Various sundry code cleanups.
2.0 - Added FreeBSD support.
1.3 - Fixed an annoying little problem with the the meter
not properly lowering as the battery is depleted.
Also did some code cleanup, enhanced the Makefile which
now includes 'make install'.
Released 980826
1.2 - Fixed bug that showed 100% battery capacity
as 90% (I never noticed since my battery seems
to max out at 98%).
Thanx to Brice Ruth <bruth@ltic.com> for pointing out/helping fix the
100% bug (err...feature).
Released 980731
1.1 - Removed libapm dependency; tweaked some code.
Released 980729
1.0 - Initial release version.
Released 980725

View File

@ -4,7 +4,7 @@ Generic
--------------------------------------------------------------
WMAPM supports 7 commandline options:
-h (help);
-h (help);
-C (Critical Percent Threshold);
-L (Low Percent Threshold);
-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
larger than 60x60 pixels. Please tell the AfterStep authors
to fix this, this is not our fault, but a Wharf problem!
Other WindowManagers
--------------------------------------------------------------

View File

@ -1,9 +1,9 @@
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
Michael G. Henderson <mghenderson@lanl.gov>
Credits...: Rik Faith <faith@cs.unc.edu> for his implementation
of libapm with respect to Linux APM support.
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
fix the meter mismatch.
William M. Perry - Added Solaris support.
Also, thanks to the following for various
bug fixes, patches and/or suggestions;
ObiTuarY
ObiTuarY
MATSUBAYASHI 'Shaolin' Kohji"
Fumihiko Nishio
Description
--------------------------------------------------------------
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.
COPYING GNU General Public License Version 2.
TODO Stuff I've planned for future WMAPM releases.
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
as detailed as you can.
@ -68,7 +68,7 @@ as detailed as you can.
Copyright
--------------------------------------------------------------
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.

View File

@ -4,9 +4,9 @@ TODO list for WMAPM
* Work on NetBSD support.
* Add GUI to allow user to set things.
* Add ~/.wmapmrc file to store saved settings.
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:
jedgar@fxp.org

View File

@ -23,6 +23,6 @@ clean:
install:: wmapm
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

View File

@ -1,4 +1,4 @@
.TH WMAPM 1 "15 December 1998"
.TH WMAPM 1 "15 December 1998"
.SH NAME
WMAPM \- Dockable APM/Battery Monitor
.SH SYNOPSIS
@ -16,7 +16,7 @@ application.
.PP
WMAPM provides the following information: battery or AC operation, battery
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
the APM BIOS.
.SH OPTIONS

View File

@ -2,13 +2,13 @@
* wmapm-3.1
*
* 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
* how long it will take to drain or charge the battery.)
*
* Originally written (and copyrighted under GPL) by
* 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>.
*
*
@ -30,7 +30,7 @@
* Portions of code derived from:
* apm/apmd/libapm : (c) 1996 Rickard E. Faith (r.faith@ieee.org)
* 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
* Toggle fix the meter mismatch.
@ -53,18 +53,18 @@
* on laptops. There are a *lot* of laptops out there that are only
* 8-bit. Use the "-l" command-line option to invoke.
*
*
*
* 3.0 -Released: December 15, 1998.
* 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
* 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).
*
* + 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
* 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
@ -97,11 +97,11 @@
* 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
* the battery is fully charged.)
*
* + 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
* 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
*
* + 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
* 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
* (M Henderson's) laptop, the time left indicated 32766 when this happened.
* FreeBSD systems should also show a ---:-- indicator. Dont have FreeBSD though
* so I couldnt test it....
@ -118,9 +118,9 @@
*
* + Various sundry code cleanups.
*
*
*
* 2.0 - Added FreeBSD support.
*
*
* 1.3 - Fixed an annoying little problem with the the meter
* not properly lowering as the battery is depleted.
* 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
* 100% bug (err...feature).
* Released 980731
*
*
* 1.1 - Removed libapm dependency; tweaked some code.
* Released 980729
*
@ -156,7 +156,7 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include <machine/apm_bios.h>
#endif
#endif
#include <stdio.h>
#include <unistd.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[]) {
struct my_apm_info my_cur_info;
int time_left,
hour_left,
min_left,
int time_left,
hour_left,
min_left,
digit;
#ifdef FreeBSD
struct apm_info temp_info;
@ -234,7 +234,7 @@ int main(int argc, char *argv[]) {
/*
* Parse any command line arguments.
*/
@ -242,7 +242,7 @@ int main(int argc, char *argv[]) {
BlinkRate = (BlinkRate >= 0.0) ? BlinkRate : -1.0*BlinkRate;
UpdateRate = (UpdateRate >= 0.0) ? UpdateRate : -1.0*UpdateRate;
nMax = (int)( 1.0e6/(2.0*UpdateRate*DELAY) );
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()) {
#ifdef Linux
fprintf(stderr, "No APM support in kernel\n");
@ -271,7 +271,7 @@ int main(int argc, char *argv[]) {
if (UseLowColorPixmap)
openXwindow(argc, argv, wmapm_master_LowColor, wmapm_mask_bits, wmapm_mask_width, wmapm_mask_height);
else
@ -279,7 +279,7 @@ int main(int argc, char *argv[]) {
/*
* Loop until we die...
*/
@ -292,9 +292,9 @@ int main(int argc, char *argv[]) {
/*
* 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...
*
*
* DELAY is set at 0.00625 seconds, so process apm info
* 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_time = (int)temp_info.ai_batt_time;
#endif
/*
/*
* Check AC status.
*/
switch (my_cur_info.ac_line_status) {
case 1:
case 1:
/*
* AC on-line. I.e. we are "plugged-in".
*/
copyXPMArea(68, 6, 26, 7, 31, 35);
break;
default:
default:
/*
* AC off-line. I.e. we are using battery.
*/
copyXPMArea(68, 20, 26, 7, 31, 35);
}
/*
/*
* Paste up the default charge status and time
*/
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, 12);
}
}
@ -389,11 +389,11 @@ int main(int argc, char *argv[]) {
/*
/*
* 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
*
*/
@ -408,7 +408,7 @@ int main(int argc, char *argv[]) {
/*
* If battery_time is too large, it likely means that there is
* no charging or discharging going on. So just display a "null"
* indicator (--:--).
* indicator (--:--).
*
*/
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) */
}
/*
/*
* Do Battery Percentage.
*/
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;
copyXPMArea(66, 42, k, 9, 7, 21);
if (k%2)
if (k%2)
copyXPMArea(66+k-1, 52, 1, 9, 7+k-1, 21);
else
else
copyXPMArea(66+k, 52, 1, 9, 7+k, 21);
}
@ -471,7 +471,7 @@ int main(int argc, char *argv[]) {
} else {
/*
* Update the counter. When it hits nMax, we will
* Update the counter. When it hits nMax, we will
* process /proc/apm information again.
*/
++n;
@ -533,7 +533,7 @@ int main(int argc, char *argv[]) {
} else {
/*
* Update the counter.
* Update the counter.
*/
++m;
@ -559,7 +559,7 @@ int main(int argc, char *argv[]) {
} else {
/*
* Update the counter.
* Update the counter.
*/
++s;
@ -578,7 +578,7 @@ int main(int argc, char *argv[]) {
} else {
/*
* Update the counter.
* Update the counter.
*/
++r;
@ -589,7 +589,7 @@ int main(int argc, char *argv[]) {
/*
/*
* Process any pending X events.
*/
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();
usleep(DELAY);
@ -644,12 +644,12 @@ int main(int argc, char *argv[]) {
/*
* This routine handles button presses. Pressing the 'S' button
* invokes 'apm -S' to place the machine into standby mode. And
* pressing the 'Z' buton invokes 'apm -s' to place the machine
* invokes 'apm -S' to place the machine into standby mode. And
* pressing the 'Z' buton invokes 'apm -s' to place the machine
* into suspend mode.
*
* 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.
* 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.
* run 'chmod +s /usr/bin/apm' as root). This will allow
* '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...
*
*
*/
int apm_exists()
{
@ -728,8 +728,8 @@ int apm_exists()
/*
* apm_read()
/*
* apm_read()
* - Read in the information found in /proc/apm...
*
*/
@ -740,7 +740,7 @@ int apm_read(struct my_apm_info *i){
char units[10];
char buffer[100];
int retcode = 0;
/*
* Open /proc/apm for reading
*/
@ -774,7 +774,7 @@ int apm_read(struct my_apm_info *i){
/*
* Old Style
*/
if (i->driver_version[0] == 'B') {
if (i->driver_version[0] == 'B') {
strcpy((char *)i->driver_version, "pre-0.7");
i->apm_version_major = 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);
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;
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;
fgets(buffer, sizeof(buffer) - 1, str);
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, "crit", 4)) i->battery_status = 2;
else if (!strncmp(buffer+16, "charg", 5)) i->battery_status = 3;
fgets(buffer, sizeof(buffer) - 1, str);
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%
*/
if (i->battery_percentage > 100) i->battery_percentage = -1;
fclose(str);
return retcode;
@ -842,7 +842,7 @@ int apm_read(struct my_apm_info *i){
int apm_read(apm_info_t temp_info) {
int fd;
if ( (fd = open(APMDEV, O_RDWR)) < 0){
return(1);
@ -861,7 +861,7 @@ int apm_read(apm_info_t temp_info) {
}
# endif
#endif
#endif
#ifdef SunOS
int apm_read(struct my_apm_info *i) {
@ -874,15 +874,15 @@ int apm_read(struct my_apm_info *i) {
perror("open");
exit(1);
}
if (ioctl(fd,BATT_STATUS,&info) < 0) return(1);
close(fd);
i->battery_percentage = info.capacity;
i->battery_time = info.discharge_time;
i->using_minutes = 0;
/* convert to internal status:
*
* 0 = high
@ -908,7 +908,7 @@ int apm_read(struct my_apm_info *i) {
i->battery_status = 2;
break;
}
switch(info.charge) {
case DISCHARGE: /* Battery is discharging (i.e. in use) */
i->ac_line_status = 0;
@ -919,61 +919,61 @@ int apm_read(struct my_apm_info *i) {
i->ac_line_status = 1;
break;
}
if (i->battery_percentage > 100) i->battery_percentage = 100;
/* Not sure what else we can fill in right now.
* Relevant information is:
*
* info.id_string = type of battery (internal, external, etc)
* info.total = total capacity (mWhrs)
*/
return(0);
}
#endif
#endif
/*
* ParseCMDLine()
/*
* ParseCMDLine()
*/
void ParseCMDLine(int argc, char *argv[]) {
char *cmdline;
int i,j;
char puke[20];
for (i = 1; i < argc; i++) {
cmdline = argv[i];
if (cmdline[0] == '-') {
switch(cmdline[1]) {
case 'd':
case 'd':
++i;
break;
case 'A':
case 'A':
Alert = 1;
LAlertRate = atof(argv[++i]);
CAlertRate = atof(argv[++i]);
break;
case 'b':
case 'b':
BlinkRate = atof(argv[++i]);
break;
case 'C':
case 'C':
CriticalLevel = atoi(argv[++i]);
break;
case 'L':
case 'L':
LowLevel = atoi(argv[++i]);
break;
case 'l':
case 'l':
UseLowColorPixmap = 1;
break;
case 'B':
case 'B':
Beep = 1;
Volume = atoi(argv[++i]);
break;
default:
default:
printf("\nwmapm version: %s\n", WMAPM_VERSION);
printf("usage:\n");
printf("\t-display <display>\tUse alternate display.\n");

View File

@ -10,18 +10,18 @@ VMGlobe
1.2 released 9/04/2000
- WindowMaker 0.62 compliancy
1.1 not released
1.1 not released
- another floating point exception bug solved (Alpha)
- little optimizations and rewriting in rend.c
- -sun option
- -moon option
- -mk marker option
1.0 released 30/05/99
- option -stable : latitude never change of sign
- change email to jerome.dumonteil@linuxfr.org
- modify a few typo in doc
0.5 released 6/02/99
- floating point exception bug solved
- many minor bugs solved (earth displaying, mouse, time management)
@ -34,7 +34,7 @@ VMGlobe
- option selection through parameters screens (right button)
- approximation of date & time of view point
- new default map (bigger, better)
- display of time uses setlocale()
- display of time uses setlocale()
- option -dawn value : enhance dawn borderline
- option -time : change date displayed
- option -nonimap
@ -43,7 +43,7 @@ VMGlobe
- modify comportment of -rand option when zooming
- change left button comportment : only change longitude
- shift+left button : change longitude & latitude
- man page
- man page
0.3.1 released 5/01/99
- option -austral
@ -62,7 +62,7 @@ VMGlobe
left click = change longitude
middle click = zoom in / zoom out
right click = change latitude
- a few hints for compile on *BSD
- a few hints for compile on *BSD
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 \
-ltiff -lXpm -lpng -lz -ljpeg -lungif -lwraster
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 :
@ -12,11 +12,11 @@ all: wmglobe
clean:
rm -f src/*.o wmglobe
wmglobe : $(OBJS)
gcc -O2 -Wall $(OBJS) -o wmglobe $(LIBS)
strip wmglobe
strip wmglobe
install :
install :
install wmglobe /usr/local/bin
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
----------------------------------------
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 :-)
Warning : this version won't work with WindowMaker < 0.62
tar -xvzf wmglobe-1.3.tar.gz
cd wmglobe-1.3
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) :
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...
@ -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.
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
Linux 2.0.36 / RedHat 5.1
Linux 2.0.36 / SuSE 5.3 (wmaker 0.20.3) , -lungif -> -lgif
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 / SuSE 5.3 (wmaker 0.20.3) , -lungif -> -lgif
Linux 2.0.36 / RedHat 5.2 (wmaker 0.53)
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
AIX 4.2.1 / IBM RS/6000-250 (wmaker 0.50.2)
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 :
Xlib.h, Xpm.h ... :
If you compile wmglobe on a computer installed with packages (.rpm), you may
Xlib.h, Xpm.h ... :
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
and graphics libs, or install a rpm version of wmglobe.
libwraster :
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
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
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
if you buit WMGlobe with this one. Both versions of WMGlobe run on WM 0.20.3
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
and 0.51.0
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.
For wmglobe 1.3+, you probably need WMaker 0.64 or more recent.
graphic libs :
you can use libgif or libungif. If your version of WindowMaker is built
graphic libs :
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
from the makefile).
This problem may happen with RedHat 5.2, if you get this kind of message,
from the makefile).
This problem may happen with RedHat 5.2, if you get this kind of message,
just add a libtiff to your system :
/usr/local/lib/libwraster.so: undefined reference to `TIFFReadDirectory'
...
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 :
To disable the builtin default map, just comment out the line in wmgoptions.h
#define DEFMAPOK
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
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,
it uses a low quality built-in map of earth. But you will probably want
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
to use better ones.
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.
-v version
-h short help
-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
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
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
Earth as you were on the Moon).
-rand New random position at every refresh of screen
-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.
-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
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).
-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
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
-dlong or -accel option, the CPU cost of WMGlobe is
*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.
-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.
Default : 0°0'0
-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
rotation in 24 hours toward the west. By default,
-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
rotation in 24 hours toward the west. By default,
-dlong and -dlat are null. If they are used, the view
follow their values. Going back to "follow sun" mode
in parameters screen put -dlat and -dlong to zero.
-light light_value Level of light of the dark side when there is no
night map, from 0 to 1.
Default : 0.25
night map, from 0 to 1.
Default : 0.25
-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
at maximum contrast.
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
-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).
Default : 1.0
@ -195,22 +195,22 @@ Configuration is done through command line options.
Negative values for dates before 1970 accepted.
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 moon : put a marker under the Moon.
5 markers can be defined simultaneously, so you can
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
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.
-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)
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
their value. The TIME screen shows an approximation
of date and time of the earth zone currently displayed,
using GMT time + longitude offset, it's close to the
real local time by one or two hours. Others options
using GMT time + longitude offset, it's close to the
real local time by one or two hours. Others options
don't need more help. Intuitive they said...
Links : Some sites dealing with WindowMaker
Links : Some sites dealing with WindowMaker
-------------------------------------------
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
they are pretty low-res (400x200).
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
@ -311,7 +311,7 @@ Bugs
- if you use the --enable-single-icon compile time option of WindowMaker,
you can not display more than one WMGlobe.
- 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
continuing smoothly from 1901.
- Using WMGlobe at high speed through a LAN may induce some load on the net.
@ -319,8 +319,8 @@ Bugs
License
----------------------------------------
WMGlobe is Copyright (C) 1998,99,2000,2001 by Jerome Dumonteil and licensed
through the GNU General Public License.
WMGlobe is Copyright (C) 1998,99,2000,2001 by Jerome Dumonteil and licensed
through the GNU General Public 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
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
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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
.TH WMGlobe 1.3 "august 2001"
.SH NAME
WMGlobe - The Whole Earth spinning on you desktop...
WMGlobe - The Whole Earth spinning on you desktop...
as a dockable app for WindowMaker
.SH SYNOPSIS
.B wmglobe
@ -23,16 +23,16 @@ short help
Value > 1 to magnify the view, value < 1 to lower. Default: 1.0
.TP
.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 .
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.
.TP
.B \-sun
The point of view follows the Sun (default).
.TP
.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).
.TP
.B \-rand
@ -40,49 +40,49 @@ New random position at every refresh of screen.
.TP
.B \-map \fI map_file\fP
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.
.TP
.B \-nimap \fI night_file\fP
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
a default internal night file (see -nonimap option).
a default internal night file (see -nonimap option).
.TP
.B \-defnimap
Use the default night map (with a custom map).
.TP
.B \-nonimap
Don't use the default night map.
Don't use the default night map.
.TP
.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
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
-dlong or -accel option, the CPU cost of WMGlobe is
*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.
.TP
.B \-dlat \fI delta_latitude\fP
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.
Default: 0°0'0
.TP
.B \-dlong \fI delta_long\fP
Move the point of view by delta_long degrees per
second. With a value of -0°0'15" the earth make a full
rotation in 24 hours toward the west. By default,
.B \-dlong \fI delta_long\fP
Move the point of view by delta_long degrees per
second. With a value of -0°0'15" the earth make a full
rotation in 24 hours toward the west. By default,
-dlong and -dlat are null. If they are used, the view
follow their values. Going back to "follow sun" mode
in parameters screen put -dlat and -dlong to zero.
.TP
.B \-light \fI light_value\fP
Level of light of the dark side when there is no
night map, from 0 to 1.
Default: 0.25
night map, from 0 to 1.
Default: 0.25
.TP
.B \-dawn \fI dawn_value\fP
Level of continuity for dawn limit, from 0 to 1. With
@ -91,9 +91,9 @@ at maximum contrast.
Default: 0.2
.TP
.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
.TP
.TP
.B \-accel \fI time_multi\fP
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
@ -106,9 +106,9 @@ Negative values for dates before 1970 accepted.
Default: not set, use current time.
.TP
.B \-mk \fI latitude longitude\fP
Put a fixed marker at latitude/longitude.
-mk sun : put a marker under the Sun position.
-mk moon : put a marker under the Moon.
Put a fixed marker at latitude/longitude.
-mk sun : put a marker under the Sun position.
-mk moon : put a marker under the Moon.
5 markers can be defined simultaneously, so you can
use wmglobe to predict when Moon will meet the Sun :-)
.TP
@ -117,7 +117,7 @@ Move the earth image by dx dy pixels in the icon. See
puzzle.sh to understand why.
.TP
.B \-oz
Start in "austral" mode (for "down under" people)
Start in "austral" mode (for "down under" people)
.TP
.B \-stable
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
Select another display
.TP
.B \-w \-shape
Useless, since it is set by default (WMaker dockable
.B \-w \-shape
Useless, since it is set by default (WMaker dockable
application)
.SH "MOUSE OPTIONS"
.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
their value. The TIME screen shows an approximation
of date and time of the earth zone currently displayed,
using GMT time + longitude offset, it's close to the
real local time by one or two hours. Others options
using GMT time + longitude offset, it's close to the
real local time by one or two hours. Others options
don't need more help. Intuitive they said...
.SH "FILES"
.TP
.B MAPS
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
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
to use better ones.
You can get maps usable with WMGlobe on the net. See the links below.
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.
When using a night map, make sure that day and night map have the same
dimensions.
.TP
.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):
<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>
Xearth Homepage:
Xearth Homepage:
<http://www.cs.colorado.edu/~tuna/xearth/>
@ -200,16 +200,16 @@ The Window Maker User Guide
The Window Maker FAQ
.SH "AUTHOR"
jerome dumonteil <jerome.dumonteil@linuxfr.org>
jerome dumonteil <jerome.dumonteil@linuxfr.org>
Patches, bug reports, and suggestions are welcome.
.SH "CREDITS"
WMGlobe is Copyright (C) 1998,99 by Jerome Dumonteil and licensed through
the GNU General Public License.
WMGlobe is Copyright (C) 1998,99 by Jerome Dumonteil and licensed through
the GNU General Public License.
Read the COPYING file for the complete GNU license.
Original idea, tests, logos:
Original idea, tests, logos:
Sylvestre Taburet <Sylvestre.Taburet@free.fr>
@ -245,7 +245,7 @@ documentation.
The rendering engine is taken from XGlobe by Thorsten Scheuermann
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
@ -255,7 +255,7 @@ If you use the --enable-single-icon compile time option of WindowMaker,
you can not display more than one WMGlobe.
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
continuing smoothly from 1901.

View File

@ -24,7 +24,7 @@
---
* 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).
1.6

View File

@ -5,7 +5,7 @@ Compiling and installing wmisdn:
2. Type "make"
3. Copy the wmisdn binary to a directory of your choice
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
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
4. Type "chgrp net /dev/isdninfo /dev/isdnctrl* /sbin/isdnctrl"
5. Type "chmod g=rw /dev/isdninfo /dev/isdnctrl*"
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%).
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%).
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.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
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:
NoTitlebar = 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,
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.
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)
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
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.
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
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 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 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.
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.
Channel bundling (aka MPPP):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
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
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
lamp.
lamp.
Please note that starting a slave connection while the master is offline
automatically starts the master connection too. Respectively: stopping the
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.
The only effect you notice is that your connection becomes faster or slower,
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:
~~~~~~~~~~~~~~~~~
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.
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
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
@ -99,13 +99,13 @@ defualt setting 'auto' is assumed.
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,
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
the default setting if none specified.
If you want to monitor a slave device (for mppp), you should also specify
it using this option.
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
the default setting if none specified.
If you want to monitor a slave device (for mppp), you should also specify
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
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
@ -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
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
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).
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.
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
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
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
since they work fine and look good, I'm not planning to implement the same
things in wmisdn.
Credits:
--------
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
Tom Berger - for helping me with the very early version of wmisdn (0.1 :))
and giving good ideas (Dialing mode, etc)
@ -174,7 +174,7 @@ I should keep maintaining it.
---------------------------------
Tasho
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
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
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.
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
ippp-device and the second is the script mode.
two scripts recieve two parameters. The first one is the name of the
ippp-device and the second is the script mode.
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
@ -40,12 +40,12 @@ update web-page
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
the line
/usr/sbin/isdnctrl dial $1
/usr/sbin/isdnctrl dial $1
or
/usr/sbin/isdnctrl hangup $1
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.
Good luck and have fun!

View File

@ -7,11 +7,11 @@ struct region
int id;
int x, y, w, h;
bool enabled;
void (*mouse_in)( int );
void (*mouse_out)( int );
void (*mouse_click)( int, unsigned int );
struct region *next;
};
@ -36,7 +36,7 @@ void region_init( Display *_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) )
{
/* 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_out = mouse_out;
reg->mouse_click = mouse_click;
/* find the regioned_win and insert the new region into its list of regions */
struct regioned_window *reg_win = region_get_win(win);
reg->next = reg_win->first_reg;
@ -70,7 +70,7 @@ void region_disable( Window win, int id )
if( reg != NULL )
reg->enabled = false;
}
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 )
{
struct region *reg = region_get_win(win)->first_reg;
while( reg != NULL )
{
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 )
{
struct region *reg = region_get_win(win)->first_reg;
while( reg != NULL )
{
if( reg->id == id )
@ -132,18 +132,18 @@ static struct region *region_find( Window win, int id )
}
return NULL;
}
static struct regioned_window *region_get_win( Window win )
{
struct regioned_window *reg_win = regioned_windows;
while( reg_win != NULL )
{
if( reg_win->win == win )
return reg_win;
reg_win = reg_win->next;
}
reg_win = new regioned_window;
reg_win->win = win;
reg_win->first_reg = NULL;

View File

@ -6,7 +6,7 @@
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 region_enable( Window win, int id );

View File

@ -1,17 +1,17 @@
/* wmisdn - an ISDN monitor applet for windowmaker/afterstep
* Copyright (c) 2000-2001 Tasho Statev Kaletha
* tasho.kaletha@gmx.de
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
@ -271,19 +271,19 @@ int main(int argc, char *argv[])
return 1;
}
readScriptModes();
initXWin(argc, argv);
loadPixmaps();
createRegions();
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;
unsigned long gcm;
gcm = GCGraphicsExposures|GCBackground;
gcv.graphics_exposures = True;
gcv.background = getColor( WindowBackgroundColor );
gcv.graphics_exposures = True;
gcv.background = getColor( WindowBackgroundColor );
if( strlen(txtfont) != 0 )
{
textFont = XLoadQueryFont( dpy, txtfont );
@ -305,8 +305,8 @@ int main(int argc, char *argv[])
if(!(wmaker || ushape))
XSetClipMask(dpy, WinGC, dmsk);
else
XShapeCombineMask(dpy, Win[activeWin], ShapeBounding, 0, 0, dmsk, ShapeSet);
XShapeCombineMask(dpy, Win[activeWin], ShapeBounding, 0, 0, dmsk, ShapeSet);
XSetClipOrigin(dpy, WinGC, 0, 0);
XSetClipMask(dpy, WinGC, None);
@ -322,12 +322,12 @@ int main(int argc, char *argv[])
switch(event.type){
case ButtonPress : pressEvent(&event.xbutton); break;
case MotionNotify : motionEvent(&event.xmotion); break;
case ClientMessage :
if((Atom)event.xclient.data.l[0]==WM_DELETE_WINDOW)
finished=true;
break;
case Expose : exposeEvent( &event.xexpose ); break;
}
}
@ -407,43 +407,43 @@ void freeXWin()
void loadPixmaps()
{
createPixmap(cover_xpm, &coverPixmap, &dmsk );
createPixmap(dialing_xpm, &dialingPixmap, NULL );
createPixmap(unknown_xpm, &unknownPixmap, NULL );
createPixmap(disabled_xpm, &disabledPixmap, NULL );
createPixmap(dialing_xpm, &dialingPixmap, NULL );
createPixmap(unknown_xpm, &unknownPixmap, NULL );
createPixmap(disabled_xpm, &disabledPixmap, NULL );
createPixmap(off_xpm, &offPixmap, NULL );
createPixmap(incoming_xpm, &incomingPixmap, NULL );
createPixmap(outgoing_xpm, &outgoingPixmap, NULL );
createPixmap(bundling_xpm, &bundlingPixmap, NULL );
createPixmap(bundled_xpm, &bundledPixmap, NULL );
createPixmap(slave_xpm, &slavePixmap, NULL );
createPixmap(bundled_xpm, &bundledPixmap, NULL );
createPixmap(slave_xpm, &slavePixmap, NULL );
createPixmap(offline_xpm, &statusPixmaps[ISDN_USAGE_NONE], NULL );
createPixmap(raw_xpm, &statusPixmaps[ISDN_USAGE_RAW], NULL );
createPixmap(modem_xpm, &statusPixmaps[ISDN_USAGE_MODEM], NULL );
createPixmap(online_xpm, &statusPixmaps[ISDN_USAGE_NET], NULL );
createPixmap(voice_xpm, &statusPixmaps[ISDN_USAGE_VOICE], NULL );
createPixmap(fax_xpm, &statusPixmaps[ISDN_USAGE_FAX], NULL );
createPixmap(raw_xpm, &statusPixmaps[ISDN_USAGE_RAW], NULL );
createPixmap(modem_xpm, &statusPixmaps[ISDN_USAGE_MODEM], NULL );
createPixmap(online_xpm, &statusPixmaps[ISDN_USAGE_NET], NULL );
createPixmap(voice_xpm, &statusPixmaps[ISDN_USAGE_VOICE], NULL );
createPixmap(fax_xpm, &statusPixmaps[ISDN_USAGE_FAX], NULL );
createPixmap(lamps_xpm, &lampsPixmap, NULL );
createPixmap(info_sw_xpm, &infoSWPixmap, NULL );
createPixmap(lamps_sw_xpm, &lampsSWPixmap, NULL );
loadLeds( leds_xpm, &ledsPixmap, InfoTextColor, WindowBackgroundColor );
createPixmap(lamps_sw_xpm, &lampsSWPixmap, NULL );
loadLeds( leds_xpm, &ledsPixmap, InfoTextColor, WindowBackgroundColor );
}
void freePixmaps()
{
XFreePixmap(dpy, coverPixmap);
XFreePixmap(dpy, dialingPixmap);
XFreePixmap(dpy, coverPixmap);
XFreePixmap(dpy, dialingPixmap);
XFreePixmap(dpy, unknownPixmap);
XFreePixmap(dpy, disabledPixmap);
XFreePixmap(dpy, disabledPixmap);
XFreePixmap(dpy, offPixmap);
XFreePixmap(dpy, incomingPixmap);
XFreePixmap(dpy, outgoingPixmap);
XFreePixmap(dpy, bundlingPixmap);
XFreePixmap(dpy, bundledPixmap);
XFreePixmap(dpy, slavePixmap);
XFreePixmap(dpy, slavePixmap);
for( int i=ISDN_USAGE_NONE; i < ISDN_USAGE_FAX; i++ )
XFreePixmap( dpy, statusPixmaps[i] );
@ -451,14 +451,14 @@ void freePixmaps()
XFreePixmap(dpy, ledsPixmap);
XFreePixmap(dpy, lampsPixmap);
XFreePixmap(dpy, infoSWPixmap);
XFreePixmap(dpy, lampsSWPixmap);
XFreePixmap(dpy, lampsSWPixmap);
}
void createMainWin( Window *win )
{
*win = XCreateSimpleWindow(dpy, Root, 10, 10, MainWinDim.w, MainWinDim.h,0,0,0);
XClassHint classHint;
XClassHint classHint;
classHint.res_name = NAME;
classHint.res_class = CLASS;
XSetClassHint(dpy, *win, &classHint);
@ -471,8 +471,8 @@ void createInfoPanel( Window *win )
XSizeHints shints;
shints.flags = PPosition;
XSetWMNormalHints( dpy, *win, &shints );
XClassHint classHint;
XClassHint classHint;
classHint.res_name = "Info";
classHint.res_class = CLASS;
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_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_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_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, " -s shaped window\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, " -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, " -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" );
}
@ -546,7 +546,7 @@ void parseDeviceNames( char *name_list )
{
char *ptr1, *ptr2;
int i;
ptr1 = name_list;
for( i = 0; i < ISDN_MAX_CHANNELS; i++ )
@ -556,7 +556,7 @@ void parseDeviceNames( char *name_list )
ptr2 = &name_list[strlen(name_list)];
strncpy( devices[i], ptr1, ptr2-ptr1 );
devices[i][ptr2-ptr1] = 0;
devices[i+1][0] = 0;
devices[i+1][0] = 0;
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] );
if( ptr2[0] == 0 )
@ -564,12 +564,12 @@ void parseDeviceNames( char *name_list )
ptr1 = ptr2+1;
}
}
bool scanArgs(int argc, char *argv[])
{
bool dialmode_set = false;
for(int i=1;i<argc;i++)
{
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 )
dialmode = ISDN_NET_DM_MANUAL;
else {
fprintf( stderr, "Unknown dial mode \"%s\"\n", argv[i] );
fprintf( stderr, "Unknown dial mode \"%s\"\n", argv[i] );
return false;
}
dialmode_set = true;
@ -659,7 +659,7 @@ bool scanArgs(int argc, char *argv[])
fprintf( stderr, "Unknown option \"%s\"\n", argv[i] );
return false;
}
}
if( !dialmode_set )
isdnInitDefaultDialmode();
@ -669,7 +669,7 @@ bool scanArgs(int argc, char *argv[])
devices[1][0] = 0;
selected_device = 0;
}
return true;
}
@ -690,7 +690,7 @@ void readScriptModes()
scriptmodestrings = (char **)malloc( sizeof(char*) );
scriptmodestrings[0] = (char *)malloc( sizeof("go online") );
strcpy(scriptmodestrings[0], "go online" );
if( f != NULL )
if( f != NULL )
fclose(f);
return;
}
@ -708,7 +708,7 @@ void readScriptModes()
} while( fgets(buf,sizeof(buf),f) != NULL );
fclose(f);
}
void advanceScriptMode()
{
scriptmode++;
@ -717,7 +717,7 @@ void advanceScriptMode()
update();
}
/* press event
/* press event
* - if a lamp is pressed then the corresponding actions are taken.
* - 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 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 );
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 )
@ -809,10 +809,10 @@ void mouseClickInfoSw( int id, unsigned int button )
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;
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 )
@ -837,7 +837,7 @@ void activateLamps( bool active )
{
drawLamp( 0, INACTIVE );
drawLamp( 1, INACTIVE );
drawLamp( 2, INACTIVE );
drawLamp( 2, INACTIVE );
region_enable( Win[activeWin], ID_LAMP_GREEN );
region_enable( Win[activeWin], ID_LAMP_YELLOW );
region_enable( Win[activeWin], ID_LAMP_RED );
@ -861,13 +861,13 @@ void drawSwitches()
void mouseInDevice( int id )
{
drawDevice(ACTIVE);
repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h );
repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h );
}
void mouseOutDevice( int id )
{
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 )
@ -905,17 +905,17 @@ void getWindowPosition( Window win, int *x, int *y )
{
XWindowAttributes winAttr;
Window dummy;
XGetWindowAttributes( dpy, win, &winAttr );
XTranslateCoordinates( dpy, win, winAttr.root,
-winAttr.border_width, -winAttr.border_width,
XTranslateCoordinates( dpy, win, winAttr.root,
-winAttr.border_width, -winAttr.border_width,
x, y, &dummy );
}
void getWindowDimension( Window win, int *w, int *h )
{
XWindowAttributes winAttr;
XGetWindowAttributes( dpy, win, &winAttr );
XGetWindowAttributes( dpy, win, &winAttr );
*w = winAttr.width;
*h = winAttr.height;
}
@ -928,11 +928,11 @@ void repaint( Window win, int x, int y, int w, int h )
else if( win == Win[2] )
src = disp_info;
else {
syslog( LOG_DEBUG, "Oops! Unknown window given to repaint\n" );
syslog( LOG_DEBUG, "Oops! Unknown window given to repaint\n" );
return;
}
//bade code end
XCopyArea( dpy, src, win, WinGC, x, y, w, h, x, y );
XFlush(dpy);
}
@ -968,14 +968,14 @@ void update()
repaint( Win[activeWin], 0, 0, MainWinDim.w, MainWinDim.h );
}
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()
{
Pixmap statusPixmap, directionPixmap;
if( curStatus.usage > ISDN_USAGE_NONE && curStatus.usage <= ISDN_USAGE_FAX )
{
statusPixmap = statusPixmaps[curStatus.usage];
@ -989,13 +989,13 @@ void setStatusPixmap()
}
}
else {
switch( curStatus.usage )
switch( curStatus.usage )
{
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_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;
}
directionPixmap = 0;
@ -1003,9 +1003,9 @@ void setStatusPixmap()
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);
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 */
void updateInfoPanel()
{
@ -1026,11 +1026,11 @@ void updateInfoPanel()
getRemoteIP( &a, &b, &c, &d );
sprintf( line, "remote ip: %d.%d.%d.%d", a, b, c, d );
drawText( line, disp_info, 5, 35 );
}
}
else if( curStatus.usage == STAT_OFF )
drawText( "dialing disabled", disp_info, 5, 5 );
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 )
{
drawText( "not connected", disp_info, 5, 5 );
@ -1061,12 +1061,12 @@ unsigned long getColor( const char *colorname )
color.flags=DoRed | DoGreen | DoBlue;
XAllocColor(dpy, winattr.colormap, &color);
return color.pixel;
}
}
void createPixmap(char *data[], Pixmap *image, Pixmap *mask )
{
XpmAttributes pixatt;
pixatt.exactColors=false;
pixatt.closeness=40000;
pixatt.valuemask=XpmExactColors | XpmCloseness | XpmSize;
@ -1077,18 +1077,18 @@ void loadLeds( char *data[], Pixmap *image, const char *led_color, const char *b
{
XpmAttributes pixatt;
unsigned long color[4];
color[0] = mixColor(led_color, 0, back_color, 100);
color[1] = mixColor(led_color, 100, back_color, 0);
color[2] = mixColor(led_color, 60, back_color, 40);
color[3] = mixColor(led_color, 25, back_color, 75);
XpmColorSymbol xpmcsym[4]={{"led_color_back", NULL, color[0] },
{"led_color_high", NULL, color[1]},
{"led_color_med", NULL, color[2]},
{"led_color_low", NULL, color[3]}};
pixatt.numsymbols = 4;
pixatt.colorsymbols = xpmcsym;
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 )
{
int disp_x, disp_y, lamp_x=0;
disp_x = LampsRect[lamp].pos.x;
disp_y = LampsRect[lamp].pos.y;
/* find the offset of the lamp pixmap in the pixmap of all lamps */
for( int i=0; i < lamp; i++ )
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 );
}
@ -1178,7 +1178,7 @@ void isdnInitDefaultDialmode()
dialmode = cfg.dialmode;
else
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 */
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 );
return -1;
}
int res = ioctl( fd, func, arg );
if( res == -1 && errmsg != NULL )
syslog( LOG_NOTICE, "%s : %m\n", errmsg );
syslog( LOG_NOTICE, "%s : %m\n", errmsg );
close(fd);
return res;
}
@ -1208,12 +1208,12 @@ inline void isdn_dial()
{
if( !usescripts )
isdn_ioctl( IIOCNETDIL, devices[selected_device], "Couldn't dial" );
else
else
{
int handle;
char command[MAX_ARG_LEN];
strcpy(command, scriptpath);
strcat(command, "/");
strcat(command, SCRIPT_UP);
@ -1225,22 +1225,22 @@ inline void isdn_dial()
system(command);
}
}
update();
update();
}
inline void isdn_hangup()
{
if( !usescripts )
isdn_ioctl( IIOCNETHUP, devices[selected_device], "Couldn't hang up" );
else
else
{
int handle;
char command[MAX_ARG_LEN];
strcpy(command, scriptpath);
strcat(command, "/");
strcat(command, SCRIPT_DOWN);
if ((handle = open(command, O_RDONLY)) == -1)
syslog( LOG_NOTICE, "Couldn't open %s : %m\n", SCRIPT_DOWN );
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
* - yellow ends the connection and sets the device in dial_auto 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 )
{
/* middle button - just change the script mode */
if( button == 2 )
if( button == 2 )
{
advanceScriptMode();
advanceScriptMode();
return;
}
/* 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( curStatus.usage == STAT_DIALING || curStatus.usage == ISDN_USAGE_NET )
return;
if( curStatus.usage == STAT_OFF )
isdn_enable();
isdn_dial();
if( curStatus.usage == STAT_OFF )
isdn_enable();
isdn_dial();
}
}
inline void _pressYellowLamp( int button )
{
if( curStatus.usage == ISDN_USAGE_NONE )
if( curStatus.usage == ISDN_USAGE_NONE )
return;
if( curStatus.usage == STAT_OFF )
isdn_enable();
else
isdn_enable();
else
{
if( (button == 3) || (button == 1) && (curStatus.mpppMode == master) )
isdn_hangup_slave( devices[selected_device] );
@ -1366,10 +1366,10 @@ inline void _pressYellowLamp( int button )
inline void _pressRedLamp( int button )
{
if( (curStatus.usage == STAT_OFF) || (button != 1) )
if( (curStatus.usage == STAT_OFF) || (button != 1) )
return;
_pressYellowLamp( button );
isdn_disable();
isdn_disable();
}
void pressLamp( int lamp_id, int button )
@ -1391,7 +1391,7 @@ void pressStatusSw()
{
seteuid( rootUID );
setegid( rootGID );
if( curStatus.usage == ISDN_USAGE_NONE )
_pressGreenLamp(1);
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);
close(fd);
translateIP( &(ifr.ifr_ifru.ifru_addr), a, b, c, d );
if( res != 0 )
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;
int fd = socket( AF_INET, SOCK_DGRAM, 0 );
strcpy( ifr.ifr_ifrn.ifrn_name, devices[selected_device] );
ifr.ifr_ifru.ifru_addr.sa_family = AF_INET;
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 *ptr;
ptr = strstr( all_data, key );
if( ptr == NULL )
{
@ -1471,7 +1471,7 @@ bool getPeerPhone( char *ippp, char *phone )
{
isdn_net_ioctl_phone ippp_phone;
int res;
strcpy( ippp_phone.name, ippp );
res = isdn_ioctl( IIOCNETGPN, &ippp_phone, NULL, "/dev/isdninfo" );
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 )
{
stat->mpppMode = none;
stat->mpppMode = none;
if( strlen(cfg->master) != 0 )
{
stat->mpppMode = slave;
@ -1510,14 +1510,14 @@ void getMPPPSettings( isdn_net_ioctl_cfg *cfg, isdnStatus *stat )
strcpy( stat->mpppPartner, cfg->slave );
}
}
/* get the status of the ippp device:
*
/* get the status of the ippp device:
*
* - isOff if dialing is disabled
* - isOffline if dialing is enabled but no connection is established
* - isOnline if device has established a connection
* - 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 )
{
@ -1539,7 +1539,7 @@ void getStatus( char *device, isdnStatus *stat )
stat->usage = STAT_UNKNOWN;
stat->direction = INCOMING;
if( res == -1 )
{
warning_count++;
@ -1552,8 +1552,8 @@ void getStatus( char *device, isdnStatus *stat )
stat->usage = ISDN_USAGE_NONE;
stat->bundled = false;
getMPPPSettings( &cfg, stat );
getMPPPSettings( &cfg, stat );
/* read the device flags from /dev/isdninfo */
fd = open( "/dev/isdninfo", O_RDONLY|O_NDELAY );
if( fd == -1 )
@ -1578,21 +1578,21 @@ void getStatus( char *device, isdnStatus *stat )
return;
if( !extractIsdnInfoData( buf, "usage:", channel_info ) )
return;
channel_usage = atoi(channel_info[channel]);
if( (channel_usage & ISDN_USAGE_DISABLED) != 0 )
stat->usage = STAT_DISABLED;
else
stat->usage = channel_usage & ISDN_USAGE_MASK;
stat->direction = (channel_usage & ISDN_USAGE_OUTGOING) == 0 ? INCOMING : OUTGOING;
/* check if device is still dialing or already online */
if( stat->usage == ISDN_USAGE_NET )
{
if( !extractIsdnInfoData( buf, "flags:", channel_info ) )
return;
if( ((atoi(channel_info[0]) >> channel) & 1) == 0 )
stat->usage = STAT_DIALING;
}
@ -1601,8 +1601,8 @@ void getStatus( char *device, isdnStatus *stat )
{
isdnStatus 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) )
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.
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
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
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),
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
*** 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 ***
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
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,
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:
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

View File

@ -3,7 +3,7 @@ Installation instructions for wmjiface.
Requirements
---------------------------------------------------------------------------
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

View File

@ -1,6 +1,6 @@
ifacechck is the program called by wmjiface to get your
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,
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`;
foreach (@statusFiles) {
s/^.*[.]wmjiface[.]stat[.]//;
s/^.*[.]wmjiface[.]stat[.]//;
chomp;
system("rm $ENV{HOME}/.wmjiface.stat.$_") if not ( -d "/proc/$_" );
}
@ -66,8 +66,8 @@ sub write_stat() {
printf sta "%i\n", $now;
foreach (keys %statsc) {
printf sta "%s:%i:%i:%i:%i:%i\n",
$_,
printf sta "%s:%i:%i:%i:%i:%i\n",
$_,
$statsc{$_}{bytesi},
$statsc{$_}{byteso},
$statsc{$_}{packetsi},
@ -80,7 +80,7 @@ sub write_stat() {
sub read_stat() {
open sta, "$staname" or return ();
$then = <sta>;
$then = <sta>;
chomp $then;
while(<sta>) {
@ -113,12 +113,12 @@ sub read_proc() {
s/([0-9]+)([0-9]{9})/$2/g;
($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
) = split ":";
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;
$tosser =~ s/^[^-]*-//;
$tosser =~ s/.dev:.*//;

View File

@ -12,7 +12,7 @@ int main(int argc, char **argv) {
initXwindow(argc, argv);
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"
);
@ -37,11 +37,11 @@ int main(int argc, char **argv) {
RedrawWindow();
break;
case EnterNotify:
XSetInputFocus(display,
XSetInputFocus(display,
PointerRoot, RevertToParent, CurrentTime);
break;
case LeaveNotify:
XSetInputFocus(display,
XSetInputFocus(display,
PointerRoot, RevertToParent, CurrentTime);
break;
}

View File

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

View File

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

View File

@ -22,7 +22,7 @@ $staname="$ENV{HOME}/.wmjiface.stat.$ppid";
@statusFiles=`ls $ENV{HOME}/.wmjiface.stat.* 2>/dev/null`;
foreach (@statusFiles) {
s/^.*[.]wmjiface[.]stat[.]//;
s/^.*[.]wmjiface[.]stat[.]//;
chomp;
system("rm $ENV{HOME}/.wmjiface.stat.$_") if not ( -d "/proc/$_" );
}
@ -71,8 +71,8 @@ sub write_stat() {
printf sta "%i\n", $now;
foreach (keys %statsc) {
printf sta "%s:%i:%i:%i:%i:%i\n",
$_,
printf sta "%s:%i:%i:%i:%i:%i\n",
$_,
$statsc{$_}{bytesi},
$statsc{$_}{byteso},
$statsc{$_}{packetsi},
@ -85,7 +85,7 @@ sub write_stat() {
sub read_stat() {
open sta, "$staname" or return ();
$then = <sta>;
$then = <sta>;
chomp $then;
while(<sta>) {
@ -125,12 +125,12 @@ sub read_proc() {
s/([0-9]+)([0-9]{9})/$2/g;
($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
) = split ":";
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;
$tosser =~ s/^[^-]*-//;
$tosser =~ s/.dev:.*//;

View File

@ -32,7 +32,7 @@ void show_help() {
void setup(int argc, char** argv) {
//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;
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);
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 = ' '; }
display += 0.5; /* Round Up */
display += 0.5; /* Round Up */
if(!bps_) { color = BLUE; }
else if(bps_ < hw1) { /* 2000 default */ color = GREEN; }
else if(bps_ < hw2) { /* 4000 default */ color = YELLOW; }
if(!bps_) { color = BLUE; }
else if(bps_ < hw1) { /* 2000 default */ color = GREEN; }
else if(bps_ < hw2) { /* 4000 default */ color = YELLOW; }
else { color = RED; }
if(letter=='k' && display<100) {
jpprintf(6, row, color, "%.1f", display);
} else {
jpprintf(6, row, color, "%.0f", display);
if(letter=='k' && display<100) {
jpprintf(6, row, color, "%.1f", display);
} else {
jpprintf(6, row, color, "%.0f", display);
}
jprintf(ORANGE, "%c", letter);
@ -124,7 +124,7 @@ void do_update() {
while(1 + fscanf(f, "%s%i%i", iface, &bps_in, &bps_out)) {
if(use_expavg) {
exp_avg[IN][c] =
exp_avg[IN][c] =
(Fal0d(bps_in)*bps_in) + (1-Fal0d(bps_in))*exp_avg[IN][c];
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 {
if(row > 5) break;
do_print_one_dev(
iface,
(out) ? 'o':'i',
(out) ? toshow_out : toshow_in,
iface,
(out) ? 'o':'i',
(out) ? toshow_out : toshow_in,
row++
);
}
@ -157,7 +157,7 @@ void do_update() {
void do_expose() {
do_update();
}
void do_button_release() {
do_update();
}

View File

@ -1,10 +1,10 @@
/*
* 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
* 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 <stdio.h>
#include <string.h>
@ -42,7 +42,7 @@
/*
* X11 Variables
* X11 Variables
*/
int x_fd;
XSizeHints mysizehints;
@ -85,7 +85,7 @@ static int flush_expose(Window w) {
* RedrawWindowXY
*/
void RedrawWindow(void) {
flush_expose(iconwin);
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) {
flush_expose(iconwin);
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
*/
void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits,
int pixmask_width, int pixmask_height, char *BackColor, char *LabelColor,
void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits,
int pixmask_width, int pixmask_height, char *BackColor, char *LabelColor,
char *WindGustColor, char *DataColor, char *StationTimeColor) {
unsigned int borderwidth = 1;
@ -183,9 +183,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
{"StationTimeColor", NULL, 0} };
/*
/*
* Create Pixmap
*/
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.exactColors = False;
wmgen.attributes.closeness = 40000;
wmgen.attributes.valuemask = XpmReturnPixels | XpmReturnExtensions | XpmColorSymbols
wmgen.attributes.valuemask = XpmReturnPixels | XpmReturnExtensions | XpmColorSymbols
| XpmExactColors | XpmCloseness | XpmSize;
if (XpmCreatePixmapFromData(display, Root, pixmap_bytes,
if (XpmCreatePixmapFromData(display, Root, pixmap_bytes,
&(wmgen.pixmap), &(wmgen.mask), &(wmgen.attributes)) != XpmSuccess){
fprintf(stderr, "Not enough free colorcells.\n");
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.x = 0;
@ -223,19 +223,19 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
mysizehints.width = 64;
mysizehints.height = 64;
win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y,
mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix);
/*
* Activate hints
/*
* Activate hints
*/
XSetWMNormalHints(display, win, &mysizehints);
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
* it after you are done...
*/
XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask
| PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask
XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask
| PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask
| KeyPressMask | KeyReleaseMask);
XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask
| PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask
XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask
| PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask
| KeyPressMask | KeyReleaseMask);
@ -266,8 +266,8 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
XSetWMName(display, win, &name);
/*
* Create Graphics Context (GC) for drawing
/*
* Create Graphics Context (GC) for drawing
*/
gcm = GCForeground | GCBackground | GCGraphicsExposures;
gcv.foreground = fore_pix;

View File

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