From 91d89c1ff7c215744e46957a1e7cc40adb7ac066 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Oct 2009 14:08:01 +0000 Subject: Adjustments to continuous grab - Use an enum for grab modes rather then boolean options. -- GHOST_kGrabNormal: continuous grab userpref disabled -- GHOST_kGrabWrap: wrap the mouse at the screen bounds * -- GHOST_kGrabHide: hide the mouse while grabbing and restore the mouse where it was initially pressed * GrabWrap is nice for transform and tools where you want some idea where the cursor is, previously I found both restoring the mouse at its original location and restoring at a clamped location was confusing with operators like transform, wrapping is not ideal but IMHO the best of a bad bunch of options. GrabHide is for numbuts, where restoring the mouse at the initial location isnt so confusing. --- source/blender/windowmanager/intern/wm_cursors.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_cursors.c') diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index c1dfd9ee9fb..1d5b10f2583 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -163,21 +163,26 @@ void WM_cursor_wait(int val) } } -void WM_cursor_grab(wmWindow *win, int warp) +void WM_cursor_grab(wmWindow *win, int wrap, int hide) { /* Only grab cursor when not running debug. * It helps not to get a stuck WM when hitting a breakpoint * */ + GHOST_TGrabCursorMode mode = GHOST_kGrabNormal; + + if(hide) mode = GHOST_kGrabHide; + else if(wrap) mode = GHOST_kGrabWrap; + if ((G.f & G_DEBUG) == 0) if(win) - GHOST_SetCursorGrab(win->ghostwin, 1, warp, -1); + GHOST_SetCursorGrab(win->ghostwin, mode); } -void WM_cursor_ungrab(wmWindow *win, int restore) +void WM_cursor_ungrab(wmWindow *win) { if ((G.f & G_DEBUG) == 0) if(win) - GHOST_SetCursorGrab(win->ghostwin, 0, -1, restore); + GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable); } /* afer this you can call restore too */ -- cgit v1.2.3