We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 898 - Quartz SDL_WarpCursor not symmetric with SDL_GetMouseState
Summary: Quartz SDL_WarpCursor not symmetric with SDL_GetMouseState
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 1.2.14
Hardware: x86 Mac OS X 10.6
: P2 minor
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-09 16:07 UTC by Jeremiah Morris
Modified: 2009-12-11 07:32 UTC (History)
1 user (show)

See Also:


Attachments
No-op GlobalToLocal translations in fullscreen mode (810 bytes, patch)
2009-12-09 16:07 UTC, Jeremiah Morris
Details | Diff
Use LocalToGlobal translation when warping cursor in fullscreen mode (603 bytes, patch)
2009-12-09 16:08 UTC, Jeremiah Morris
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremiah Morris 2009-12-09 16:07:17 UTC
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.
Comment 1 Jeremiah Morris 2009-12-09 16:08:07 UTC
Created attachment 458 [details]
Use LocalToGlobal translation when warping cursor in fullscreen mode
Comment 2 Sam Lantinga 2009-12-11 07:32:54 UTC
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!