diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-02 07:07:00 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-02 07:31:50 +0300 |
commit | 4986f718482b061082936f1f6aa13929741093a2 (patch) | |
tree | 21ea0b78e1182d35b44b4955ff308b8df1148b19 /source/blender/editors/interface/interface_handlers.c | |
parent | 426ff481a789017bd5810a2064ec06a298a6f2dc (diff) |
Event System: remove tweak events in favor of click-drag
Supporting two kinds of dragging is redundant, remove tweak events as
they only supported 3 mouse buttons and added complexity from using the
'value' to store directions.
Support only click-drag events (KM_CLICK_DRAG) which can be used with
any keyboard or mouse button.
Details:
- A "direction" member has been added to keymap items and events which
can be used when the event value is set to KM_CLICK_DRAG.
- Keymap items are version patched.
- Loading older key-maps are also updated.
- Currently the key-maps stored in ./release/scripts/presets/keyconfig/
still reference tweak events & need updating. For now they are updated
on load.
Note that in general this wont impact add-ons as modal operators don't
receive tweak events.
Reviewed By: brecht
Ref D14214
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c277ca2e36b..e0b64dcd4d6 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -9398,7 +9398,7 @@ static int ui_list_activate_hovered_row(bContext *C, } } - const int *mouse_xy = ISTWEAK(event->type) ? event->prev_click_xy : event->xy; + const int *mouse_xy = (event->val == KM_CLICK_DRAG) ? event->prev_click_xy : event->xy; uiBut *listrow = ui_list_row_find_mouse_over(region, mouse_xy); if (listrow) { wmOperatorType *custom_activate_optype = ui_list->dyn_data->custom_activate_optype; @@ -9425,7 +9425,7 @@ static bool ui_list_is_hovering_draggable_but(bContext *C, const wmEvent *event) { /* On a tweak event, uses the coordinates from where tweaking was started. */ - const int *mouse_xy = ISTWEAK(event->type) ? event->prev_click_xy : event->xy; + const int *mouse_xy = (event->val == KM_CLICK_DRAG) ? event->prev_click_xy : event->xy; const uiBut *hovered_but = ui_but_find_mouse_over_ex(region, mouse_xy, false, NULL, NULL); if (list->dyn_data->custom_drag_optype) { @@ -9442,7 +9442,7 @@ static int ui_list_handle_click_drag(bContext *C, ARegion *region, const wmEvent *event) { - if (!ELEM(event->type, LEFTMOUSE, EVT_TWEAK_L)) { + if (event->type != LEFTMOUSE) { return WM_HANDLER_CONTINUE; } @@ -9452,7 +9452,7 @@ static int ui_list_handle_click_drag(bContext *C, bool activate = false; bool activate_dragging = false; - if (event->type == EVT_TWEAK_L) { + if (event->val == KM_CLICK_DRAG) { if (is_draggable) { activate_dragging = true; activate = true; @@ -9462,7 +9462,7 @@ static int ui_list_handle_click_drag(bContext *C, * regular events (including mouse presses to start dragging) and this part only kicks in if it * hasn't handled the release event. Note that if there's no overlaid button, the row selects * on the press event already via regular #UI_BTYPE_LISTROW handling. */ - else if ((event->type == LEFTMOUSE) && (event->val == KM_CLICK)) { + else if (event->val == KM_CLICK) { activate = true; } @@ -9549,7 +9549,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *regi } } - if (ELEM(event->type, LEFTMOUSE, EVT_TWEAK_L)) { + if (event->type == LEFTMOUSE) { retval = ui_list_handle_click_drag(C, ui_list, region, event); } else if (val == KM_PRESS) { |