Cleanup: remove references to key-map modifier values denoting order

This feature was never exposed to users.
This commit is contained in:
Campbell Barton 2022-03-03 13:56:05 +11:00
parent 3c175caaa3
commit ef431a8705
Notes: blender-bot 2023-02-14 11:07:28 +01:00
Referenced by issue #95591, Crash on drawing with measure tool
2 changed files with 10 additions and 15 deletions

View File

@ -364,7 +364,7 @@ typedef struct wmKeyMapItem {
int8_t val;
/** Use when `val == WM_CLICK_DRAG`, */
int8_t direction;
/** `oskey` also known as apple, windows-key or super, value denotes order of pressed. */
/** `oskey` also known as apple, windows-key or super. */
short shift, ctrl, alt, oskey;
/** Raw-key modifier. */
short keymodifier;

View File

@ -2037,33 +2037,28 @@ static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi)
}
}
const bool shift = (winevent->modifier & KM_SHIFT) != 0;
const bool ctrl = (winevent->modifier & KM_CTRL) != 0;
const bool alt = (winevent->modifier & KM_ALT) != 0;
const bool oskey = (winevent->modifier & KM_OSKEY) != 0;
/* 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. */
/* Account for rare case of when these keys are used as the 'type' not as modifiers. */
if (kmi->shift != KM_ANY) {
if ((shift != kmi->shift) && !(shift & kmi->shift) &&
!ELEM(winevent->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) {
const bool shift = (winevent->modifier & KM_SHIFT) != 0;
if ((shift != kmi->shift) && !ELEM(winevent->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY)) {
return false;
}
}
if (kmi->ctrl != KM_ANY) {
if (ctrl != kmi->ctrl && !(ctrl & kmi->ctrl) &&
!ELEM(winevent->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) {
const bool ctrl = (winevent->modifier & KM_CTRL) != 0;
if (ctrl != kmi->ctrl && !ELEM(winevent->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) {
return false;
}
}
if (kmi->alt != KM_ANY) {
if (alt != kmi->alt && !(alt & kmi->alt) &&
!ELEM(winevent->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY)) {
const bool alt = (winevent->modifier & KM_ALT) != 0;
if (alt != kmi->alt && !ELEM(winevent->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY)) {
return false;
}
}
if (kmi->oskey != KM_ANY) {
if (oskey != kmi->oskey && !(oskey & kmi->oskey) && (winevent->type != EVT_OSKEY)) {
const bool oskey = (winevent->modifier & KM_OSKEY) != 0;
if ((oskey != kmi->oskey) && (winevent->type != EVT_OSKEY)) {
return false;
}
}