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/windowmanager/intern/wm_gesture.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/windowmanager/intern/wm_gesture.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 86ada4aaf2a..a6fbad8b171 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -52,7 +52,6 @@ wmGesture *WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent if (ELEM(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, - WM_GESTURE_TWEAK, WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE)) { rcti *rect = MEM_callocN(sizeof(rcti), "gesture rect new"); @@ -83,9 +82,6 @@ wmGesture *WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent void WM_gesture_end(wmWindow *win, wmGesture *gesture) { - if (win->tweak == gesture) { - win->tweak = NULL; - } BLI_remlink(&win->gesture, gesture); MEM_freeN(gesture->customdata); WM_generic_user_data_free(&gesture->user_data); @@ -114,74 +110,6 @@ bool WM_gesture_is_modal_first(const wmGesture *gesture) return (gesture->is_active_prev == false); } -int wm_gesture_evaluate(wmGesture *gesture, const wmEvent *event) -{ - if (gesture->type == WM_GESTURE_TWEAK) { - rcti *rect = gesture->customdata; - const int delta[2] = { - BLI_rcti_size_x(rect), - BLI_rcti_size_y(rect), - }; - - if (WM_event_drag_test_with_delta(event, delta)) { - int theta = round_fl_to_int(4.0f * atan2f((float)delta[1], (float)delta[0]) / (float)M_PI); - int val = EVT_GESTURE_W; - - if (theta == 0) { - val = EVT_GESTURE_E; - } - else if (theta == 1) { - val = EVT_GESTURE_NE; - } - else if (theta == 2) { - val = EVT_GESTURE_N; - } - else if (theta == 3) { - val = EVT_GESTURE_NW; - } - else if (theta == -1) { - val = EVT_GESTURE_SE; - } - else if (theta == -2) { - val = EVT_GESTURE_S; - } - else if (theta == -3) { - val = EVT_GESTURE_SW; - } - -#if 0 - /* debug */ - if (val == 1) { - printf("tweak north\n"); - } - if (val == 2) { - printf("tweak north-east\n"); - } - if (val == 3) { - printf("tweak east\n"); - } - if (val == 4) { - printf("tweak south-east\n"); - } - if (val == 5) { - printf("tweak south\n"); - } - if (val == 6) { - printf("tweak south-west\n"); - } - if (val == 7) { - printf("tweak west\n"); - } - if (val == 8) { - printf("tweak north-west\n"); - } -#endif - return val; - } - } - return 0; -} - /* ******************* gesture draw ******************* */ static void wm_gesture_draw_line_active_side(rcti *rect, const bool flip) @@ -511,11 +439,6 @@ void wm_gesture_draw(wmWindow *win) if (gt->type == WM_GESTURE_RECT) { wm_gesture_draw_rect(gt); } -#if 0 - else if (gt->type == WM_GESTURE_TWEAK) { - wm_gesture_draw_line(gt); - } -#endif else if (gt->type == WM_GESTURE_CIRCLE) { wm_gesture_draw_circle(gt); } |