Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-07-21 08:59:54 +0300
committerCampbell Barton <campbell@blender.org>2022-07-21 09:07:11 +0300
commit7a736854603b640ca2a384a6cf05d0afc7fbe6dd (patch)
tree2b0142265a8ad615c3c1efd47c03ebf752a769fc /source/blender/windowmanager/wm_event_types.h
parent095b8d8688f689ac3428e72e8831808fe9263db2 (diff)
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.
Diffstat (limited to 'source/blender/windowmanager/wm_event_types.h')
-rw-r--r--source/blender/windowmanager/wm_event_types.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 2911c74e5a4..c356b275a7e 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -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. */