diff options
author | Ton Roosendaal <ton@blender.org> | 2009-08-16 21:42:09 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-08-16 21:42:09 +0400 |
commit | e6cd41ca448c3173dd39209657a1f5ca6c615e53 (patch) | |
tree | 1d665a18032aa272d3fe74dd952b56827b553f5c /source/blender | |
parent | 09e9537ebbe1d16f45472e3950968a984bafc5ef (diff) |
2.5
Muscle flexing commit; put the "any key modifier" to work, also exposed
(ugly) in keymap editor. Notes for it works:
- You can use any keyboard key to become modifier now (not mouse buttons)
- But, if this key was assigned to be a regular hotkey, that still gets
triggered, obviously.
- So: only use unused keys for this, like "~" or other special ones?
For test fun: L+K now does animplay.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 18 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 2 |
4 files changed, 18 insertions, 7 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 9453c7ffe09..9fcee99aa56 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3363,6 +3363,7 @@ void ED_keymap_screen(wmWindowManager *wm) /* play (forward and backwards) */ WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", KKEY, KM_PRESS, 0, LKEY); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", 1); keymap_modal_set(wm); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 33119317a6d..e676b429687 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -5162,13 +5162,13 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo } /* modifiers */ - uiBlockBeginAlign(block); uiDefButS(block, OPTION, 0, "Shift", xstart, (int)te->ys+1, butw3+5, OL_H-1, &kmi->shift, 0, 0, 0, 0, "Modifier"); xstart+= butw3+5; uiDefButS(block, OPTION, 0, "Ctrl", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->ctrl, 0, 0, 0, 0, "Modifier"); xstart+= butw3; uiDefButS(block, OPTION, 0, "Alt", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->alt, 0, 0, 0, 0, "Modifier"); xstart+= butw3; uiDefButS(block, OPTION, 0, "Cmd", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->oskey, 0, 0, 0, 0, "Modifier"); xstart+= butw3; xstart+= 5; - uiBlockEndAlign(block); + uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw3, OL_H-1, &kmi->keymodifier, "Key Modifier code"); + xstart+= butw3+5; /* rna property */ if(kmi->ptr && kmi->ptr->data) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 05be825b3bd..737028843d3 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -691,8 +691,15 @@ static int wm_eventmatch(wmEvent *winevent, wmKeymapItem *kmi) if(winevent->alt != kmi->alt && !(winevent->alt & kmi->alt)) return 0; if(kmi->oskey!=KM_ANY) if(winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) return 0; + if(kmi->keymodifier) if(winevent->keymodifier!=kmi->keymodifier) return 0; + + /* key modifiers always check when event has it */ + /* otherwise regular keypresses with keymodifier still work */ + if(winevent->keymodifier) + if(ISKEYBOARD(winevent->type)) + if(winevent->keymodifier!=kmi->keymodifier) return 0; return 1; } @@ -1509,11 +1516,6 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata) else event.type= MIDDLEMOUSE; - if(event.val) - event.keymodifier= evt->keymodifier= event.type; - else - event.keymodifier= evt->keymodifier= 0; - update_tablet_data(win, &event); wm_event_add(win, &event); @@ -1552,6 +1554,12 @@ void wm_event_add_ghostevent(wmWindow *win, int type, void *customdata) if(event.val==KM_PRESS && (evt->ctrl || evt->alt || evt->shift)) event.oskey= evt->oskey = 3; // define? } + else { + if(event.val==KM_PRESS && event.keymodifier==0) + evt->keymodifier= event.type; /* only set in eventstate, for next event */ + else if(event.val==KM_RELEASE && event.keymodifier==event.type) + event.keymodifier= evt->keymodifier= 0; + } /* if test_break set, it catches this. XXX Keep global for now? */ if(event.type==ESCKEY) diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 3006944533a..a6fbb0515bc 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -588,6 +588,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) kdata.key= GHOST_kKeyCommand; wm_event_add_ghostevent(win, GHOST_kEventKeyUp, &kdata); } + /* keymodifier zero, it hangs on hotkeys that open windows otherwise */ + win->eventstate->keymodifier= 0; /* entering window, update mouse pos. but no event */ GHOST_GetCursorPosition(g_system, &wx, &wy); |