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:
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r--source/blender/editors/interface/interface_handlers.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index d912610637f..8c91030704c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3968,35 +3968,31 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
uiBut *but = (uiBut *)arg1;
if (but->optype) {
- char buf[512], *butstr, *cpoin;
+ char buf[512], *cpoin;
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
/* complex code to change name of button */
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
wmKeyMap *km= NULL;
+ char *butstr_orig;
- butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps");
-
// XXX but->str changed... should not, remove the hotkey from it
cpoin= strchr(but->str, '|');
if(cpoin) *cpoin= 0;
-
- strcpy(butstr, but->str);
- strcat(butstr, "|");
- strcat(butstr, buf);
-
+
+ butstr_orig= BLI_strdup(but->str);
+ BLI_snprintf(but->strdata, sizeof(but->strdata), "%s|%s", butstr_orig, buf);
+ MEM_freeN(butstr_orig);
but->str= but->strdata;
- BLI_strncpy(but->str, butstr, sizeof(but->strdata));
- MEM_freeN(butstr);
-
+
ui_check_but(but);
-
+
/* set the keymap editable else the key wont save */
WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
WM_keymap_copy_to_user(km);
-
- } else {
+ }
+ else {
/* shortcut was removed */
cpoin= strchr(but->str, '|');
if(cpoin) *cpoin= 0;