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-23 19:24:28 +0300
committerMartin Poirier <theeth@yahoo.com>2009-11-23 19:24:28 +0300
commitd1f314a2174a61dbfd054c3cd6da673520061dd8 (patch)
treec438625d0745fc067c42d8dfaf7613bf94c87f49
parent66a013b06a0085dce68daa00940c9b092b1490a3 (diff)
New CLICK event value. If RELEASE is not handled and last event was PRESS of same type, redo handlers with CLICK value (this means you can "click" key events too).
Leftmouse+Ctrl to extrude now mapped to Click instead of Release. Release was used to avoid conflict with lasso, but it isn't safe with modal operators that use Press to confirm (subsequent Release then extruded). Click is semantically closer to what we want here.
-rw-r--r--source/blender/editors/armature/armature_ops.c2
-rw-r--r--source/blender/editors/curve/curve_ops.c2
-rw-r--r--source/blender/editors/mesh/mesh_ops.c7
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h4
-rw-r--r--source/blender/windowmanager/WM_types.h1
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c20
6 files changed, 29 insertions, 7 deletions
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index be6f7d536f8..57eab530310 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -241,7 +241,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "ARMATURE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_forked", EKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_fill", FKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index ac0d4c21e27..15ff971b9cf 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -220,7 +220,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
keymap->poll= ED_operator_editsurfcurve;
WM_keymap_add_item(keymap, "OBJECT_OT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_row", RKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index dfc4ba8c6b8..1363d8b2102 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -284,10 +284,9 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_split", YKEY, KM_PRESS, 0, 0);
- /* use KM_RELEASE because same key is used for tweaks
- * TEMPORARY REMAP TO ALT+CTRL TO AVOID CONFLICT
- * */
- WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", LEFTMOUSE, KM_RELEASE, KM_CTRL|KM_ALT, 0);
+
+ /* use KM_CLICK because same key is used for tweaks */
+ WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 5cdd74c8262..5e5c9856669 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -152,8 +152,10 @@ typedef struct wmWindow {
short cursor; /* current mouse cursor type */
short lastcursor; /* for temp waitcursor */
short addmousemove; /* internal: tag this for extra mousemove event, makes cursors/buttons active on UI switching */
- int pad3;
+ short last_type; /* last event information, used for click */
+ short last_val;
+
struct wmEvent *eventstate; /* storage for event system */
struct wmSubWindow *curswin; /* internal for wm_subwindow.c only */
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 891ed8358fb..3f0c52f0f2c 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -82,6 +82,7 @@ enum {
#define KM_NOTHING 0
#define KM_PRESS 1
#define KM_RELEASE 2
+#define KM_CLICK 3
/* ************** UI Handler ***************** */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 56455f87d4d..534edde5d4a 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1153,6 +1153,22 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
if(CTX_wm_window(C)==NULL)
break;
}
+
+ /* test for CLICK event */
+ if (event->val == KM_RELEASE && action == WM_HANDLER_CONTINUE) {
+ wmWindow *win = CTX_wm_window(C);
+
+ if (win && win->last_type == event->type && win->last_val == KM_PRESS) {
+ event->val = KM_CLICK;
+ action = wm_handlers_do(C, event, handlers);
+
+ /* revert value if not handled */
+ if (action == WM_HANDLER_CONTINUE) {
+ event->val = KM_RELEASE;
+ }
+ }
+ }
+
return action;
}
@@ -1333,6 +1349,10 @@ void wm_event_do_handlers(bContext *C)
}
}
+ /* store last event for this window */
+ win->last_type = event->type;
+ win->last_val = event->val;
+
/* unlink and free here, blender-quit then frees all */
BLI_remlink(&win->queue, event);
wm_event_free(event);