Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Oct 22, 2009
1 parent c49121c commit 7894b38
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -239,6 +239,15 @@ - (void)mouseMoved:(NSEvent *)theEvent
mouse = SDL_GetMouse(index);

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.y = rect.size.height - (point.y - rect.origin.y);
if ( point.x < 0 || point.x >= rect.size.width ||
Expand Down

0 comments on commit 7894b38

Please sign in to comment.