Fixed bug #898 SDL-1.2
authorSam Lantinga
Fri, 11 Dec 2009 15:31:37 +0000
branchSDL-1.2
changeset 43922b8c1aea633b
parent 4391 07b330419439
child 4393 9afe12fb4c41
Fixed bug #898

Jeremiah Morris 2009-12-09 16:07:17 PST

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.
src/video/quartz/SDL_QuartzWM.m
     1.1 --- a/src/video/quartz/SDL_QuartzWM.m	Fri Dec 11 15:24:53 2009 +0000
     1.2 +++ b/src/video/quartz/SDL_QuartzWM.m	Fri Dec 11 15:31:37 2009 +0000
     1.3 @@ -151,14 +151,16 @@
     1.4  /* Convert Cocoa screen coordinate to Cocoa window coordinate */
     1.5  void QZ_PrivateGlobalToLocal (_THIS, NSPoint *p) {
     1.6  
     1.7 -    *p = [ qz_window convertScreenToBase:*p ];
     1.8 +	if ( ! CGDisplayIsCaptured (display_id) )
     1.9 +		*p = [ qz_window convertScreenToBase:*p ];
    1.10  }
    1.11  
    1.12  
    1.13  /* Convert Cocoa window coordinate to Cocoa screen coordinate */
    1.14  void QZ_PrivateLocalToGlobal (_THIS, NSPoint *p) {
    1.15  
    1.16 -    *p = [ qz_window convertBaseToScreen:*p ];
    1.17 +	if ( ! CGDisplayIsCaptured (display_id) )
    1.18 +		*p = [ qz_window convertBaseToScreen:*p ];
    1.19  }
    1.20  
    1.21  /* Convert SDL coordinate to Cocoa coordinate */