Ejemplo n.º 1
0
/*
 * Update mouse status and issue events on it if necessary.
 * This function doesn't block, but is normally only called when
 * there is known to be some data waiting to be read from the mouse.
 */
BOOL
MwCheckMouseEvent(void)
{
	MWCOORD		rootx;		/* latest mouse x position */
	MWCOORD		rooty;		/* latest mouse y position */
	int		newbuttons;	/* latest buttons */
	int		mousestatus;	/* latest mouse status */

	/* Read the latest mouse status: */
	mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons);
	if(mousestatus < 0) {
		/*MwError(GR_ERROR_MOUSE_ERROR, 0);*/
		return FALSE;
	} else if(mousestatus) {	/* Deliver events as appropriate: */
		MwHandleMouseStatus(rootx, rooty, newbuttons);
		return TRUE;
	}
	return FALSE;
}
Ejemplo n.º 2
0
/*
 * Update mouse status and issue events on it if necessary.
 * This function doesn't block, but is only called when Poll() returns TRUE
 * or MwSelect shows some data waiting to be read on the mouse file descriptor.
 */
BOOL
MwCheckMouseEvent(void)
{
	MWCOORD		rootx;		/* latest mouse x position */
	MWCOORD		rooty;		/* latest mouse y position */
	int		newbuttons;	/* latest buttons */
	int		mousestatus;	/* latest mouse status */

	if (mousedev.Poll && (mousedev.Poll() == 0))
			return FALSE;

	/* Read the latest mouse status*/
	mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons);
	if (mousestatus <= 0)
		return FALSE;		/* read failed or no new data*/

	/* Deliver mouse events as appropriate*/
	MwHandleMouseStatus(rootx, rooty, newbuttons);
	return TRUE;
}