diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-17 23:32:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-17 23:32:28 +0400 |
commit | 69c6a33ba1a064aa13da3ef6a74b310620cfafd5 (patch) | |
tree | 69eb569feb0f03d912391651b7fde6c66c43be98 /source | |
parent | 484bf962c66a5ffb7592cf8e4b462dbfb8d21214 (diff) |
wrap the mouse within the region while grabbing so on release the current view never changes and less likelyhood of loosing the cursor when running blender on 2+ screens. (assuming the 3d view isnt stretched over both)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 7 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 16 |
7 files changed, 26 insertions, 11 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index aa1bc108176..96bdb9aa848 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -78,6 +78,7 @@ #include "BKE_animsys.h" #include "BKE_action.h" +#include "BKE_fcurve.h" #include "BKE_context.h" #include "BKE_global.h" #include "BKE_key.h" @@ -669,7 +670,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s * then free the MEM_alloc'd string */ if (rna_path) { - ale->key_data= list_find_fcurve(&act->curves, rna_path, 0); + ale->key_data= (void *)list_find_fcurve(&act->curves, rna_path, 0); MEM_freeN(rna_path); } } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 018098b539b..29d84076533 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3750,7 +3750,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s /* number editing */ if(state == BUTTON_STATE_NUM_EDITING) { if(ui_is_a_warp_but(but)) - WM_cursor_grab(CTX_wm_window(C), TRUE, TRUE); + WM_cursor_grab(CTX_wm_window(C), TRUE, TRUE, NULL); ui_numedit_begin(but, data); } else if(data->state == BUTTON_STATE_NUM_EDITING) { ui_numedit_end(but, data); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 722b686218b..1acf3c8effa 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -52,6 +52,7 @@ static void rna_userdef_update(bContext *C, PointerRNA *ptr) WM_event_add_notifier(C, NC_WINDOW, NULL); } +#if 0 static void rna_userdef_lmb_select_set(PointerRNA *ptr,int value) { UserDef *userdef = (UserDef*)ptr->data; @@ -64,7 +65,6 @@ static void rna_userdef_lmb_select_set(PointerRNA *ptr,int value) userdef->flag &= ~USER_LMOUSESELECT; } -#if 0 static void rna_userdef_rmb_select_set(PointerRNA *ptr,int value) { rna_userdef_lmb_select_set(ptr, !value); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 82b244fa702..2189412783a 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -680,8 +680,9 @@ static void rna_def_windowmanager(BlenderRNA *brna) static void rna_def_keyconfig(BlenderRNA *brna) { StructRNA *srna; - FunctionRNA *func; - PropertyRNA *prop, *parm; + // FunctionRNA *func; + // PropertyRNA *parm; + PropertyRNA *prop; static EnumPropertyItem map_type_items[] = { {KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""}, diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index d90d812d0bb..59f3bcd4edc 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -76,7 +76,7 @@ void WM_cursor_set (struct wmWindow *win, int curs); void WM_cursor_modal (struct wmWindow *win, int curs); void WM_cursor_restore (struct wmWindow *win); void WM_cursor_wait (int val); -void WM_cursor_grab(struct wmWindow *win, int wrap, int hide); +void WM_cursor_grab(struct wmWindow *win, int wrap, int hide, int *bounds); void WM_cursor_ungrab(struct wmWindow *win); void WM_timecursor (struct wmWindow *win, int nr); diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 1d5b10f2583..5fe62157979 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -163,26 +163,27 @@ void WM_cursor_wait(int val) } } -void WM_cursor_grab(wmWindow *win, int wrap, int hide) +void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds) { /* Only grab cursor when not running debug. * It helps not to get a stuck WM when hitting a breakpoint * */ GHOST_TGrabCursorMode mode = GHOST_kGrabNormal; + int bounds_arr[4] = {-1, -1, -1, -1}; /* l/t/r/b */ if(hide) mode = GHOST_kGrabHide; else if(wrap) mode = GHOST_kGrabWrap; if ((G.f & G_DEBUG) == 0) if(win) - GHOST_SetCursorGrab(win->ghostwin, mode); + GHOST_SetCursorGrab(win->ghostwin, mode, bounds); } void WM_cursor_ungrab(wmWindow *win) { if ((G.f & G_DEBUG) == 0) if(win) - GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable); + GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL); } /* afer this you can call restore too */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 9e5f982880e..8eca0a1b416 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -463,8 +463,20 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P else if(retval & OPERATOR_RUNNING_MODAL) { /* grab cursor during blocking modal ops (X11) */ if(ot->flag & OPTYPE_BLOCKING) { - int warp = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->flag & OP_GRAB_POINTER) || (ot->flag & OPTYPE_GRAB_POINTER)); - WM_cursor_grab(CTX_wm_window(C), warp, FALSE); + int bounds[4] = {-1,-1,-1,-1}; + int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->flag & OP_GRAB_POINTER) || (ot->flag & OPTYPE_GRAB_POINTER)); + + if(wrap) { + ARegion *ar= CTX_wm_region(C); + if(ar) { + bounds[0]= ar->winrct.xmin; + bounds[1]= ar->winrct.ymax; + bounds[2]= ar->winrct.xmax; + bounds[3]= ar->winrct.ymin; + } + } + + WM_cursor_grab(CTX_wm_window(C), wrap, FALSE, bounds); } } else |