XColormapEvent(3)
π XColormapEvent(3) β bestie's guide to the ColormapNotify event π
okay so this is a page straight out of the XLIB FUNCTIONS section of the Xlib manual, and it's lowkey one of the cutest little event structs. it's giving "small but knows everything about your colormap" energy. let's get into it π«Ά
β¨ NAME β¨
XColormapEvent β the ColormapNotify event structure. that's it, that's the whole vibe π
π STRUCTURES π
so the structure for ColormapNotify events contains this, and yes you're gonna want to screenshot it bestie:
typedef struct {
int type; /* ColormapNotify */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window;
Colormap colormap; /* colormap or None */
Bool new;
int state; /* ColormapInstalled, ColormapUninstalled */
} XColormapEvent;
when you receive this event, the structure members get set like this. buckle up, we're going field by field πΈ
π the members, one at a time
the type member is set to the event type constant name that uniquely identifies it. like, for example, when the X server reports a GraphicsExpose event to a client application, it sends an XGraphicsExposeEvent structure with the type member set to GraphicsExpose. see how that works? iconic behavior honestly β¨
the display member is set to a pointer to the display the event was read on. where you at, bb π¦
the send_event member is set to True if the event came from a SendEvent protocol request. so if it's True, somebody synthesised it, no cap.
the serial member is set from the serial number reported in the protocol β but it gets expanded from the 16-bit least-significant bits to a full 32-bit value. glow-up of the century honestly π
the window member is set to the window that is most useful to toolkit dispatchers. teamwork makes the dream work π
π§ the window / colormap lore (yes there's more)
the window member is set to the window whose associated colormap is changed, installed, or uninstalled. all three, she does it all π
for a colormap that is changed, installed, or uninstalled, the colormap member is set to the colormap associated with the window. but β and this is the plot twist β for a colormap that is changed by a call to XFreeColormap, the colormap member is set to None. gone, reduced to atoms π
the new member is set to indicate whether the colormap for the specified window was changed or installed or uninstalled, and it can be True or False:
Trueβ the colormap was changed β¨Falseβ the colormap was installed or uninstalled π
ngl, read thatTrue/Falsething twice, becauseFalsecovers both install and uninstall β it's not just "not changed", bestie. thestatemember is what actually tells you which one.
the state member is always set to indicate whether the colormap is installed or uninstalled, and it can be ColormapInstalled or ColormapUninstalled. always. no exceptions. periodt π
π« SEE ALSO π«
the whole friend group, fr fr β go read these too or you're missing out:
XAnyEvent(3)XButtonEvent(3)XCreateWindowEvent(3)XCirculateEvent(3)XCirculateRequestEvent(3)XConfigureEvent(3)XConfigureRequestEvent(3)XCreateColormap(3)XCrossingEvent(3)XDestroyWindowEvent(3)XErrorEvent(3)XExposeEvent(3)XFocusChangeEvent(3)XGraphicsExposeEvent(3)XGravityEvent(3)XKeymapEvent(3)XMapEvent(3)XMapRequestEvent(3)XPropertyEvent(3)XReparentEvent(3)XResizeRequestEvent(3)XSelectionClearEvent(3)XSelectionEvent(3)XSelectionRequestEvent(3)XUnmapEvent(3)XVisibilityEvent(3)
and of course, the mothership herself: Xlib - C Language X Interface ππ
π one more vibe check:colormapcan literally beNone, so pls don't go dereferencing it without checking, bestie. i'm looking out for you.
okay that's the whole page!! this cutie is from X Version 11, specifically libX11 1.8.14 β go forth and handle your colormap events with main character energy, i'm obsessed with you, mwah πππ¦
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms