コード例 #1
0
ファイル: mousemng.cpp プロジェクト: FREEWING-JP/np2pi
static void SetMouse(const Point *cp) {

#if TARGET_API_MAC_CARBON

	CGPoint	pt;

	pt.x = (float)cp->h;
	pt.y = (float)cp->v;
	CGWarpMouseCursorPosition(pt);

#else
	CursorDevice	*curdev;
	Point			pt;
	WindowPtr		saveport;

	curdev = NULL;
	CursorDeviceNextDevice(&curdev);
	if (curdev != NULL) {
		pt.h = cp->h;
		pt.v = cp->v;
		GetPort(&saveport);
		SetPort(hWndMain);
		LocalToGlobal(&pt);
		SetPort(saveport);
		CursorDeviceMoveTo(curdev, pt.h, pt.v);
	}
#endif
}
コード例 #2
0
ファイル: SDL_macmouse.c プロジェクト: ahpho/wowmapviewer
void Mac_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{
#if !TARGET_API_MAC_CARBON
	CursorDevice *cursordevice;

	cursordevice = nil;
	CursorDeviceNextDevice(&cursordevice);
	if ( cursordevice != nil ) {
		WindowPtr saveport;
		Point where;

		GetPort(&saveport);
		SetPort(SDL_Window);
		where.h = x;
		where.v = y;
		LocalToGlobal(&where);
		SetPort(saveport);
		CursorDeviceMoveTo(cursordevice, where.h, where.v);
	}
#endif /* !TARGET_API_MAC_CARBON */
}
コード例 #3
0
ファイル: main.c プロジェクト: threader/Mac-On-Linux
static long
soft_irq( void *p1, void *p2 )
{
	static int cnt;
	osi_mouse_t pb;

	(void) OSI_GetMouse( &pb );

	if( (pb.event & kMouseEvent_MoveTo) )
		CursorDeviceMoveTo( m.cursDev, pb.x, pb.y );
	else if( (pb.event & kMouseEvent_MoveDelta) )
		CursorDeviceMove( m.cursDev, pb.x, pb.y );

	CursorDeviceButtons( m.cursDev, (pb.event & kMouseEvent_ButMask) );

	/* detect hardware/software cursor switches */
	if( (pb.event & kMouseEvent_HwSwCursSwitch) )
		hwsw_curs_switch();

	return 0;
}