[Bf-blender-cvs] [72d1545ec20] master: Cleanup: minor change to click detection checks

Campbell Barton noreply at git.blender.org
Mon Mar 1 08:29:39 CET 2021


Commit: 72d1545ec202c61d02c3024a61605b045d2c2640
Author: Campbell Barton
Date:   Mon Mar 1 12:21:57 2021 +1100
Branches: master
https://developer.blender.org/rB72d1545ec202c61d02c3024a61605b045d2c2640

Cleanup: minor change to click detection checks

Change order of checks for more convenient click-detection debugging.

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

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 5d015a48246..9188cac3ed7 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2999,29 +2999,32 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 
       if (win && win->eventstate->prevtype == event->type) {
 
-        if ((event->val == KM_RELEASE) && (win->eventstate->prevval == KM_PRESS) &&
-            (win->eventstate->check_click == true)) {
-          if (WM_event_drag_test(event, &win->eventstate->prevclickx)) {
-            win->eventstate->check_click = 0;
-            win->eventstate->check_drag = 0;
-          }
-          else {
-            /* Position is where the actual click happens, for more
-             * accurate selecting in case the mouse drifts a little. */
-            int x = event->x;
-            int y = event->y;
+        if (event->val == KM_RELEASE) {
+          if (win->eventstate->prevval == KM_PRESS) {
+            if (win->eventstate->check_click == true) {
+              if (WM_event_drag_test(event, &win->eventstate->prevclickx)) {
+                win->eventstate->check_click = 0;
+                win->eventstate->check_drag = 0;
+              }
+              else {
+                /* Position is where the actual click happens, for more
+                 * accurate selecting in case the mouse drifts a little. */
+                int x = event->x;
+                int y = event->y;
 
-            event->x = win->eventstate->prevclickx;
-            event->y = win->eventstate->prevclicky;
-            event->val = KM_CLICK;
+                event->x = event->prevclickx;
+                event->y = event->prevclicky;
+                event->val = KM_CLICK;
 
-            CLOG_INFO(WM_LOG_HANDLERS, 1, "handling CLICK");
+                CLOG_INFO(WM_LOG_HANDLERS, 1, "handling CLICK");
 
-            action |= wm_handlers_do_intern(C, event, handlers);
+                action |= wm_handlers_do_intern(C, event, handlers);
 
-            event->val = KM_RELEASE;
-            event->x = x;
-            event->y = y;
+                event->val = KM_RELEASE;
+                event->x = x;
+                event->y = y;
+              }
+            }
           }
         }
         else if (event->val == KM_DBL_CLICK) {



More information about the Bf-blender-cvs mailing list