[comp.windows.x] Changing X default cursor

tpc@leibniz.UUCP (Tom Chmara) (09/15/88)

There is interest among some of the users here to personalize, if you will,
their X environments to the extent of changing the default "X" cursor to
something more dear to their hearts: a coffee mug, a beer mug, whatever.
Is there a way to do this (xset, xinit, Xsun, etc do not seem to have any
relevant option; I tried "fc" in Xsun and got a blank cursor instead...
this option presumably defines a cursor file, not a specific image in the
cursor font file).
Is there any way to do this?  Will I break someone's {heart|software|copyright|
law} if I do so?  Is such a change user-configurable (note that recompiling
the server with another DefaultCursorFont is not what I mean by user-config)
	Thanks for your time...
		---tpc---
-- 
I am sole owner of the above opinions. Licensing inquiries welcome.
------------------------------------------------------------------------
Tom Chmara			UUCP:  ..utgpu!bnr-vpa!bnr-di!leibniz!tpc
BNR Ltd.  			BITNET: TPC@BNR.CA

swick@ATHENA.MIT.EDU (Ralph R. Swick) (09/16/88)

Changing the default cursorfont is NOT the way to do it.  If your
favorite cursor is in a bitmap(1) file, you can use xsetroot -cursor
to change it.  Otherwise, you can adapt the following to your needs:

#include <X11/Xlib.h>
#include <X11/cursorfont.h>

main()
{
    Display *dpy = XOpenDisplay("");
    unsigned long mask = CWCursor;
    XSetWindowAttributes attr;
    attr.cursor = XCreateFontCursor(dpy, XC_hand2);
    XChangeWindowAttributes(dpy, DefaultRootWindow(dpy), mask, &attr);
    XCloseDisplay(dpy);
}