[Bf-blender-cvs] [b5f7e634a6f] grab_walk_fix: Consolidate repeat actions.

Nicholas Rishel noreply at git.blender.org
Sat Jul 24 00:27:51 CEST 2021


Commit: b5f7e634a6f62496de16d19b7d36d39e8ea169be
Author: Nicholas Rishel
Date:   Fri Jul 23 14:39:27 2021 -0700
Branches: grab_walk_fix
https://developer.blender.org/rBb5f7e634a6f62496de16d19b7d36d39e8ea169be

Consolidate repeat actions.

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

M	intern/ghost/intern/GHOST_SystemWin32.cpp

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

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index b1dcd1bb47f..2af85fe8efa 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1114,24 +1114,26 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
     bounds.wrapPoint(x_new, y_new, 2, window->getCursorGrabAxis());
 
     window->getCursorGrabAccum(x_accum, y_accum);
+    int32_t warpX = x_new - x_screen;
+    int32_t warpY = y_new - y_screen;
     if (x_new != x_screen || y_new != y_screen) {
       system->setCursorPosition(x_new, y_new); /* wrap */
 
       /* We may be in an event before cursor wrap has taken effect */
-      if (window->m_activeWarpX >= 0 && x_new - x_screen < 0 ||
-          window->m_activeWarpX <= 0 && x_new - x_screen > 0) {
-        x_accum = x_accum + (x_screen - x_new);
+      if (window->m_activeWarpX >= 0 && warpX < 0 ||
+          window->m_activeWarpX <= 0 && warpX > 0) {
+        x_accum -= warpX;
       }
 
-      if (window->m_activeWarpY >= 0 && y_new - y_screen < 0 ||
-          window->m_activeWarpY <= 0 && y_new - y_screen > 0) {
-        y_accum = y_accum + (y_screen - y_new);
+      if (window->m_activeWarpY >= 0 && warpY < 0 ||
+          window->m_activeWarpY <= 0 && warpY > 0) {
+        y_accum -= warpY;
       }
 
       window->setCursorGrabAccum(x_accum, y_accum);
 
-      window->m_activeWarpX = x_new - x_screen;
-      window->m_activeWarpY = y_new - y_screen;
+      window->m_activeWarpX = warpX;
+      window->m_activeWarpY = warpY;
 
       /* When wrapping we don't need to add an event because the setCursorPosition call will cause
        * a new event after. We also need to skip outdated messages while warp is active to prevent



More information about the Bf-blender-cvs mailing list