README cleanup, a little reordering in magic.c for readability

This commit is contained in:
Neale Pickett 2008-04-24 11:31:37 -06:00
parent 45ebdf19b7
commit b69bb4c0b4
2 changed files with 14 additions and 21 deletions

23
README
View File

@ -1,8 +1,8 @@
== xss ==
[xss](http://woozle.org/~neale/src/xss) is a suite of X screensaver
utilities. With them, you can use shell scripts to glue the tools
together to build your own screen saver and/or locker. You can use any
utilities. You can use shell scripts to glue the tools together to
build your own screen saver and/or locker. You can use any
`xscreensaver` hack instead of the built-in `magic` hack, or you can use
`xlock` if you prefer.
@ -27,7 +27,7 @@ stdout.
`xbell` sounds the X server's bell.
`magic` is a reimplementation of the "magic" screen saver from After
Dark. It probably doesn't work with an 8-bit color pallette.
Dark. It might look weird at 8bpp.
Examples
@ -35,20 +35,19 @@ Examples
Tell the X server to launch the screen saver after 90 seconds idle:
xset s 90
$ xset s 90
Run like `xautolock`:
xss xlock -mode qix &
$ xss xlock -mode qix &
Just run a screen saver, don't lock
xss -w /usr/lib/xscreensaver/deco -window-id XSS_WINDOW
$ xss -w /usr/lib/xscreensaver/deco -window-id XSS_WINDOW &
Launch a program called "screenlock" when you're idle:
xss screenlock
$ xss screenlock &
An simple "screenlock" script:
@ -94,14 +93,6 @@ git repository:
git clone http://woozle.org/~neale/repos/xss/
Bugs
----
* Sometimes `xss` quits launching anything. I suspect it's not getting
SIGCHLD for some reason.
* `magic` is probably abusing the X protocol, and may buy the farm after
a few hours.
History
-------

12
magic.c
View File

@ -167,17 +167,17 @@ main(int argc, char * const argv[])
XGCValues values;
XColor color;
gc = XCreateGC(display, w, 0, &values);
if (! XSetBackground(display, gc, BlackPixel(display, screen))) break;
sum(red, red, dred, 65536);
sum(green, green, dgreen, 65536);
sum(blue, blue, dblue, 65536);
color.red = red;
color.green = green;
color.blue = blue;
if (! XAllocColor(display, DefaultColormap(display, screen), &color)) break;
if (! XSetForeground(display, gc, color.pixel)) break;
values.background = BlackPixel(display, screen);
values.foreground = color.pixel;
gc = XCreateGC(display, w, GCBackground | GCForeground, &values);
(void)memcpy(segments + 0, lines + j, sizeof(XSegment));
(void)memcpy(segments + 1, lines + j, sizeof(XSegment));
@ -196,8 +196,10 @@ main(int argc, char * const argv[])
segments[1].x2 = width - segments[0].x2;
XDrawSegments(display, (Drawable)w, gc, segments, 2);
if (! XFreeColors(display, DefaultColormap(display, screen), &(color.pixel), 1, 0)) break;
/* Freeing the color while the line is still visible may look
wonky at 8bpp */
(void)XFreeGC(display, gc);
if (! XFreeColors(display, DefaultColormap(display, screen), &(color.pixel), 1, 0)) break;
XSync(display, True);
(void)nanosleep(&req, NULL);