[Bf-blender-cvs] [198980693ba] blender-v2.92-release: Fix T84931: Keys that open menus can also activate menu items
Campbell Barton
noreply at git.blender.org
Thu Jan 28 00:51:53 CET 2021
Commit: 198980693ba7b183f7d2a32a21b65338edfdeb10
Author: Campbell Barton
Date: Thu Jan 28 10:39:12 2021 +1100
Branches: blender-v2.92-release
https://developer.blender.org/rB198980693ba7b183f7d2a32a21b65338edfdeb10
Fix T84931: Keys that open menus can also activate menu items
Disable key-accelerators for key-repeat events.
When a key was held it could open the menu and activate the menu
item associated with that key.
With the RMB select option: edit-meshes & edge-selection caused
holding W to open & activate "Edge Bevel Weight".
===================================================================
M source/blender/editors/interface/interface_handlers.c
===================================================================
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 377e55e7299..50c5c27b5c1 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -9905,6 +9905,12 @@ static int ui_handle_menu_event(bContext *C,
break;
}
+ /* Only respond to explicit press to avoid the event that opened the menu
+ * activating an item when the key is held. */
+ if (event->is_repeat) {
+ break;
+ }
+
if (event->alt) {
act += 10;
}
@@ -9984,8 +9990,11 @@ static int ui_handle_menu_event(bContext *C,
case EVT_XKEY:
case EVT_YKEY:
case EVT_ZKEY: {
- if ((event->val == KM_PRESS || event->val == KM_DBL_CLICK) &&
- !IS_EVENT_MOD(event, shift, ctrl, oskey)) {
+ if (ELEM(event->val, KM_PRESS, KM_DBL_CLICK) &&
+ !IS_EVENT_MOD(event, shift, ctrl, oskey) &&
+ /* Only respond to explicit press to avoid the event that opened the menu
+ * activating an item when the key is held. */
+ !event->is_repeat) {
if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) {
break;
}
More information about the Bf-blender-cvs
mailing list