From ded95e5673dad942e93810334ec71fbc777f90b2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 11 Dec 2009 15:31:37 +0000 Subject: [PATCH] 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video/quartz/SDL_QuartzWM.m b/src/video/quartz/SDL_QuartzWM.m index b0c4002c3..a6121df05 100644 --- a/src/video/quartz/SDL_QuartzWM.m +++ b/src/video/quartz/SDL_QuartzWM.m @@ -151,14 +151,16 @@ int QZ_ShowWMCursor (_THIS, WMcursor *cursor) { /* Convert Cocoa screen coordinate to Cocoa window coordinate */ void QZ_PrivateGlobalToLocal (_THIS, NSPoint *p) { - *p = [ qz_window convertScreenToBase:*p ]; + if ( ! CGDisplayIsCaptured (display_id) ) + *p = [ qz_window convertScreenToBase:*p ]; } /* Convert Cocoa window coordinate to Cocoa screen coordinate */ void QZ_PrivateLocalToGlobal (_THIS, NSPoint *p) { - *p = [ qz_window convertBaseToScreen:*p ]; + if ( ! CGDisplayIsCaptured (display_id) ) + *p = [ qz_window convertBaseToScreen:*p ]; } /* Convert SDL coordinate to Cocoa coordinate */