add: while (XCheckMaskEvent(scr->display, ButtonMotionMask, &ev)) ;
context: dragMenu(WEditMenu *menu){    WMScreen *scr = W_VIEW_SCREEN(menu->view);    XEvent ev;    Bool done = False;    int dx, dy;    unsigned blau;    Window blaw;        XGetGeometry(scr->display, W_VIEW_DRAWABLE(menu->view), &blaw, &dx, &dy,		 &blau, &blau, &blau, &blau);    XTranslateCoordinates(scr->display, W_VIEW_DRAWABLE(menu->view),			  scr->rootWin, dx, dy, &dx, &dy, &blaw);    dx = menu->dragX - dx;    dy = menu->dragY - dy;        XGrabPointer(scr->display, scr->rootWin, False,		 ButtonReleaseMask|ButtonMotionMask,		 GrabModeAsync, GrabModeAsync, None, scr->defaultCursor,		 CurrentTime);        if (menu->parent)	WTearOffEditMenu(menu->parent, menu);    while (!done) {	WMNextEvent(scr->display, &ev);		switch (ev.type) {	 case ButtonRelease:	    done = True;	    break;	 case MotionNotify:	    WMMoveWidget(menu, ev.xmotion.x_root - dx,			 ev.xmotion.y_root - dy);	    break;	 default:	    WMHandleEvent(&ev);	    break;	}    }    XUngrabPointer(scr->display, CurrentTime);}