[Bf-blender-cvs] [bf1ee49e203] master: WM: use wmEvent.is_repeat instead of previous event checks

Campbell Barton noreply at git.blender.org
Tue Mar 2 07:04:13 CET 2021


Commit: bf1ee49e2039dd27df833ce2005bacf3569cbbaa
Author: Campbell Barton
Date:   Tue Mar 2 17:02:54 2021 +1100
Branches: master
https://developer.blender.org/rBbf1ee49e2039dd27df833ce2005bacf3569cbbaa

WM: use wmEvent.is_repeat instead of previous event checks

This check was added before is_repeat was supported, use this variable
instead since it's more a more reliable way of detecting held keys.

Also remove outdated comment.

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

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 205e49c5ab4..09a9e328b6d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -4431,8 +4431,9 @@ static wmEvent *wm_event_add_trackpad(wmWindow *win, const wmEvent *event, int d
   return event_new;
 }
 
-/* Windows store own event queues, no bContext here. */
-/* Time is in 1000s of seconds, from Ghost. */
+/**
+ * Windows store own event queues #wmWindow.queue (no #bContext here).
+ */
 void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void *customdata)
 {
   if (UNLIKELY(G.f & G_FLAG_EVENT_SIMULATE)) {
@@ -4729,7 +4730,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
       /* Double click test - only for press. */
       if (event.val == KM_PRESS) {
         /* Don't reset timer & location when holding the key generates repeat events. */
-        if ((evt->prevtype != event.type) || (evt->prevval != KM_PRESS)) {
+        if (event.is_repeat == false) {
           wm_event_prev_click_set(&event, evt);
         }
       }



More information about the Bf-blender-cvs mailing list