Skip to content

Commit

Permalink
Fixed crash if no window has keyboard focus
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 7, 2013
1 parent 4ab350d commit 44afc2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/video/cocoa/SDL_cocoamousetap.m
Expand Up @@ -63,7 +63,7 @@
SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
SDL_Mouse *mouse = SDL_GetMouse();
SDL_Window *window = SDL_GetKeyboardFocus();
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
NSWindow *nswindow;
NSRect windowRect;
CGPoint eventLocation;

Expand Down Expand Up @@ -93,6 +93,7 @@
}

/* This is the same coordinate system as Cocoa uses. */
nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
eventLocation = CGEventGetUnflippedLocation(event);
windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];

Expand Down

0 comments on commit 44afc2a

Please sign in to comment.