Merged fix for bug #3528964.

This commit is contained in:
Camilla Berglund 2012-07-02 00:36:20 +02:00
parent cef9dea1d2
commit ee66e5fa10
2 changed files with 6 additions and 5 deletions

View File

@ -917,7 +917,7 @@ their skills. Special thanks go out to:</p>
<li>Steve Sexton, for reporting an input bug in the Carbon port</li>
<li>Dmitri Shuralyov, for support, bug reports and testing</li>
<li>Dmitri Shuralyov, for support, bug reports, bug fixes and testing</li>
<li>Daniel Skorupski, for reporting a bug in the Win32 DEF file</li>

View File

@ -357,12 +357,13 @@ static int convertMacKeyCode(unsigned int macKeyCode)
_glfwInputCursorMotion(window, [event deltaX], [event deltaY]);
else
{
NSPoint p = [event locationInWindow];
const NSPoint p = [event locationInWindow];
// Cocoa coordinate system has origin at lower left
p.y = [[window->NS.object contentView] bounds].size.height - p.y;
const int x = lround(floor(p.x));
const int y = window->height - lround(ceil(p.y));
_glfwInputCursorMotion(window, p.x, p.y);
_glfwInputCursorMotion(window, x, y);
}
}
@ -1168,7 +1169,7 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y)
// calculating the maximum y coordinate of all screens, since Cocoa's
// "global coordinates" are upside down from CG's...
NSPoint localPoint = NSMakePoint(x, window->height - y);
NSPoint localPoint = NSMakePoint(x, window->height - y - 1);
NSPoint globalPoint = [window->NS.object convertBaseToScreen:localPoint];
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
double mainScreenHeight = CGDisplayBounds(CGMainDisplayID()).size.height;