diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 19 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_keymap.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 9 |
3 files changed, 11 insertions, 19 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) { diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index 28a8340cd92..079ade0fbe3 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -110,7 +110,7 @@ const char *WM_key_event_string(const short type, const bool compact); int WM_keymap_item_raw_to_string( const short shift, const short ctrl, const short alt, const short oskey, const short keymodifier, const short val, const short type, const bool compact, const int len, char *r_str); -int WM_key_event_operator_id( +wmKeyMapItem *WM_key_event_operator( const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, const bool is_hotkey, struct wmKeyMap **r_keymap); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index fe32fd6fcdb..6c451525742 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1298,17 +1298,12 @@ char *WM_key_event_operator_string( return NULL; } -int WM_key_event_operator_id( +wmKeyMapItem *WM_key_event_operator( const bContext *C, const char *opname, int opcontext, IDProperty *properties, const bool is_hotkey, wmKeyMap **r_keymap) { - wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, is_hotkey, true, r_keymap); - - if (kmi) - return kmi->id; - else - return 0; + return wm_keymap_item_find(C, opname, opcontext, properties, is_hotkey, true, r_keymap); } int WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2) |