Fix WM_event_type_mask_test ignoring wheel and gesture events

WM_event_type_mask_test checks assumed ISMOUSE macro worked for any
kind of mouse event when it only accepted buttons & motion.

Now ISMOUSE checks for any kind of mouse event,
use ISMOUSE_BUTTON/WHEEL/GESTURE for more specific checks.
This commit is contained in:
Campbell Barton
2022-07-21 15:59:54 +10:00
parent 095b8d8688
commit 7a73685460

View File

@@ -44,7 +44,10 @@ enum {
/* non-event, for example disabled timer */
EVENT_NONE = 0x0000,
/* ********** Start of Input devices. ********** */
/* ********** Start of Input devices. ********** */
/* Minimum mouse value (inclusive). */
#define _EVT_MOUSE_MIN 0x0001
/* MOUSE: 0x000x, 0x001x */
LEFTMOUSE = 0x0001,
@@ -74,6 +77,9 @@ enum {
* paint and drawing tools however will want to handle these. */
INBETWEEN_MOUSEMOVE = 0x0011,
/* Maximum keyboard value (inclusive). */
#define _EVT_MOUSE_MAX 0x0011 /* 17 */
/* IME event, GHOST_kEventImeCompositionStart in ghost */
WM_IME_COMPOSITE_START = 0x0014,
/* IME event, GHOST_kEventImeComposition in ghost */
@@ -379,8 +385,14 @@ enum {
(((event_type) >= EVT_LEFTCTRLKEY && (event_type) <= EVT_LEFTSHIFTKEY) || \
(event_type) == EVT_OSKEY)
/** Test whether the event is a mouse button. */
#define ISMOUSE(event_type) ((event_type) >= LEFTMOUSE && (event_type) <= BUTTON7MOUSE)
/**
* Test whether the event is any kind:
* #ISMOUSE_BUTTON, #ISMOUSE_WHEEL, #ISMOUSE_GESTURE & motion.
*
* \note It's best to use more specific check if possible as mixing motion/buttons/gestures
* is very broad and not necessarily obvious which kinds of events are important.
*/
#define ISMOUSE(event_type) ((event_type) >= _EVT_MOUSE_MIN && (event_type) <= _EVT_MOUSE_MAX)
/** Test whether the event is a mouse wheel. */
#define ISMOUSE_WHEEL(event_type) ((event_type) >= WHEELUPMOUSE && (event_type) <= WHEELOUTMOUSE)
/** Test whether the event is a mouse (track-pad) gesture. */