diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-10-30 00:15:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-10-30 00:28:28 +0300 |
commit | 9e85812acc88fa469aecccb1d5ed3e28e362278a (patch) | |
tree | 044534f696cefaf4ebb5a41cc8242d2e2a724a8e /intern/ghost | |
parent | 4a8146eb8f8d06099d3d4808e7c1cf186d6cd3cf (diff) |
Fix macOS mouse positions inaccuracy
Don't use the current mouse position at the time the event is handled, but
rather the position at the time of the event. This should make e.g. brush
stroke paths more accurate.
In addition, this may solve issues with other software that does mouse
position smoothing. Ref T82143.
Use of the current mouse position was added in 12b642062c6f as part of a
large commit that also made continuous grab work. But it appears to still
work getting the mouse position from the event.
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index c22651e2752..152dae48905 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1589,7 +1589,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } case GHOST_kGrabWrap: // Wrap cursor at area/window boundaries { - NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; + NSPoint mousePos = [event locationInWindow]; GHOST_TInt32 x_mouse = mousePos.x; GHOST_TInt32 y_mouse = mousePos.y; GHOST_Rect bounds, windowBounds, correctedBounds; @@ -1639,7 +1639,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } default: { // Normal cursor operation: send mouse position in window - NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; + NSPoint mousePos = [event locationInWindow]; GHOST_TInt32 x, y; window->clientToScreenIntern(mousePos.x, mousePos.y, x, y); @@ -1699,7 +1699,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) pushEvent(new GHOST_EventWheel([event timestamp] * 1000, window, delta)); } else { - NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; + NSPoint mousePos = [event locationInWindow]; GHOST_TInt32 x, y; double dx; double dy; @@ -1722,7 +1722,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } break; case NSEventTypeMagnify: { - NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; + NSPoint mousePos = [event locationInWindow]; GHOST_TInt32 x, y; window->clientToScreenIntern(mousePos.x, mousePos.y, x, y); pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, @@ -1735,7 +1735,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } break; case NSEventTypeSmartMagnify: { - NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; + NSPoint mousePos = [event locationInWindow]; GHOST_TInt32 x, y; window->clientToScreenIntern(mousePos.x, mousePos.y, x, y); pushEvent(new GHOST_EventTrackpad( @@ -1743,7 +1743,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) } break; case NSEventTypeRotate: { - NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; + NSPoint mousePos = [event locationInWindow]; GHOST_TInt32 x, y; window->clientToScreenIntern(mousePos.x, mousePos.y, x, y); pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, |