return; } } else { if ((pPriv->bmask & bmask) == 0) { xE.u.u.type = ButtonPress; pPriv->bmask |= bmask; } else { return;
while (pPriv->bemask) { xE.u.u.detail = ffs(pPriv->bemask) - 1; bmask = 1 << xE.u.u.detail; pPriv->bemask &= ~bmask; if (!(pPriv->brmask & bmask)) mieqEnqueue (&xE); }
hpcMouseEnqueueEvent (device, fe)    DeviceIntPtr  device;   	/* Mouse from which the event came */    hpcEvent	  *fe;	    	/* Event to process */{    xEvent		xE;    hpcPtrPrivPtr	pPriv;	/* Private data for pointer */    int			bmask;	/* Temporary button mask */    unsigned long	time;    int			x, y;    pPriv = (hpcPtrPrivPtr)device->public.devicePrivate;    time = xE.u.keyButtonPointer.time = TSTOMILLI(fe->time);    switch (fe->type) {    case WSCONS_EVENT_MOUSE_UP:    case WSCONS_EVENT_MOUSE_DOWN:	/*	 * A button changed state. Sometimes we will get two events	 * for a single state change. Should we get a button event which	 * reflects the current state of affairs, that event is discarded.	 *	 * Mouse buttons start at 1.	 */	xE.u.u.detail = fe->value + 1;	bmask = 1 << xE.u.u.detail;	if (fe->type == WSCONS_EVENT_MOUSE_UP) {	    if (pPriv->bmask & bmask) {		xE.u.u.type = ButtonRelease;		pPriv->bmask &= ~bmask;	    } else {		return;	    }	} else {	    if ((pPriv->bmask & bmask) == 0) {		xE.u.u.type = ButtonPress;		pPriv->bmask |= bmask;	    } else {		return;	    }	}	mieqEnqueue (&xE);	break;    case WSCONS_EVENT_MOUSE_DELTA_X:	miPointerDeltaCursor (MouseAccelerate(device,fe->value),0,time);	break;    case WSCONS_EVENT_MOUSE_DELTA_Y:	miPointerDeltaCursor (0,-MouseAccelerate(device,fe->value),time);	break;    case WSCONS_EVENT_MOUSE_DELTA_Z:	/* Ignore for now. */	break;    case WSCONS_EVENT_MOUSE_ABSOLUTE_X:	miPointerPosition (&x, &y);	miPointerAbsoluteCursor (fe->value, y, time);	break;    case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:	miPointerPosition (&x, &y);	miPointerAbsoluteCursor (x, fe->value, time);	break;    case WSCONS_EVENT_MOUSE_ABSOLUTE_Z:	break;    default:	FatalError ("hpcMouseEnqueueEvent: unrecognized id\n");	break;    }}