Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-12-03 14:38:13 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-12-03 14:39:40 +0300
commit59e4a56d87a026fee008f152dff85ec62198c7a9 (patch)
tree9a5d219e7a828c06cf70455ecebdf594009a142f /source/blender/editors/interface/interface_handlers.c
parent2c7a70395c7ab283014d64b7551838e7741776a5 (diff)
Cleanup: change `WM_key_event_operator_id` to `WM_key_event_operator` and make it return kmi pointer directly.
All three usages of this func were only using kmi_id to find again kmi itself, pretty dumb!
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r--source/blender/editors/interface/interface_handlers.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 996abfb8583..9a85f5b508d 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -6401,10 +6401,10 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
uiLayout *layout;
uiStyle *style = UI_style_get_dpi();
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
- int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, true, &km);
- kmi = WM_keymap_item_find_id(km, kmi_id);
-
+ kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, true, &km);
+ BLI_assert(kmi != NULL);
+
RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
@@ -6508,9 +6508,10 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
wmKeyMap *km;
wmKeyMapItem *kmi;
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
- int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, true, &km);
-
- kmi = WM_keymap_item_find_id(km, kmi_id);
+
+ kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, true, &km);
+ BLI_assert(kmi != NULL);
+
WM_keymap_remove_item(km, kmi);
but_shortcut_name_func(C, but, 0);
@@ -6753,12 +6754,8 @@ static bool ui_but_menu(bContext *C, uiBut *but)
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
int w = uiLayoutGetWidth(layout);
wmKeyMap *km;
- wmKeyMapItem *kmi = NULL;
/* We want to know if this op has a shortcut, be it hotkey or not. */
- int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, false, &km);
-
- if (kmi_id)
- kmi = WM_keymap_item_find_id(km, kmi_id);
+ wmKeyMapItem *kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, false, &km);
/* We do have a shortcut, but only keyboard ones are editbale that way... */
if (kmi) {