Cocoa: Fix coordinate transformations

Window relative mouse locations provided via NSWindow and NSEvent are
based at 0,1 while screen relative locations use 0,0.  Incorrect
handling of this had crept into other coordinate transformations.  Note
that most of these errors canceled each other out, so the reported
positions of windows, monitors and work areas are unaffected.  This
corrects the cursor position for glfwGetCursorPos and glfwSetCursorPos.

Fixes #1461.
This commit is contained in:
Camilla Löwy
2019-04-10 21:19:40 +02:00
committed by Camilla Löwy
parent d0b7f539e2
commit 3c3981a4f0
3 changed files with 18 additions and 15 deletions

View File

@@ -430,7 +430,7 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
if (xpos)
*xpos = frameRect.origin.x;
if (ypos)
*ypos = _glfwTransformYNS(frameRect.origin.y + frameRect.size.height);
*ypos = _glfwTransformYNS(frameRect.origin.y + frameRect.size.height - 1);
if (width)
*width = frameRect.size.width;
if (height)