X Cursors and Gumby

May 14, 2012

I've been playing around with Xlib lately and I found out that X11 comes with a great set of cursors included by default. I was pretty excited when I found out the X developers decided to throw Gumby into the mix! Look at this cursor here:

Gumby X Cursor Light Gumby X Cursor Dark

Yep Gumby is included in Xlib. Check out cursor number 56 in Xlib Appendix B: X Font Cursors which defines XC_gumby. Gumby can be used in an Xlib program like this:

//Assumes you have previously defined display and window
Cursor cursor;
cursor = XCreateFontCursor(display, 56);
XDefineCursor(display, *window, cursor);

XCreateFontCursor(), part of Xlib, takes in two parameters: your display (type Display) and the shape for the cursor (type unsigned int). XCreateFontCursor() gives you a variable (of type Cursor) which you can use with XDefineCursor() to set the cursor for the given display and window.

In anycase, I just wanted to share this and thank the X developers for including Gumby as a standard cursor! He'll come in use.