diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-01-10 07:13:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-01-10 07:49:35 +0300 |
commit | 0920c1684b3138ab5857edb072285b1c800ca046 (patch) | |
tree | 46b875807e48dd4b2833f357f992cc1a55b296bf /source | |
parent | 62c60385315f207c3e744adc8787e569ee0d3204 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 0041143f93e..b30b52fc5bb 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -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 */ |