Пример #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 GsCheckMouseEvent(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: 
display_puts("mouse read\n");
	mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons);
	if(mousestatus < 0) {
		display_puts("Mouse error\n");
		return FALSE;
	} else if(mousestatus) { // Deliver events as appropriate: 
/*
		display_puts("mouse ");
		sint2dec(rootx,s);
		display_puts(s);
		display_puts(",");
		sint2dec(rooty,s);
		display_puts(s);
		display_puts(",");
		long2hex(newbuttons,s);
		display_puts(s);
		display_puts("\n");
*/
		if(newbuttons&0x1)
			tstColorGd++;
		GdSetForegroundPixelVal(psd, tstColorGd);
		GdPoint(psd, rootx, rooty);
		return TRUE;
	}
	return FALSE;
}
Пример #2
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.
 */
void GsCheckMouseEvent(void)
{
	COORD		rootx;		/* latest mouse x position */
	COORD		rooty;		/* latest mouse y position */
	BUTTON		newbuttons;	/* latest buttons */
	int		mousestatus;	/* latest mouse status */

	/* Read the latest mouse status: */
	mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons);
	if(mousestatus < 0) {
		GsError(GR_ERROR_MOUSE_ERROR, 0);
		return;
	} else if(mousestatus) /* Deliver events as appropriate: */	
		GsHandleMouseStatus(rootx, rooty, newbuttons);
}
Пример #3
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 GsCheckMouseEvent(void)
{
	COORD		rootx;		/* latest mouse x position */
	COORD		rooty;		/* latest mouse y position */
	BUTTON		newbuttons;	/* latest buttons */
	int		mousestatus;	/* latest mouse status */

	/* Read the latest mouse status: */
	mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons);
	if(mousestatus < 0) {
		printf("Mouse error\n");
		return FALSE;
	} else if(mousestatus) { /* Deliver events as appropriate: */	
		printf("mouse %d,%d,%d\n", rootx, rooty, newbuttons);
      return TRUE;
   }
   return FALSE;
}
Пример #4
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;
}
Пример #5
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;
}
Пример #6
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.
 */
GR_BOOL GsCheckMouseEvent(void)
{
	GR_COORD	rootx;		/* latest mouse x position */
	GR_COORD	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) {
		GsError(GR_ERROR_MOUSE_ERROR, 0);
		return FALSE;
	} else if(mousestatus) {	/* Deliver events as appropriate: */	
		GsHandleMouseStatus(rootx, rooty, newbuttons);

		/* possibly reset portrait mode based on mouse position*/
		if (autoportrait)
			GsSetPortraitModeFromXY(rootx, rooty);
		return TRUE;
	}
	return FALSE;
}