While hacking on my dwm I noticed this line in dwm.c:
while(running && !XNextEvent(dpy, &ev))
Notice the ‘not’ before XNextEvent. I wonder why it’s here, as far as I can remember XNextEvent isn’t supposed to return something. A quick look at the manual helped, but didn’t solve the problem:
int XNextEvent(Display *display, XEvent *event_return);
The function returns an int but there’s no explanation on what this return value is. In X.org’s libX11’s source code XNextEvent always returns 0.
I imagine that somewhere there’s a version of the Xlibs that return a non-zero value when there’s an error, maybe there’s a doc somewhere explaining what this means, but I couldn’t find it. Or maybe it’s simply an undefined behavior, an error…