Example #1
0
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
}
Example #2
0
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 */
}