Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-03-02 06:28:06 +0300
committerCampbell Barton <campbell@blender.org>2022-03-02 06:28:29 +0300
commitaa71414dfca7f301e101cce3e72551e7529290ea (patch)
tree031af8b6df8c956486e569c936a15fa65ce6fe2e /source/blender/windowmanager
parentcf428b2ebddabd5786f65ae8901f25a4cbf456da (diff)
Fix click-drag events for dragging markers
Clicking and dragging markers accumulates flags from multiple operators in a way that can't be interpreted when combine. Follow tweak behavior for cancelling click-drag events.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c69
1 files changed, 34 insertions, 35 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 20940c59679..b3b99b0b7fc 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3157,44 +3157,40 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
/* Test for #WM_CLICK_DRAG events. */
- /* NOTE(@campbellbarton): Needed so drag can be used for editors that support both click
+ /* NOTE(@campbellbarton): Ignore `action` so drag can be used for editors that use 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;
-
- const int prev_xy[2] = {UNPACK2(event->xy)};
- const short prev_val = event->val;
- const short prev_type = event->type;
- const uint8_t prev_modifier = event->modifier;
- const short prev_keymodifier = event->keymodifier;
-
- copy_v2_v2_int(event->xy, event->prev_click_xy);
- event->val = KM_CLICK_DRAG;
- event->type = event->prev_type;
- event->modifier = event->prev_click_modifier;
- event->keymodifier = event->prev_click_keymodifier;
-
- CLOG_INFO(WM_LOG_HANDLERS, 1, "handling PRESS_DRAG");
+ * In the case of marker select-drag the combinations of (pass-through / finished / modal)
+ * can accumulate to have flags set that they can't be properly interpreted here.
+ * Instead `win->event_queue_check_drag` is cleared in `wm_event_do_handlers`. */
+ if (win->event_queue_check_drag) {
+ if (WM_event_drag_test(event, event->prev_click_xy)) {
+ win->event_queue_check_drag_handled = true;
+
+ const int prev_xy[2] = {UNPACK2(event->xy)};
+ const short prev_val = event->val;
+ const short prev_type = event->type;
+ const uint8_t prev_modifier = event->modifier;
+ const short prev_keymodifier = event->keymodifier;
+
+ copy_v2_v2_int(event->xy, event->prev_click_xy);
+ event->val = KM_CLICK_DRAG;
+ event->type = event->prev_type;
+ event->modifier = event->prev_click_modifier;
+ event->keymodifier = event->prev_click_keymodifier;
+
+ CLOG_INFO(WM_LOG_HANDLERS, 1, "handling PRESS_DRAG");
- action |= wm_handlers_do_intern(C, win, event, handlers);
+ WM_event_print(event);
- event->keymodifier = prev_keymodifier;
- event->modifier = prev_modifier;
- event->val = prev_val;
- event->type = prev_type;
- copy_v2_v2_int(event->xy, prev_xy);
+ action |= wm_handlers_do_intern(C, win, event, handlers);
- 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;
- }
- }
+ event->keymodifier = prev_keymodifier;
+ event->modifier = prev_modifier;
+ event->val = prev_val;
+ event->type = prev_type;
+ copy_v2_v2_int(event->xy, prev_xy);
+
+ win->event_queue_check_click = false;
}
}
else {
@@ -3270,7 +3266,6 @@ 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)) {
@@ -3720,6 +3715,10 @@ void wm_event_do_handlers(bContext *C)
/* Builtin tweak, if action is break it removes tweak. */
wm_tweakevent_test(C, event, action);
+ 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) {