Fix T72999: Fast keystrokes ignored for operators with modal keymaps

Logic to convert double-click events into press events wasn't running
in the case an operator had a modal keymap, causing bevel for e.g.
to ignore keys pressed quickly.

Change event handling logic so modal handlers never
receive double click events, so checks for press/release are reliable.

While this is an old issue for mouse events in practice it wasn't
a problem since the first event typically executed/canceled.
Support for keyboard double-click exposed the problem
for all modal operators that take numeric input.
This commit is contained in:
Campbell Barton 2020-01-10 15:13:41 +11:00
parent 62c6038531
commit 0920c1684b
Notes: blender-bot 2023-02-14 02:43:21 +01:00
Referenced by issue #72999, Quick successive presses of same number key not registering with Bevel tool
1 changed files with 11 additions and 1 deletions

View File

@ -2088,6 +2088,8 @@ static void wm_event_modalkeymap(const bContext *C,
wmEvent *event,
bool *dbl_click_disabled)
{
BLI_assert(event->type != EVT_MODAL_MAP);
/* support for modal keymap in macros */
if (op->opm) {
op = op->opm;
@ -2116,9 +2118,17 @@ static void wm_event_modalkeymap(const bContext *C,
event->prevval = event_match->val;
event->type = EVT_MODAL_MAP;
event->val = kmi->propvalue;
/* Avoid double-click events even in the case of 'EVT_MODAL_MAP',
* since it's possible users configure double-click keymap items
* which would break when modal functions expect press/release. */
if (event->prevtype == KM_DBL_CLICK) {
event->prevtype = KM_PRESS;
}
}
}
else {
if (event->type != EVT_MODAL_MAP) {
/* modal keymap checking returns handled events fine, but all hardcoded modal
* handling typically swallows all events (OPERATOR_RUNNING_MODAL).
* This bypass just disables support for double clicks in hardcoded modal handlers */