mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Fix clicking 'quit' in menubar or dock not doing anything on OSX.
Now it actually closes the game
This commit is contained in:
parent
3bc620e6c5
commit
bdaae944b5
13
src/Window.c
13
src/Window.c
@ -1678,14 +1678,14 @@ static OSStatus Window_EventHandler(EventHandlerCallRef inCaller, EventRef inEve
|
||||
return eventNotHandledErr;
|
||||
}
|
||||
|
||||
static pascal OSErr HandleQuitMessage(const AppleEvent* ev, AppleEvent* reply, long handlerRefcon) {
|
||||
Window_Close();
|
||||
return 0;
|
||||
}
|
||||
typedef EventTargetRef (*GetMenuBarEventTarget_Func)(void);
|
||||
|
||||
static void Window_ConnectEvents(void) {
|
||||
static EventTypeSpec winEventTypes[] = {
|
||||
{ kEventClassApplication, kEventAppActivated },
|
||||
{ kEventClassApplication, kEventAppDeactivated },
|
||||
{ kEventClassApplication, kEventAppQuit },
|
||||
|
||||
{ kEventClassKeyboard, kEventRawKeyDown },
|
||||
{ kEventClassKeyboard, kEventRawKeyRepeat },
|
||||
{ kEventClassKeyboard, kEventRawKeyUp },
|
||||
@ -1716,7 +1716,10 @@ static void Window_ConnectEvents(void) {
|
||||
|
||||
target = GetApplicationEventTarget();
|
||||
InstallEventHandler(target, NewEventHandlerUPP(Window_EventHandler),
|
||||
Array_Elems(appEventTypes), appEventTypes, NULL, NULL);
|
||||
Array_Elems(appEventTypes), appEventTypes, NULL, NULL);
|
||||
|
||||
AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
|
||||
NewAEEventHandlerUPP(HandleQuitMessage), 0, false);
|
||||
|
||||
/* The code below is to get the menubar working. */
|
||||
/* The documentation for 'RunApplicationEventLoop' states that it installs */
|
||||
|
Loading…
x
Reference in New Issue
Block a user