XIDEFINECURSOR(3)
π XIDEFINECURSOR π
okay bestie, welcome to the manual page for XIDefineCursor and XIUndefineCursor β the dynamic duo that lets you define device cursors, fr fr. yes we're in section 3, we're deep in library-call territory, and yes it's giving iconic. π
β¨ SYNOPSIS β¨
first things first, you gotta pull in the header or nothing works, obviously:
#include <X11/extensions/XInput2.h>
and here are the two functions, looking all cute and official:
int XIDefineCursor( Display *display,
int deviceid,
Window win,
Cursor cursor);
int XIUndefineCursor( Display *display,
int deviceid,
Window win);
the arguments, explained with love π«Ά
cursorβ the cursor that's gonna be displayed. orNone, if you're feeling mysterious. (specifies the cursor that is to be displayed orNone.)deviceidβ the device whose cursor we're changing up. glow-up time.displayβ the connection to the X server. your link to the mothership.winβ the window. that's it, that's the whole vibe.
πΈ DESCRIPTION πΈ
so here's the tea. if a cursor is set, it gets used when the device's pointer is inside the window. simple! and if the cursor is None? that's literally equivalent to calling XIUndefineCursor. same energy, different spelling. π
now, the deviceid must be a master pointer device. if it's not? boom, a BadDevice error gets returned at you. no cap. β οΈ
XIDefineCursor can generate BadDevice, BadCursor and BadWindow. yes, three whole errors. she's versatile like that. π
XIUndefineCursor undoes the effect of a previous XIDefineCursor for this window. so once the pointer is in the window, the window's default cursor gets used now. and if there's no default cursor defined? then the parent's cursor for this device gets used (if defined), or the parent's default cursor gets used. it's a whole fallback chain, bestie. it's giving "we'll figure it out". π
and here's the part where you go "oh so it's just the normal ones but extra": XIDefineCursor and XIUndefineCursor are identical to XDefineCursor and XUndefineCursor β except they specify the device explicitly. that's the whole plot twist. π
XIUndefineCursor can generate a BadDevice and a BadWindow error. two errors, still slaying.
π DIAGNOSTICS π
the errors you might run into, and what they mean. read them, memorize them, avoid them. β¨
BadCursorβ a value for a cursor argument does not name a defined cursor. like calling a name that nobody answers to. πBadDeviceβ an invalid device was specified. the device does not exist, or it's not a pointer device. it's simply not that girl.BadWindowβ a value for a Window argument does not name a defined window. wrong window, bestie, try again.
See also
XDefineCursorXUndefineCursor
the OGs. go read them too, iykyk. π
okay that's the whole page, no notes, you ate that π and just so you know β this masterpiece is from the XInput2 era, stamped 05/18/2026, and it was XIDEFINECURSOR(3) the whole time. periodt. πβ¨
π¦ where this page comes from
- fedora 44: libXi-devel 1.8.3-1.fc44 Β· MIT-open-group AND SMLNJ AND MIT
- fedora 44: libXi-devel 1.8.3-1.fc44 Β· MIT-open-group AND SMLNJ AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms