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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user