Add operator and operator type flag for GRAB_POINTER, don't coopt the OPTYPE_BLOCKING flag for that.

It will check if either the operator or operator type flags are set on top of the user preference before grabbing the pointer.

I've set that flag for 3d view navigation operators, others should be set too (no transform, I'll deal with that one).
This commit is contained in:
Martin Poirier 2009-10-10 17:19:49 +00:00
parent f716f22d1f
commit 811a767827
4 changed files with 9 additions and 6 deletions

@ -621,7 +621,7 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
ot->poll= ED_operator_view3d_active;
/* flags */
ot->flag= OPTYPE_BLOCKING;
ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
}
/* ************************ viewmove ******************************** */
@ -743,7 +743,7 @@ void VIEW3D_OT_move(wmOperatorType *ot)
ot->poll= ED_operator_view3d_active;
/* flags */
ot->flag= OPTYPE_BLOCKING;
ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
}
/* ************************ viewzoom ******************************** */
@ -976,7 +976,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot)
ot->poll= ED_operator_view3d_active;
/* flags */
ot->flag= OPTYPE_BLOCKING;
ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
}

@ -330,7 +330,7 @@ typedef struct wmOperator {
#define OPERATOR_PASS_THROUGH 8
/* wmOperator flag */
#define OP_GRAB_POINTER 1
/* ************** wmEvent ************************ */
/* for read-only rna access, dont save this */

@ -44,6 +44,7 @@ struct wmWindowManager;
#define OPTYPE_UNDO 2 /* do undo push after after */
#define OPTYPE_BLOCKING 4 /* let blender grab all input from the WM (X11) */
#define OPTYPE_MACRO 8
#define OPTYPE_GRAB_POINTER 16 /* */
/* context to call operator in for WM_operator_name_call */
/* rna_ui.c contains EnumPropertyItem's of these, keep in sync */

@ -462,8 +462,10 @@ 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)
WM_cursor_grab(CTX_wm_window(C), (U.uiflag & USER_CONTINUOUS_MOUSE));
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);
}
}
else
WM_operator_free(op);