mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
parent
5fa3f3eb68
commit
4979a8ba3f
@ -24,6 +24,7 @@ class GraphicsEngine;
|
||||
|
||||
- (id) initWithEngine:(GraphicsEngine *)engine;
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification;
|
||||
- (BOOL)applicationShouldTerminate:(NSApplication *)app;
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification;
|
||||
|
||||
@end
|
||||
|
@ -30,9 +30,25 @@
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldTerminate:(NSApplication *)app {
|
||||
if (cocoadisplay_cat.is_debug()) {
|
||||
cocoadisplay_cat.debug()
|
||||
<< "Received applicationShouldTerminate, closing all Cocoa windows\n";
|
||||
}
|
||||
// Call performClose on all the windows. This should make ShowBase shut down.
|
||||
for (NSWindow *window in [app windows]) {
|
||||
[window performClose:nil];
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification {
|
||||
// The application is about to be closed, tell the graphics engine to close
|
||||
// all the windows.
|
||||
if (cocoadisplay_cat.is_debug()) {
|
||||
cocoadisplay_cat.debug()
|
||||
<< "Received applicationWillTerminate, removing all windows\n";
|
||||
}
|
||||
_engine->remove_all_windows();
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ class CocoaGraphicsWindow;
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification;
|
||||
- (void)windowDidResignKey:(NSNotification *)notification;
|
||||
- (BOOL)windowShouldClose:(id)sender;
|
||||
- (void)windowWillClose:(id)sender;
|
||||
|
||||
// TODO: handle fullscreen on Lion.
|
||||
|
||||
|
@ -51,11 +51,19 @@
|
||||
}
|
||||
|
||||
- (BOOL) windowShouldClose:(id)sender {
|
||||
bool should_close = _graphicsWindow->handle_close_request();
|
||||
if (should_close) {
|
||||
_graphicsWindow->handle_close_event();
|
||||
if (cocoadisplay_cat.is_debug()) {
|
||||
cocoadisplay_cat.debug()
|
||||
<< "Received windowShouldClose for window " << _graphicsWindow << "\n";
|
||||
}
|
||||
return should_close;
|
||||
return _graphicsWindow->handle_close_request();
|
||||
}
|
||||
|
||||
- (void) windowWillClose:(id)sender {
|
||||
if (cocoadisplay_cat.is_debug()) {
|
||||
cocoadisplay_cat.debug()
|
||||
<< "Received windowWillClose for window " << _graphicsWindow << "\n";
|
||||
}
|
||||
_graphicsWindow->handle_close_event();
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user