Event System: use more thoroughly tested logic for click-drag events

No functional changes, largely restoring old logic & removing the need
for workarounds.

Reverts:
- 13b6cec039.
- aa71414dfc (partially).
This commit is contained in:
Campbell Barton 2022-03-03 15:59:20 +11:00
parent 9d529407da
commit 4d0f846b93
Notes: blender-bot 2023-10-31 06:19:02 +01:00
Referenced by commit 4c3e91e5f5, Fix T96520 Node editor: Tweak fails with unselected nodes
Referenced by commit d66b047ca3, WM: use pass-through for cursor placement operator
Referenced by issue #104026, Regression: Click-Drag to select channels in Graph Editor no longer working
Referenced by issue #97277, Regression: Tweak drag transforming is broken for masks (RMB select)
Referenced by issue #97152, Regression: Selection tools do nothing in particle hair edit?
Referenced by issue #96835, Regression: GPencil: In edit mode "Tweak Tool: Left Mouse Select & Move" does not work correctly
Referenced by issue #96520, Regression: Node editor: Tweak is broken and requires click, then click again to drag
Referenced by issue #114282, Extrude to Cursor tool: it don't allow to correct position of new vertex after LMB pressed
Referenced by commit 4bec9d0d71, Fix #114282: Extrude to Cursor tool no longer tweaks on drag
2 changed files with 8 additions and 15 deletions

View File

@ -3191,11 +3191,15 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
copy_v2_v2_int(event->xy, prev_xy);
win->event_queue_check_click = false;
if (!((action & WM_HANDLER_BREAK) == 0 || wm_action_not_handled(action))) {
/* Only disable when handled as other handlers may use this drag event. */
win->event_queue_check_drag = false;
}
}
}
else {
win->event_queue_check_drag = false;
}
}
else {
win->event_queue_check_drag = false;
}
}
else if (ISMOUSE_BUTTON(event->type) || ISKEYBOARD(event->type)) {
@ -3267,6 +3271,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
}
else {
win->event_queue_check_click = false;
win->event_queue_check_drag = false;
}
}
else if (ISMOUSE_WHEEL(event->type) || ISMOUSE_GESTURE(event->type)) {
@ -3713,11 +3718,6 @@ void wm_event_do_handlers(bContext *C)
/* Check dragging, creates new event or frees, adds draw tag. */
wm_event_drag_and_drop_test(wm, win, event);
/* Builtin drag: #KM_CLICK_DRAG. */
if (action & WM_HANDLER_BREAK) {
win->event_queue_check_drag = false;
}
if ((action & WM_HANDLER_BREAK) == 0) {
/* NOTE: setting subwin active should be done here, after modal handlers have been done. */
if (event->type == MOUSEMOVE) {

View File

@ -162,13 +162,6 @@ static bool gesture_box_apply(bContext *C, wmOperator *op)
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
/* FIXME(@campbellbarton): This is a temporary workaround T96120. As events
* are handled while dragging we should resolve this in a more general way. */
wmWindowManager *wm = CTX_wm_manager(C);
if (wm->drags.first) {
return OPERATOR_PASS_THROUGH;
}
wmWindow *win = CTX_wm_window(C);
const ARegion *region = CTX_wm_region(C);
const bool wait_for_input = !WM_event_is_mouse_drag_or_press(event) &&