diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-10-03 04:37:41 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-10-03 14:08:37 +0300 |
commit | d9d3a2a5009c76f68fd2e6456db7dac61c4d2e49 (patch) | |
tree | d2972c9e650261ad5f95e80d3c4c8f1f46666844 /source/blender/windowmanager/intern/wm_cursors.c | |
parent | ffe03cd264f39d27047393d4db745ea8dae19d5f (diff) |
Fix T44605: OS X continuous grab issues.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_cursors.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index d84b65847ca..d9466cbd035 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -199,14 +199,10 @@ void WM_cursor_grab_enable(wmWindow *win, bool wrap, bool hide, int bounds[4]) * It helps not to get a stuck WM when hitting a breakpoint * */ GHOST_TGrabCursorMode mode = GHOST_kGrabNormal; - float fac = GHOST_GetNativePixelSize(win->ghostwin); - /* in case pixel coords differ from window/mouse coords */ if (bounds) { - bounds[0] /= fac; - bounds[1] /= fac; - bounds[2] /= fac; - bounds[3] /= fac; + wm_cursor_position_to_ghost(win, &bounds[0], &bounds[1]); + wm_cursor_position_to_ghost(win, &bounds[2], &bounds[3]); } if (hide) { @@ -234,7 +230,15 @@ void WM_cursor_grab_disable(wmWindow *win, const int mouse_ungrab_xy[2]) { if ((G.debug & G_DEBUG) == 0) { if (win && win->ghostwin) { - GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL, mouse_ungrab_xy); + if (mouse_ungrab_xy) { + int mouse_xy[2] = {mouse_ungrab_xy[0], mouse_ungrab_xy[1]}; + wm_cursor_position_to_ghost(win, &mouse_xy[0], &mouse_xy[1]); + GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL, mouse_xy); + } + else { + GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL, NULL); + } + win->grabcursor = GHOST_kGrabDisable; } } |