input: add MP_KEY_IS_AXIS and treat MP_AXIS_* as mouse events

MP_AXIS_* events are semantically equivalent to scroll button events
(eg. MP_MOUSE_BTN{3,4,5,6}). They depend on the mouse position.
This commit is contained in:
James Ross-Gowan 2017-04-24 22:00:20 +10:00
parent 2b616c0682
commit cc6922cf06
1 changed files with 8 additions and 2 deletions

View File

@ -172,6 +172,10 @@
#define MP_AXIS_DOWN (MP_AXIS_BASE+1)
#define MP_AXIS_LEFT (MP_AXIS_BASE+2)
#define MP_AXIS_RIGHT (MP_AXIS_BASE+3)
#define MP_AXIS_END (MP_AXIS_BASE+4)
#define MP_KEY_IS_AXIS(code) \
((code) >= MP_AXIS_BASE && (code) < MP_AXIS_END)
// Reserved area. Can be used for keys that have no explicit names assigned,
// but should be mappable by the user anyway.
@ -195,10 +199,12 @@
// Whether to dispatch the key binding by current mouse position.
#define MP_KEY_DEPENDS_ON_MOUSE_POS(code) \
(MP_KEY_IS_MOUSE_CLICK(code) || (code) == MP_KEY_MOUSE_MOVE)
(MP_KEY_IS_MOUSE_CLICK(code) || MP_KEY_IS_AXIS(code) || \
(code) == MP_KEY_MOUSE_MOVE)
#define MP_KEY_IS_MOUSE(code) \
(MP_KEY_IS_MOUSE_CLICK(code) || MP_KEY_IS_MOUSE_MOVE(code))
(MP_KEY_IS_MOUSE_CLICK(code) || MP_KEY_IS_AXIS(code) || \
MP_KEY_IS_MOUSE_MOVE(code))
// No input source should generate this.
#define MP_KEY_UNMAPPED (MP_KEY_INTERN+4)