glfw/glfw — pull request #153 by andripalsson (2013-10-08 23:26:49+00:00)
Title: OSX set cursor position fixes

Hi,

glfwSetCursorPos was not working properly for OSX.

#1 Calling glfwSetCursorPos and then glfwGetCursorPos did not return updated value under NORMAL and HIDDEN mode
#2 In hidden mode when the cursor was outside of the window and glfwSetCursorPos moved it inside the window, then the cursor was not hidden
#3 glfwSetCursorPos did not work in fullscreen mode since the window was not considered to be in focus.
#4 I noticed a weird behavior on MBP retina, when in fullscreen the glfwSetCursorPos was off by 200px. When I connected a monitor but still ran on the retina screen it wouldn't occur. No idea why, but calling CCWarpMouseCursorPosition directly (without conv. to screen coord) it worked.
#5 If you set the cursor mode to normal and then to disabled then the cursor was not hidden.

I have verified the patch with MBP and MBP Retina, both running OSX 10.8 and with and without external monitor.

You can find the test program I used (/examples/mouse.c) in my branch osx_mouse_test. It will print out the cursor coordinates if the mouse position was changed and 1,2,3 will switch mouse modes, M will toggle set cursor pos.
https://github.com/andripalsson/glfw/tree/osx_mouse_test

/Andri