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.
This commit is contained in:
2009-11-23 16:24:28 +00:00
parent 66a013b06a
commit d1f314a217
6 changed files with 29 additions and 7 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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 */

View File

@@ -82,6 +82,7 @@ enum {
#define KM_NOTHING 0
#define KM_PRESS 1
#define KM_RELEASE 2
#define KM_CLICK 3
/* ************** UI Handler ***************** */

View File

@@ -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);