WM: correct recent change to click/drag detection
authorCampbell Barton <ideasman42@gmail.com>
Fri, 8 Jun 2018 20:17:21 +0000 (22:17 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 8 Jun 2018 20:17:21 +0000 (22:17 +0200)
fb1915d87090a - caused click/drag events not to be detected.

Now check a key is a mouse or keyboard event.

source/blender/windowmanager/intern/wm_event_system.c

index 8693fd4..d517fb2 100644 (file)
@@ -2274,7 +2274,9 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
                        }
                }
        }
-       else if (!ELEM(event->type, EVENT_NONE) && !ISTIMER(event->type)) {
+       else if (ISMOUSE(event->type) || ISKEYBOARD(event->type)) {
+               /* All events that don't set wmEvent.prevtype must be ignored. */
+
                /* test for CLICK events */
                if (wm_action_not_handled(action)) {
                        wmWindow *win = CTX_wm_window(C);
@@ -2284,11 +2286,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 
                        if (win != NULL) {
                                if (event->val == KM_PRESS) {
-                                       /* 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;
-                                       }
+                                       win->eventstate->check_click = true;
+                                       win->eventstate->check_drag = true;
                                }
                                else if (event->val == KM_RELEASE) {
                                        win->eventstate->check_drag = false;