Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed mouse coordinates for fullscreen mode

  • Loading branch information
slouken committed Dec 2, 2009
1 parent f287a2b commit f580a06313842dd7d9887e3f33d5db5a4781c219
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/video/cocoa/SDL_cocoawindow.m
@@ -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;

0 comments on commit f580a06

Please sign in to comment.