rem: while (W_CheckIdleHandlers()) { if (XCheckMaskEvent(dpy, mask, event)) return;
add: while (!waitForEvent(dpy, mask, False) && W_CheckIdleHandlers()) { W_CheckTimerHandlers();
context: WMMaskEvent(Display *dpy, long mask, XEvent *event){    while (!XCheckMaskEvent(dpy, mask, event)) {	/* Do idle stuff while there are no timer or X events */	while (W_CheckIdleHandlers()) {	    if (XCheckMaskEvent(dpy, mask, event))		return;	}        /* Wait for input on the X connection socket or another input handler */	waitForEvent(dpy, mask, True);        /* Check any expired timers */        W_CheckTimerHandlers();    }}