[Bf-blender-cvs] [90526e1606c] master: WM: improve support for binding actions to modifier keys
Campbell Barton
noreply at git.blender.org
Fri Mar 1 07:00:06 CET 2019
Commit: 90526e1606c337440a1846c968276a24945ae853
Author: Campbell Barton
Date: Fri Mar 1 16:46:10 2019 +1100
Branches: master
https://developer.blender.org/rB90526e1606c337440a1846c968276a24945ae853
WM: improve support for binding actions to modifier keys
Previously a modifier key-map type only worked when the same key was
enabled as a modifier as well.
This allows for users to assign an action to double-tap-shift for eg.
===================================================================
M source/blender/windowmanager/intern/wm_event_system.c
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index ebf09af825c..139e1a5127a 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1886,24 +1886,33 @@ static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi)
}
}
- /* modifiers also check bits, so it allows modifier order */
+ /* Modifiers also check bits, so it allows modifier order.
+ * Account for rare case of when these keys are used as the 'type' not as modifiers. */
if (kmi->shift != KM_ANY) {
- if (winevent->shift != kmi->shift && !(winevent->shift & kmi->shift)) {
+ if ((winevent->shift != kmi->shift) && !(winevent->shift & kmi->shift) &&
+ !ELEM(winevent->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
+ {
return false;
}
}
if (kmi->ctrl != KM_ANY) {
- if (winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl)) {
+ if (winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl) &&
+ !ELEM(winevent->type, LEFTCTRLKEY, RIGHTCTRLKEY))
+ {
return false;
}
}
if (kmi->alt != KM_ANY) {
- if (winevent->alt != kmi->alt && !(winevent->alt & kmi->alt)) {
+ if (winevent->alt != kmi->alt && !(winevent->alt & kmi->alt) &&
+ !ELEM(winevent->type, LEFTALTKEY, RIGHTALTKEY))
+ {
return false;
}
}
if (kmi->oskey != KM_ANY) {
- if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) {
+ if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey) &&
+ (winevent->type != OSKEY))
+ {
return false;
}
}
More information about the Bf-blender-cvs
mailing list