/*
 * This hides the X cursor. Twas a dodgy hack to begin with and that's how it
 * will end.
 *
 * Do what you like with the code, it took 2 minutes to write.
 *
 * Don't come running back to me if it kills you or your pets or your mouse,
 * etc.
 *
 * <bernard@blackham.com.au>
 *
 */

#include <X11/Xlib.h>
#include <stdio.h>
#include <limits.h>

int main(void) {
	Pixmap blank;
	XColor dummy;
	char data[1] = {0};
	Cursor cursor;
	Display* dpy;
	dpy = XOpenDisplay(XDisplayName(NULL));

	/* make a blank cursor */
	blank = XCreateBitmapFromData (dpy, DefaultRootWindow(dpy), data, 1, 1);
	if (blank == None) {
		fprintf(stderr, "error: out of memory.\n");
		return 1;
	}
	cursor = XCreatePixmapCursor(dpy, blank, blank, &dummy, &dummy, 0, 0);
	XFreePixmap (dpy, blank);
	XGrabPointer(dpy, DefaultRootWindow(dpy), 0, 0, GrabModeSync, 
			GrabModeAsync, 0, cursor, CurrentTime);
	
	for(;;) usleep(INT_MAX);

	return 0;
}

