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

Commit

Permalink
Fixed mouse coordinates for fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 2, 2009
1 parent f287a2b commit f580a06
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -232,17 +232,16 @@ - (void)mouseMoved:(NSEvent *)theEvent
int index;
SDL_Mouse *mouse;
NSPoint point;
NSRect rect;

index = _data->videodata->mouse;
mouse = SDL_GetMouse(index);

point = [NSEvent mouseLocation];
if ( (window->flags & SDL_WINDOW_FULLSCREEN) ) {
rect.size.width = CGDisplayPixelsWide(kCGDirectMainDisplay);
rect.size.height = CGDisplayPixelsHigh(kCGDirectMainDisplay);
NSRect rect = CGDisplayBounds(_data->display);

point.x = point.x - rect.origin.x;
point.y = rect.size.height - point.y;
point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - rect.origin.y;
} else {
point.x -= window->x;
point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - window->y;
Expand Down

0 comments on commit f580a06

Please sign in to comment.