Event System: drag events now use modifier state on drag start

Now drag & tweak can have modifier keys to be released while dragging.
without this, modifier keys needs to be held which is more noticeable
for tablet input or whenever the drag threshold is set to a large value.

Resolves T89989.
This commit is contained in:
2022-02-28 15:16:16 +11:00
parent 63891f9dad
commit db4313610c
4 changed files with 49 additions and 8 deletions

View File

@@ -507,6 +507,8 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event)
tevent.type = EVT_TWEAK_M;
}
tevent.val = val;
tevent.modifier = gesture->event_modifier;
tevent.keymodifier = gesture->event_keymodifier;
tevent.is_repeat = false;
/* mouse coords! */
@@ -533,7 +535,18 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event)
}
break;
default:
if (!ISTIMER(event->type) && event->type != EVENT_NONE) {
if (ISTIMER(event->type)) {
/* Ignore timers. */
}
else if (event->type == EVENT_NONE) {
/* Ignore none events. */
}
else if ((event->val == KM_RELEASE) &&
(ISKEYMODIFIER(event->type) || (event->type == event->prev_click_keymodifier))) {
/* Support releasing modifier keys without canceling the drag event, see T89989.
* NOTE: this logic is replicated for drag events. */
}
else {
gesture_end = true;
}
break;