[Bf-blender-cvs] [08f88bba693] master: Event System: exclude cursor & NDOF motion from ISHOTKEY() macro

Campbell Barton noreply at git.blender.org
Tue Mar 8 04:01:59 CET 2022


Commit: 08f88bba6937f965e1d0d0c2f2e37dfbc25b29a5
Author: Campbell Barton
Date:   Tue Mar 8 13:48:32 2022 +1100
Branches: master
https://developer.blender.org/rB08f88bba6937f965e1d0d0c2f2e37dfbc25b29a5

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.

===================================================================

M	source/blender/windowmanager/wm_event_types.h

===================================================================

diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index d5c8c5022cc..578663b6fe8 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -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 {



More information about the Bf-blender-cvs mailing list