Ejemplo n.º 1
0
GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
                                   GHOST_TGrabCursorMode mode,
                                   int bounds[4], const int mouse_ungrab_xy[2])
{
	GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
	GHOST_Rect bounds_rect, bounds_win;
	GHOST_TInt32 mouse_ungrab_xy_global[2];

	if (bounds) {
		/* if this is X11 specific we need a function that converts */
		window->getClientBounds(bounds_win);
		window->clientToScreen(bounds[0], bounds_win.getHeight() - bounds[1], bounds_rect.m_l, bounds_rect.m_t);
		window->clientToScreen(bounds[2], bounds_win.getHeight() - bounds[3], bounds_rect.m_r, bounds_rect.m_b);

	}
	
	if (mouse_ungrab_xy) {
		if (bounds == NULL)
			window->getClientBounds(bounds_win);
		window->clientToScreen(mouse_ungrab_xy[0], bounds_win.getHeight() - mouse_ungrab_xy[1],
		                       mouse_ungrab_xy_global[0], mouse_ungrab_xy_global[1]);
	}

	return window->setCursorGrab(mode,
	                             bounds ? &bounds_rect : NULL,
	                             mouse_ungrab_xy ? mouse_ungrab_xy_global : NULL);
}
Ejemplo n.º 2
0
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
                          GHOST_TInt32 inX,
                          GHOST_TInt32 inY,
                          GHOST_TInt32 *outX,
                          GHOST_TInt32 *outY)
{
	GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;

	window->clientToScreen(inX, inY, *outX, *outY);
}
Ejemplo n.º 3
0
GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
										GHOST_TGrabCursorMode mode,
										int *bounds)
{
	GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
	GHOST_Rect bounds_rect, bounds_win;

	if(bounds) {
		/* if this is X11 specific we need a function that converts */
		window->getClientBounds(bounds_win);
		window->clientToScreen(bounds[0], bounds_win.getHeight() - bounds[1], bounds_rect.m_l, bounds_rect.m_t);
		window->clientToScreen(bounds[2], bounds_win.getHeight() - bounds[3], bounds_rect.m_r, bounds_rect.m_b);

	}
	
	return window->setCursorGrab(mode, bounds ? &bounds_rect:NULL);
}