Function to access the real cursor position from Ghost (useful when cursor is grabbed and warped)

This commit is contained in:
Martin Poirier 2009-12-07 18:06:37 +00:00
parent 149b3bc7f2
commit 78f87c8bdf
2 changed files with 9 additions and 0 deletions

View File

@ -972,6 +972,13 @@ void wm_window_swap_buffers(wmWindow *win)
#endif
}
void wm_get_cursor_position(wmWindow *win, int *x, int *y)
{
GHOST_GetCursorPosition(g_system, x, y);
GHOST_ScreenToClient(win->ghostwin, *x, *y, x, y);
*y = (win->sizey-1) - *y;
}
/* ******************* exported api ***************** */

View File

@ -55,6 +55,8 @@ void wm_window_get_position (wmWindow *win, int *posx_r, int *posy_r);
void wm_window_set_title (wmWindow *win, char *title);
void wm_window_swap_buffers (wmWindow *win);
void wm_get_cursor_position (wmWindow *win, int *x, int *y);
wmWindow *wm_window_copy (bContext *C, wmWindow *winorig);
void wm_window_testbreak (void);