diff options
author | Campbell Barton <campbell@blender.org> | 2022-04-04 06:47:06 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-04 07:32:42 +0300 |
commit | f699dbba86156ad3f24c24e3d369f0708b3fd1b5 (patch) | |
tree | e244f3f17a5a2166d443d25c14abb915d316f1a2 /source/blender/editors/interface/interface_context_menu.c | |
parent | 0ef96cd3922dbc16271f2dbaca0c7752db92a40d (diff) |
Cleanup: use event parameters for functions that create key-map items
Replace 5 arguments with a single struct as the same arguments
are used in many places.
This didn't read well and was confusing with both arguments named
`val` & `value` in the case of WM_modalkeymap_add_item.
Diffstat (limited to 'source/blender/editors/interface/interface_context_menu.c')
-rw-r--r-- | source/blender/editors/interface/interface_context_menu.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 0b3d36a34c5..e58298cdaee 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -202,7 +202,14 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg) /* XXX this guess_opname can potentially return a different keymap * than being found on adding later... */ wmKeyMap *km = WM_keymap_guess_opname(C, idname); - wmKeyMapItem *kmi = WM_keymap_add_item(km, idname, EVT_AKEY, KM_PRESS, 0, 0, KM_ANY); + wmKeyMapItem *kmi = WM_keymap_add_item(km, + idname, + &(const KeyMapItem_Params){ + .type = EVT_AKEY, + .value = KM_PRESS, + .modifier = 0, + .direction = KM_ANY, + }); const int kmi_id = kmi->id; /* This takes ownership of prop, or prop can be NULL for reset. */ |