[Bf-blender-cvs] [cf428b2ebdd] master: Fix ignored click-drag events when operators pass-through & finished
Campbell Barton
noreply at git.blender.org
Wed Mar 2 02:26:17 CET 2022
Commit: cf428b2ebddabd5786f65ae8901f25a4cbf456da
Author: Campbell Barton
Date: Wed Mar 2 12:15:01 2022 +1100
Branches: master
https://developer.blender.org/rBcf428b2ebddabd5786f65ae8901f25a4cbf456da
Fix ignored click-drag events when operators pass-through & finished
Replacing tweak key-map items with click-drag caused selection
in the graph/sequencer/node editors to ignore drag events
(all uses of WM_generic_select_modal).
Operators that return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED
result in the event loop considering the event as being handled.
This stopped WM_CLICK_DRAG events from being generated which is not the
case for tweak events.
As click-drag is intended to be compatible with tweak events,
accept drag events when WM_HANDLER_BREAK isn't set or when
wm_action_not_handled returns true.
===================================================================
M source/blender/windowmanager/intern/wm_event_system.c
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index fb5af920ff8..20940c59679 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3155,8 +3155,14 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
}
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
- /* Test for CLICK_DRAG events. */
- if (wm_action_not_handled(action)) {
+ /* Test for #WM_CLICK_DRAG events. */
+
+ /* NOTE(@campbellbarton): Needed so drag can be used for editors that support both click
+ * selection and passing through the drag action to box select. See #WM_generic_select_modal.
+ * Unlike click, accept `action` when break isn't set.
+ * Operators can return `OPERATOR_FINISHED | OPERATOR_PASS_THROUGH` which results
+ * in `action` setting #WM_HANDLER_HANDLED, but not #WM_HANDLER_BREAK. */
+ if ((action & WM_HANDLER_BREAK) == 0 || wm_action_not_handled(action)) {
if (win->event_queue_check_drag) {
if (WM_event_drag_test(event, event->prev_click_xy)) {
win->event_queue_check_drag_handled = true;
@@ -3184,7 +3190,7 @@ 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 (!wm_action_not_handled(action)) {
+ 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;
}
More information about the Bf-blender-cvs
mailing list