From 335d963031bc081166b3a73d9be4bd2bef2661fc Mon Sep 17 00:00:00 2001 From: Jeremy Williams Date: Mon, 10 Feb 2014 22:27:50 -0500 Subject: [PATCH] Fix mouse coordinates on OS X retina displays --- platform/osx/os_osx.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 86d1dbb4c27..8c224ad2dba 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -378,8 +378,8 @@ static int button_mask=0; 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;