[Bf-blender-cvs] [1638af109e4] master: WM: don't set event prevval/prevtype on cursor motion

Campbell Barton noreply at git.blender.org
Mon Mar 1 02:03:04 CET 2021


Commit: 1638af109e46522a1a24645289016922bb9ca977
Author: Campbell Barton
Date:   Mon Mar 1 11:51:53 2021 +1100
Branches: master
https://developer.blender.org/rB1638af109e46522a1a24645289016922bb9ca977

WM: don't set event prevval/prevtype on cursor motion

Currently the intended behavior regarding prevval/prevtype isn't
handled consistently. However, including cursor motion causes events
in `wm->queue` and `wm->eventstate` to behave differently,
where `wm->eventstate` ignores motion (necessary for click detection).

This makes checks from `wm->eventstate` to events in the queue fail.

This reverts 39919e35326c732141bfd2d740b19000b6bc1d51,
using the `event.type` instead of it's previous type.
This works as it includes mouse button release events.

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

M	source/blender/windowmanager/intern/wm_event_query.c
M	source/blender/windowmanager/intern/wm_event_system.c

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

diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c
index ab8f37548b7..2f5332e9672 100644
--- a/source/blender/windowmanager/intern/wm_event_query.c
+++ b/source/blender/windowmanager/intern/wm_event_query.c
@@ -280,7 +280,8 @@ int WM_event_drag_threshold(const struct wmEvent *event)
   if (WM_event_is_tablet(event)) {
     drag_threshold = U.drag_threshold_tablet;
   }
-  else if (ISMOUSE(event->prevtype)) {
+  else if (ISMOUSE(event->type)) {
+    /* Mouse button or mouse motion. */
     drag_threshold = U.drag_threshold_mouse;
   }
   else {
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index dc38bd79b7d..5d015a48246 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -4430,8 +4430,6 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
       wm_stereo3d_mouse_offset_apply(win, &event.x);
       wm_tablet_data_from_ghost(&cd->tablet, &event.tablet);
 
-      event.prevtype = event.type;
-      event.prevval = event.val;
       event.type = MOUSEMOVE;
       {
         wmEvent *event_new = wm_event_add_mousemove(win, &event);
@@ -4448,8 +4446,6 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
         oevent = *oevt;
 
         copy_v2_v2_int(&oevent.x, &event.x);
-        oevent.prevtype = oevent.type;
-        oevent.prevval = oevent.val;
         oevent.type = MOUSEMOVE;
         {
           wmEvent *event_new = wm_event_add_mousemove(owin, &oevent);



More information about the Bf-blender-cvs mailing list