wmload: Incorporate changes from asload-0.9.3.
Obtained from [1]. [1] http://tigr.net/afterstep/download/asload/asload-0.9.3.tar.gz
This commit is contained in:
parent
746c64c377
commit
eec170c034
|
@ -1,3 +1,10 @@
|
||||||
|
VERSION: 0.9.3
|
||||||
|
RELEASE DATE: 03 March 2000 (sashav@sprintmail.com)
|
||||||
|
-added range check for values. It seems that on 2.3 kernels
|
||||||
|
time can go backwards :)
|
||||||
|
-Destroying Icon window prior to main window to avoid shutdown
|
||||||
|
time errors
|
||||||
|
|
||||||
VERSION: 0.9.2
|
VERSION: 0.9.2
|
||||||
RELEASE DATE: 17 July 1997
|
RELEASE DATE: 17 July 1997
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#define major_VER 0
|
#define major_VER 0
|
||||||
#define minor_VER 9
|
#define minor_VER 9
|
||||||
#define patch_VER 2
|
#define patch_VER 3
|
||||||
#define MW_EVENTS (ExposureMask | ButtonPressMask | StructureNotifyMask)
|
#define MW_EVENTS (ExposureMask | ButtonPressMask | StructureNotifyMask)
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#define Shape(num) (ONLYSHAPE ? num-5 : num)
|
#define Shape(num) (ONLYSHAPE ? num-5 : num)
|
||||||
|
@ -105,6 +105,7 @@ int main(int argc,char *argv[])
|
||||||
XTextProperty name;
|
XTextProperty name;
|
||||||
XClassHint classHint;
|
XClassHint classHint;
|
||||||
Pixmap pixmask;
|
Pixmap pixmask;
|
||||||
|
Atom _XA_WM_DELETE_WINDOW = None;
|
||||||
Geometry = "";
|
Geometry = "";
|
||||||
mywmhints.initial_state = NormalState;
|
mywmhints.initial_state = NormalState;
|
||||||
|
|
||||||
|
@ -169,7 +170,8 @@ int main(int argc,char *argv[])
|
||||||
Root = RootWindow(dpy, screen);
|
Root = RootWindow(dpy, screen);
|
||||||
d_depth = DefaultDepth(dpy, screen);
|
d_depth = DefaultDepth(dpy, screen);
|
||||||
x_fd = XConnectionNumber(dpy);
|
x_fd = XConnectionNumber(dpy);
|
||||||
|
_XA_WM_DELETE_WINDOW = XInternAtom (dpy, "WM_DELETE_WINDOW", False);
|
||||||
|
|
||||||
/* Convert XPM Data to XImage */
|
/* Convert XPM Data to XImage */
|
||||||
GetXPM();
|
GetXPM();
|
||||||
|
|
||||||
|
@ -231,6 +233,7 @@ int main(int argc,char *argv[])
|
||||||
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint
|
mywmhints.flags = StateHint | IconWindowHint | IconPositionHint
|
||||||
| WindowGroupHint;
|
| WindowGroupHint;
|
||||||
XSetWMHints(dpy, win, &mywmhints);
|
XSetWMHints(dpy, win, &mywmhints);
|
||||||
|
XSetWMProtocols (dpy, win, &_XA_WM_DELETE_WINDOW, 1);
|
||||||
|
|
||||||
XMapWindow(dpy,win);
|
XMapWindow(dpy,win);
|
||||||
InitLoad();
|
InitLoad();
|
||||||
|
@ -261,12 +264,17 @@ int main(int argc,char *argv[])
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
system(Execute);
|
system(Execute);
|
||||||
break;
|
break;
|
||||||
|
case ClientMessage:
|
||||||
|
if ((Event.xclient.format != 32) ||
|
||||||
|
(Event.xclient.data.l[0] != _XA_WM_DELETE_WINDOW))
|
||||||
|
break;
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
XFreeGC(dpy, NormalGC);
|
XFreeGC(dpy, NormalGC);
|
||||||
XDestroyWindow(dpy, win);
|
|
||||||
XDestroyWindow(dpy, iconwin);
|
XDestroyWindow(dpy, iconwin);
|
||||||
|
XDestroyWindow(dpy, win);
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
break ;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -433,10 +441,11 @@ void GetLoad(int Maximum, int *usr, int *nice, int *sys, int *free)
|
||||||
cp_time[2] = strtoul(p, &p, 0); /* system */
|
cp_time[2] = strtoul(p, &p, 0); /* system */
|
||||||
cp_time[3] = strtoul(p, &p, 0); /* idle */
|
cp_time[3] = strtoul(p, &p, 0); /* idle */
|
||||||
|
|
||||||
*usr = cp_time[0] - last[0];
|
if( (*usr = cp_time[0] - last[0]) < 0 ) *usr = 0 ;
|
||||||
*nice = cp_time[1] - last[1];
|
if( (*nice = cp_time[1] - last[1]) < 0 ) *nice = 0 ;
|
||||||
*sys = cp_time[2] - last[2];
|
if( (*sys = cp_time[2] - last[2]) < 0 ) *sys = 0 ;
|
||||||
*free = cp_time[3] - last[3];
|
if( (*free = cp_time[3] - last[3]) < 0 ) *free = 0 ;
|
||||||
|
|
||||||
total = *usr + *nice + *sys + *free;
|
total = *usr + *nice + *sys + *free;
|
||||||
|
|
||||||
last[0] = cp_time[0];
|
last[0] = cp_time[0];
|
||||||
|
|
Loading…
Reference in a new issue