rem: W_WaitForEvent(dpy, 0);
add: waitForEvent(dpy, 0, True);
context: WMNextEvent(Display *dpy, XEvent *event){     /* Check any expired timers */    W_CheckTimerHandlers();    while (XPending(dpy) == 0) {	/* Do idle stuff */	/* Do idle and timer stuff while there are no timer or X events */	while (XPending(dpy) == 0 && W_CheckIdleHandlers()) {	    /* dispatch timer events */            W_CheckTimerHandlers();	}	/*	 * Make sure that new events did not arrive while we were doing	 * timer/idle stuff. Or we might block forever waiting for	 * an event that already arrived. 	 */	/* wait for something to happen or a timer to expire */	W_WaitForEvent(dpy, 0);	        /* Check any expired timers */        W_CheckTimerHandlers();    }    XNextEvent(dpy, event);}