Event System: exclude cursor & NDOF motion from ISHOTKEY() macro

In practice this didn't cause a bug since assigning hot-keys was also
checking for "press" events (which NDOF_MOTION doesn't generate).

Add ISNDOF_BUTTON macro which is now used by ISHOTKEY to avoid
problems in the future.
This commit is contained in:
Campbell Barton 2022-03-08 13:48:32 +11:00
parent 7b66397664
commit 08f88bba69
1 changed files with 6 additions and 1 deletions

View File

@ -244,6 +244,7 @@ enum {
NDOF_MOTION = 0x0190, /* 400 */
#define _NDOF_MIN NDOF_MOTION
#define _NDOF_BUTTON_MIN NDOF_BUTTON_MENU
/* used internally, never sent */
NDOF_BUTTON_NONE = NDOF_MOTION,
@ -296,6 +297,7 @@ enum {
NDOF_BUTTON_C = 0x01b6, /* 438 */
#define _NDOF_MAX NDOF_BUTTON_C
#define _NDOF_BUTTON_MAX NDOF_BUTTON_C
/* ********** End of Input devices. ********** */
@ -386,13 +388,16 @@ enum {
/** Test whether the event is a NDOF event. */
#define ISNDOF(event_type) ((event_type) >= _NDOF_MIN && (event_type) <= _NDOF_MAX)
#define ISNDOF_BUTTON(event_type) \
((event_type) >= _NDOF_BUTTON_MIN && (event_type) <= _NDOF_BUTTON_MAX)
#define IS_EVENT_ACTIONZONE(event_type) \
ELEM(event_type, EVT_ACTIONZONE_AREA, EVT_ACTIONZONE_REGION, EVT_ACTIONZONE_FULLSCREEN)
/** Test whether event type is acceptable as hotkey (excluding modifiers). */
#define ISHOTKEY(event_type) \
((ISKEYBOARD(event_type) || ISMOUSE(event_type) || ISNDOF(event_type)) && \
((ISKEYBOARD(event_type) || ISMOUSE_BUTTON(event_type) || ISMOUSE_WHEEL(event_type) || \
ISNDOF_BUTTON(event_type)) && \
(ISKEYMODIFIER(event_type) == false))
enum eEventType_Mask {