Skip to content

Commit

Permalink
Fix mouse coordinates on OS X retina displays
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Williams committed Feb 11, 2014
1 parent 1c77268 commit 335d963
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions platform/osx/os_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ - (void)mouseMoved:(NSEvent *)event
prev_mouse_y=mouse_y;
const NSRect contentRect = [OS_OSX::singleton->window_view frame];
const NSPoint p = [event locationInWindow];
mouse_x = p.x;
mouse_y = contentRect.size.height - p.y;
mouse_x = p.x * [[event window] backingScaleFactor];
mouse_y = (contentRect.size.height - p.y) * [[event window] backingScaleFactor];
ev.mouse_motion.x=mouse_x;
ev.mouse_motion.y=mouse_y;
ev.mouse_motion.global_x=mouse_x;
Expand Down

0 comments on commit 335d963

Please sign in to comment.