rem: while (hPtr != NULL) {
add: WM_ITERATE_BAG(vPtr->eventHandlers, hPtr, iter) {
context: WMHandleEvent(XEvent *event){    W_EventHandler *hPtr;    W_View *view, *vPtr, *toplevel;    unsigned long mask;    Window window;    if (event->type == MappingNotify) {	XRefreshKeyboardMapping(&event->xmapping);	return True;    }    mask = eventMasks[event->xany.type];        window = event->xany.window;    /* diferentiate SubstructureNotify with StructureNotify */    if (mask == StructureNotifyMask) {	if (event->xmap.event != event->xmap.window) {	    mask = SubstructureNotifyMask;	    window = event->xmap.event;	}    }    view = W_GetViewForXWindow(event->xany.display, window);    if (!view) {	if (extraEventHandler)	    (extraEventHandler)(event);	return False;    }    view->screen->lastEventTime = getEventTime(view->screen, event);    toplevel = W_TopLevelOfView(view);    if (event->type == SelectionNotify || event->type == SelectionClear	|| event->type == SelectionRequest) {	/* handle selection related events */	W_HandleSelectionEvent(event);	    } else if (event->type == ClientMessage) {		W_HandleDNDClientMessage(toplevel, &event->xclient);    }    /* if it's a key event, redispatch it to the focused control */    if (mask & (KeyPressMask|KeyReleaseMask)) {	W_View *focused = W_FocusedViewOfToplevel(toplevel);		if (focused) {	    view = focused;	}    }    /* compress Motion events */    if (event->type == MotionNotify && !view->flags.dontCompressMotion) {        while (XPending(event->xmotion.display)) {            XEvent ev;            XPeekEvent(event->xmotion.display, &ev);            if (ev.type == MotionNotify 		&& event->xmotion.window == ev.xmotion.window 		&& event->xmotion.subwindow == ev.xmotion.subwindow) {		/* replace events */                XNextEvent(event->xmotion.display, event);            } else break;        }    }        /* compress expose events */    if (event->type == Expose && !view->flags.dontCompressExpose) {        while (XCheckTypedWindowEvent(event->xexpose.display, view->window,				      Expose, event));    }    if (view->screen->modal && toplevel!=view->screen->modalView	&& !toplevel->flags.worksWhenModal) {	if (event->type == KeyPress || event->type == KeyRelease	    || event->type == MotionNotify || event->type == ButtonPress	    || event->type == ButtonRelease	    || event->type == FocusIn || event->type == FocusOut) {	    return True;	}    }    /* do balloon stuffs */    if (event->type == EnterNotify)	W_BalloonHandleEnterView(view);    else if (event->type == LeaveNotify)	W_BalloonHandleLeaveView(view);    /* This is a hack. It will make the panel be secure while     * the event handlers are handled, as some event handler     * might destroy the widget. */    W_RetainView(toplevel);    hPtr = view->handlerList;    while (hPtr!=NULL) {	W_EventHandler *tmp;	tmp = hPtr->nextHandler;	if ((hPtr->eventMask & mask)) {	    (*hPtr->proc)(event, hPtr->clientData);	}		hPtr = tmp;    }        /* pass the event to the top level window of the widget */    if (view->parent != NULL) {	vPtr = view;	while (vPtr->parent != NULL)	    vPtr = vPtr->parent;		hPtr = vPtr->handlerList;	while (hPtr != NULL) {		    if (hPtr->eventMask & mask) {		(*hPtr->proc)(event, hPtr->clientData);	    }	    hPtr = hPtr->nextHandler;	}    }    /* save button click info to track double-clicks */    if (view->screen->ignoreNextDoubleClick) {	view->screen->ignoreNextDoubleClick = 0;    } else {	if (event->type == ButtonPress) {	    view->screen->lastClickWindow = event->xbutton.window;	    view->screen->lastClickTime = event->xbutton.time;	}    }        W_ReleaseView(toplevel);        return True;}