u_char		*serPtrData; int			serPtrBytes;
void decEnqueueEvents (#if NeedFunctionPrototypes    void#endif){    struct wscons_event *ptrEvents,			*kbdEvents;    int		numPtrEvents, 	/* Number of remaining pointer events */		numKbdEvents;   /* Number of remaining keyboard events */    int		nPE,   	    	/* Original number of pointer events */		nKE;   	    	/* Original number of keyboard events */    Bool	PtrAgain,	/* need to (re)read */		KbdAgain;	/* need to (re)read */    DeviceIntPtr	pPointer;    DeviceIntPtr	pKeyboard;    decKbdPrivPtr       kbdPriv;    decPtrPrivPtr       ptrPriv;    u_char		*serPtrData;    int			serPtrBytes;    pPointer = (DeviceIntPtr)LookupPointerDevice();    pKeyboard = (DeviceIntPtr)LookupKeyboardDevice();    ptrPriv = (decPtrPrivPtr) pPointer->public.devicePrivate;    kbdPriv = (decKbdPrivPtr) pKeyboard->public.devicePrivate;    if (!pPointer->public.on || !pKeyboard->public.on)	return;    numPtrEvents = 0;    PtrAgain = TRUE;    numKbdEvents = 0;    KbdAgain = TRUE;    /*     * So long as one event from either device remains unprocess, we loop:     * Take the oldest remaining event and pass it to the proper module     * for processing. The DDXEvent will be sent to ProcessInput by the     * function called.     */    if (!decSerMouse) {        while (1) {	    /*  	     * Get events from both the pointer and the keyboard, storing the number	     * of events gotten in nPE and nKE and keeping the start of both arrays 	     * in pE and kE	      */	     if ((numPtrEvents == 0) && PtrAgain) {	         ptrEvents = decWsMouseGetEvents (ptrPriv->fd, &nPE, &PtrAgain);	         numPtrEvents = nPE;	     }	     if ((numKbdEvents == 0) && KbdAgain) {	         kbdEvents = decKbdGetEvents (kbdPriv->fd, &nKE, &KbdAgain);	         numKbdEvents = nKE;	     }	     if ((numPtrEvents == 0) && (numKbdEvents == 0))	         break;	     if (numPtrEvents && numKbdEvents) {	         if (timespeccmp (&kbdEvents->time, &ptrEvents->time, <)) {	     	     decKbdEnqueueEvent (pKeyboard, kbdEvents);	     	     numKbdEvents--;	     	     kbdEvents++;	         } else {		     decWsMouseEnqueueEvent (pPointer, ptrEvents);		     numPtrEvents--;		     ptrEvents++;	         }	    } else if (numKbdEvents) {	         decKbdEnqueueEvent (pKeyboard, kbdEvents);	         numKbdEvents--;	         kbdEvents++;	    } else {	         decWsMouseEnqueueEvent (pPointer, ptrEvents);	         numPtrEvents--;	         ptrEvents++;	    }        }    } else {        while (1) {	    /*  	     * Get events from both the pointer and the keyboard, storing the number	     * of events gotten in nPE and nKE and keeping the start of both arrays 	     * in pE and kE	      */	     if (PtrAgain) {	         serPtrData = decSerMouseGetEvents (ptrPriv->fd, &serPtrBytes, &PtrAgain);	     }	     if ((numKbdEvents == 0) && KbdAgain) {	         kbdEvents = decKbdGetEvents (kbdPriv->fd, &nKE, &KbdAgain);	         numKbdEvents = nKE;	     }	     if ((serPtrBytes == 0) && (numKbdEvents == 0))	         break;	     if (numKbdEvents) {	         decKbdEnqueueEvent (pKeyboard, kbdEvents);	         numKbdEvents--;	         kbdEvents++;	     }             if (serPtrBytes) {	        decSerMouseEnqueueEvents (pPointer, serPtrData, serPtrBytes);	        serPtrBytes = 0;	     }        }    }}