Fix key repeat events resetting the click timer
authorCampbell Barton <ideasman42@gmail.com>
Thu, 7 Jun 2018 14:51:03 +0000 (16:51 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 7 Jun 2018 14:52:40 +0000 (16:52 +0200)
source/blender/windowmanager/intern/wm_event_system.c

index 7c81f83..83bad28 100644 (file)
@@ -3523,9 +3523,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 
                        /* double click test - only for press */
                        if (event.val == KM_PRESS) {
-                               evt->prevclicktime = PIL_check_seconds_timer();
-                               evt->prevclickx = event.x;
-                               evt->prevclicky = event.y;
+                               /* Don't reset timer & location when holding the key generates repeat events. */
+                               if ((evt->prevtype != event.type) || (evt->prevval != KM_PRESS)) {
+                                       evt->prevclicktime = PIL_check_seconds_timer();
+                                       evt->prevclickx = event.x;
+                                       evt->prevclicky = event.y;
+                               }
                        }
 
                        wm_event_add(win, &event);