[Bf-blender-cvs] [ae96db0cf55] master: WM: log errors when wmWindow.eventstate values are invalid
Campbell Barton
noreply at git.blender.org
Tue Mar 2 07:04:14 CET 2021
Commit: ae96db0cf5576a2995132e6478dbb3508c02e58f
Author: Campbell Barton
Date: Tue Mar 2 17:02:57 2021 +1100
Branches: master
https://developer.blender.org/rBae96db0cf5576a2995132e6478dbb3508c02e58f
WM: log errors when wmWindow.eventstate values are invalid
Ensure they're working as documented (only for debug builds).
===================================================================
M source/blender/windowmanager/intern/wm_event_system.c
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 4928bd5187d..a1a9c24d178 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -4458,6 +4458,22 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
event = *evt;
event.is_repeat = false;
+ /* Ensure the event state is correct, any deviation from this may cause bugs. */
+#ifndef NDEBUG
+ if ((evt->type || evt->val) && /* Ignore cleared event state. */
+ !(ISMOUSE_BUTTON(evt->type) || ISKEYBOARD(evt->type))) {
+ CLOG_WARN(WM_LOG_HANDLERS,
+ "Non-keyboard/mouse button found in 'win->eventstate->type = %d'",
+ evt->type);
+ }
+ if ((evt->prevtype || evt->prevval) && /* Ignore cleared event state. */
+ !(ISMOUSE_BUTTON(evt->prevtype) || ISKEYBOARD(evt->prevtype))) {
+ CLOG_WARN(WM_LOG_HANDLERS,
+ "Non-keyboard/mouse button found in 'win->eventstate->prevtype = %d'",
+ evt->prevtype);
+ }
+#endif
+
switch (type) {
/* Mouse move, also to inactive window (X11 does this). */
case GHOST_kEventCursorMove: {
More information about the Bf-blender-cvs
mailing list