FatalError ("hpcMouseEnqueueEvent: unrecognized id\n");
hpcFatalError (("hpcMouseEnqueueEvent: unrecognized id\n"));
hpcMouseEnqueueEvent (device, fe)    DeviceIntPtr  device;   	/* Mouse from which the event came */    hpcEvent	  *fe;	    	/* Event to process */{    xEvent		xE;    hpcPtrPrivPtr	pPriv;	/* Private data for pointer */    hpcKbdPrivPtr	keyPriv;/* Private keyboard data for button emul */    unsigned long	time;    int			x, y, bmask;    pPriv = (hpcPtrPrivPtr)device->public.devicePrivate;    time = xE.u.keyButtonPointer.time = TSTOMILLI(fe->time);    /*     * Mouse buttons start at 1.     *     * Sometimes we will get two events for a single button state change.      * Should we get a button even which reflects the current state of     * affairs, that event is discarded.  In the button emulation case, we     * may need to generate several events from one real event.     *     * The button emulation allows WIN-1 through WIN-5 to be used as     * buttons one to five when the first real button is down.  If other     * real buttons are present, they are accounted for separately so that     * lifting an emulated button will not cause a button up event if the     * real button is down.  If the WIN button is not down, a button down     * event will be sent for the first button.  If the first button is     * pressed when just the WIN key is down, the button events will not     * be sent.  The allows you to move just the cursor on a touch screen.     * Emulated buttons are only released when the keys are released.     */    switch (fe->type) {    case WSCONS_EVENT_MOUSE_UP:	xE.u.u.type = ButtonRelease;	if (fe->value > 0 || pPriv->bedev == NULL) { /* real button */	    xE.u.u.detail = fe->value + 1;	    bmask = 1 << xE.u.u.detail;	    if (pPriv->brmask & bmask || pPriv->bemask & bmask) {		pPriv->brmask &= ~bmask;		pPriv->bemask &= ~bmask;		mieqEnqueue (&xE);	    }	} else { /* first button, do emulation if needed */	    keyPriv = pPriv->bedev;	    pPriv->ebdown = 0;	    if (keyPriv->bkeydown) {		if (keyPriv->bkeymask) {		    int button;		    while ((button = ffs(pPriv->bemask &		     ~keyPriv->bkeymask) - 1) > 0) {			bmask = 1 << button;			pPriv->bemask &= ~bmask;			if (!(pPriv->brmask & bmask)) {			    xE.u.u.detail = button;			    mieqEnqueue (&xE);			}		    }		}	    } else {		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);		}	    }	}	break;    case WSCONS_EVENT_MOUSE_DOWN:	xE.u.u.type = ButtonPress;	if (fe->value > 0 || pPriv->bedev == NULL) { /* real button */	    xE.u.u.detail = fe->value + 1;	    bmask = 1 << xE.u.u.detail;	    if (!(pPriv->brmask & bmask)) {		pPriv->brmask |= bmask;		mieqEnqueue (&xE);	    } else if (pPriv->bemask & bmask)		pPriv->brmask |= bmask;	} else { /* first button, do emulation if needed */	    keyPriv = pPriv->bedev;	    pPriv->ebdown = 1;	    if (keyPriv->bkeydown) {		if (keyPriv->bkeymask) {		    int button;		    while ((button = ffs(keyPriv->bkeymask &		     ~pPriv->bemask) - 1) > 0) {			bmask = 1 << button;			pPriv->bemask |= bmask;			if (!(pPriv->brmask & bmask)) {			    xE.u.u.detail = button;			    mieqEnqueue (&xE);			}		    }		}	    } else {		xE.u.u.detail = 1;		bmask = 1<<1;		if (!(pPriv->bemask & bmask)) {		    pPriv->bemask |= bmask;		    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;    }}