Commit c558493b authored by Sam Lantinga's avatar Sam Lantinga

Adam Strzelecki to SDL

Sending a patch for fullscreen Mac OS X SDL 1.3 (SVN) Cocoa mouse position handling. In fullscreen mouse coordinates should be relative to SCREEN not to the window, which doesn't really occupy fullscreen.
Without this patch mouse position (especially Y) was totally incorrect (shifted) in fullscreen.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404132
parent 78dec43e
...@@ -239,6 +239,15 @@ static __inline__ void ConvertNSRect(NSRect *r) ...@@ -239,6 +239,15 @@ static __inline__ void ConvertNSRect(NSRect *r)
mouse = SDL_GetMouse(index); mouse = SDL_GetMouse(index);
point = [NSEvent mouseLocation]; point = [NSEvent mouseLocation];
if ( (window->flags & SDL_WINDOW_FULLSCREEN) ) {
rect.size.width = CGDisplayPixelsWide(kCGDirectMainDisplay);
rect.size.height = CGDisplayPixelsHigh(kCGDirectMainDisplay);
point.y = rect.size.height - point.y;
} else {
rect = [_data->window contentRectForFrameRect:[_data->window frame]];
point.x = point.x - rect.origin.x;
point.y = rect.size.height - (point.y - rect.origin.y);
}
point.x = point.x - rect.origin.x; point.x = point.x - rect.origin.x;
point.y = rect.size.height - (point.y - rect.origin.y); point.y = rect.size.height - (point.y - rect.origin.y);
if ( point.x < 0 || point.x >= rect.size.width || if ( point.x < 0 || point.x >= rect.size.width ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment