Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fixed crash if no window has keyboard focus
- Loading branch information
Showing
with
2 additions
and
1 deletion.
-
+2
−1
src/video/cocoa/SDL_cocoamousetap.m
|
@@ -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; |
|
|
|
|
@@ -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]]; |
|
|
|
|
|