diff options
author | Ton Roosendaal <ton@blender.org> | 2010-12-15 21:09:25 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-12-15 21:09:25 +0300 |
commit | 29d2e534631ff1aa8da35549c022647734642494 (patch) | |
tree | 2740b9fadbbdcb40da1471b1ea7ebc1d54017669 | |
parent | 7e10a9e6ce3d788e28ee39c9d2e94605d2a0ba47 (diff) |
Bugfix, own collection
Using RMB on menus to change hotkeys was broken.
- the input button was on a weird place outside menu, assign
would close pulldown, so you had to reopen to check
- ESC didn't close the button, but assigned ESC as hotkey.
This key is a protected key, and always should be escaping.
- Worst bug: if you used this on a 'user keymap' it removed
all entries from the map...
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_event_types.h | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e15696d7e80..77782e56f23 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2081,6 +2081,12 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } + else if(event->type == ESCKEY) { + data->cancel= 1; + data->escapecancel= 1; + button_activate_state(C, but, BUTTON_STATE_EXIT); + } + } } @@ -4011,14 +4017,14 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetHandleFunc(block, but_shortcut_name_func, but); - uiBlockSetFlag(block, UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT); + uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); uiBlockSetDirection(block, UI_CENTER); layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style); uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0); - uiPopupBoundsBlock(block, 6, 100, 10); + uiPopupBoundsBlock(block, 6, -50, 26); uiEndBlock(C, block); return block; @@ -4056,7 +4062,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0); - uiPopupBoundsBlock(block, 6, 100, 10); + uiPopupBoundsBlock(block, 6, -50, 26); uiEndBlock(C, block); return block; diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index df635c0ccb2..a3f662cbbf3 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -652,6 +652,10 @@ wmKeyMap *WM_keymap_copy_to_user(wmKeyMap *keymap) usermap= WM_keymap_list_find(&U.keymaps, keymap->idname, keymap->spaceid, keymap->regionid); + /* XXX this function is only used by RMB setting hotkeys, and it clears maps on 2nd try this way */ + if(keymap==usermap) + return keymap; + if(!usermap) { /* not saved yet, duplicate existing */ usermap= MEM_dupallocN(keymap); diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 822b36392ce..5d7eb625f78 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -227,7 +227,7 @@ #define ISTWEAK(event) (event >= EVT_TWEAK_L && event <= EVT_GESTURE) /* test whether event type is acceptable as hotkey, excluding modifiers */ -#define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event)) && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY)) +#define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event)) && event!=ESCKEY && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY)) /* **************** BLENDER GESTURE EVENTS (0x5000) **************** */ |