mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fixed crash if no window has keyboard focus
This commit is contained in:
parent
4ab350d4f2
commit
44afc2a305
@ -63,7 +63,7 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
|
|||||||
SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
|
SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
SDL_Window *window = SDL_GetKeyboardFocus();
|
SDL_Window *window = SDL_GetKeyboardFocus();
|
||||||
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
NSWindow *nswindow;
|
||||||
NSRect windowRect;
|
NSRect windowRect;
|
||||||
CGPoint eventLocation;
|
CGPoint eventLocation;
|
||||||
|
|
||||||
@ -93,6 +93,7 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This is the same coordinate system as Cocoa uses. */
|
/* This is the same coordinate system as Cocoa uses. */
|
||||||
|
nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
||||||
eventLocation = CGEventGetUnflippedLocation(event);
|
eventLocation = CGEventGetUnflippedLocation(event);
|
||||||
windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user