| Summary: | Quartz SDL_WarpCursor not symmetric with SDL_GetMouseState | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Jeremiah Morris <bugzilla> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | minor | ||
| Priority: | P2 | CC: | wolfy |
| Version: | 1.2.14 | ||
| Hardware: | x86 | ||
| OS: | Mac OS X 10.6 | ||
| Attachments: |
No-op GlobalToLocal translations in fullscreen mode
Use LocalToGlobal translation when warping cursor in fullscreen mode |
||
Created attachment 458 [details]
Use LocalToGlobal translation when warping cursor in fullscreen mode
I opted to make the translation a no-op in fullscreen mode, which I think is the correct fix and matches what I do in SDL 1.3. Thanks! |
Created attachment 457 [details] No-op GlobalToLocal translations in fullscreen mode On my MacBook Pro running 10.6, I noticed a small upward bias on mouse movement in a fullscreen SDL application. The app uses WarpCursor and GetMouseState in a loop to measure relative movement. I tracked it down to NSWindow's convertBaseToScreen: routine, which added a 2-pixel offset on the Y coordinate instead of the expected (+0,+0) translation. In fullscreen mode, QZ_PrivateWarpCursor() does not translate the desired position through QZ_PrivateGlobalToLocal() before passing it to the Core Graphics system. However, QZ_GetMouseLocation() does call the reverse QZ_PrivateLocalToGlobal() even in fullscreen mode. This asymmetry caused problems each time the mouse was moved. I see two solutions: either skip the convertBaseToScreen: translation in fullscreen mode, or add it on the warping side to match the GetMouse side. I didn't try lining the cursor up with a pixel in SDL window coordinates, so I don't know which solution is more correct; I'm attaching patches for both cases.