Prevent wheel causing spurious click/drag events
authorCampbell Barton <ideasman42@gmail.com>
Fri, 8 Jun 2018 12:09:45 +0000 (14:09 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 8 Jun 2018 12:09:45 +0000 (14:09 +0200)
source/blender/windowmanager/intern/wm_event_system.c

index b9feb4cba09a9f17a4e35bf3e1c5ddb1fb719b49..8693fd401a8960032fa36413e9cf7decbdb3f127 100644 (file)
@@ -2284,8 +2284,11 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 
                        if (win != NULL) {
                                if (event->val == KM_PRESS) {
 
                        if (win != NULL) {
                                if (event->val == KM_PRESS) {
-                                       win->eventstate->check_click = true;
-                                       win->eventstate->check_drag = true;
+                                       /* Ensure the types match to prevent mouse wheel from triggering drag/clicks. */
+                                       if (event->type == win->eventstate->prevtype) {
+                                               win->eventstate->check_click = true;
+                                               win->eventstate->check_drag = true;
+                                       }
                                }
                                else if (event->val == KM_RELEASE) {
                                        win->eventstate->check_drag = false;
                                }
                                else if (event->val == KM_RELEASE) {
                                        win->eventstate->check_drag = false;