Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-11-19 22:27:10 +0300
committerMartin Poirier <theeth@yahoo.com>2009-11-19 22:27:10 +0300
commit7f42b10d0fa0f9e933214de0552a79439f491930 (patch)
treed6862701f75f69577007009da99ffc492c7ba322 /source/blender
parentffbf4b6c8c6193d56c6b843254a31a665bf2a5db (diff)
Support for grab cursor in macro system (and vice versa).
This may result in cursor being grabbed twice (though we don't have any macro that can do this at the moment). If this is a problem, a check can be added.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/mesh/mesh_ops.c4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c14
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c20
3 files changed, 33 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 3ce5bbc7e5a..70ab3f06b89 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -185,7 +185,7 @@ void ED_operatormacros_mesh(void)
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
- ot= WM_operatortype_append_macro("MESH_OT_extrude_move_along_normals", "Extrude Along Normals", OPTYPE_UNDO|OPTYPE_REGISTER|OPTYPE_BLOCKING);
+ ot= WM_operatortype_append_macro("MESH_OT_extrude_move_along_normals", "Extrude Along Normals", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->poll = ED_operator_editmesh_face_select; /* restrict extrude along normals to face select */
WM_operatortype_macro_define(ot, "MESH_OT_extrude");
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
@@ -193,7 +193,7 @@ void ED_operatormacros_mesh(void)
RNA_enum_set(otmacro->ptr, "constraint_orientation", V3D_MANIP_NORMAL);
RNA_boolean_set_array(otmacro->ptr, "constraint_axis", constraint_axis);
- ot= WM_operatortype_append_macro("MESH_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER|OPTYPE_BLOCKING);
+ ot= WM_operatortype_append_macro("MESH_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
WM_operatortype_macro_define(ot, "MESH_OT_extrude");
otmacro= WM_operatortype_macro_define(ot, "TFM_OT_translate");
RNA_enum_set(otmacro->ptr, "proportional", 0);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index d8c0e9daf46..02fb56f93c8 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -461,10 +461,18 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
WM_operator_free(op);
}
else if(retval & OPERATOR_RUNNING_MODAL) {
- /* grab cursor during blocking modal ops (X11) */
- if(ot->flag & OPTYPE_BLOCKING) {
+ /* grab cursor during blocking modal ops (X11)
+ * Also check for macro
+ * */
+ if(ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) {
int bounds[4] = {-1,-1,-1,-1};
- int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->flag & OP_GRAB_POINTER) || (ot->flag & OPTYPE_GRAB_POINTER));
+ int wrap;
+
+ if (op->opm) {
+ wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
+ } else {
+ wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->flag & OP_GRAB_POINTER) || (ot->flag & OPTYPE_GRAB_POINTER));
+ }
if(wrap) {
ARegion *ar= CTX_wm_region(C);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 89e0943dcd1..e4906bed8e0 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -260,6 +260,26 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
BLI_remlink(&win->modalhandlers, handler);
wm_event_free_handler(handler);
}
+
+ /* if operator is blocking, grab cursor
+ * This may end up grabbing twice, but we don't care.
+ * */
+ if(op->opm->type->flag & OPTYPE_BLOCKING) {
+ int bounds[4] = {-1,-1,-1,-1};
+ int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->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);
+ }
}
}