Fix T88386: Continuous Grab occasionally jumping on Arm64 MacOS

During the processing of a continuous drag event, other mouse move
events may be in the queue waiting to be processed.

But when a mouse wrapping happens, these waiting mouse move events
become out of date as they report a mouse position prior to wrapping.

The current code ignores these events by comparing their `timestamp` to
the time recorded in the last mouse wrapping.

The bug happens because the computed value in
`mach_absolute_time() * 1e-9` for some reason is incompatible with the
value of `[event timestamp]`.

Since macOS 10.6, we have a new way to get the amount of time the
system has been awake. `[[NSProcessInfo processInfo] systemUptime]`.

Using this updated method fixed the problem.

Differential Revision: https://developer.blender.org/D12202
This commit is contained in:
Germano Cavalcante 2021-08-11 23:28:34 -03:00
parent 6293cf6131
commit 215734bc52
Notes: blender-bot 2023-02-14 06:17:14 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #92045, The cursor jumps sharply when it goes outside the viewport border
Referenced by issue #88386, arm64: Viewport and Timeline jump large distances when scrolling the pointer off screen using Shift-Middle Mouse
1 changed files with 1 additions and 1 deletions

View File

@ -1629,7 +1629,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
y_accum + (y_mouse - warped_y_mouse));
/* This is the current time that matches NSEvent timestamp. */
m_last_warp_timestamp = mach_absolute_time() * 1e-9;
m_last_warp_timestamp = [[NSProcessInfo processInfo] systemUptime];
}
// Generate event