@interface WindowDelegate: NSObject <NSWindowDelegate>
-- (void)windowWillClose:(NSNotification *)notification;
+- (BOOL)windowShouldClose:(id)sender;
@end
};
CFMutableDictionaryRef windows = NULL;
-CFMutableArrayRef event_queue = NULL;
CocoaWindow *create_window(CocoaDisplay *display, unsigned width, unsigned height, bool fullscreen, bool resizable)
{
@implementation WindowDelegate
-- (void)windowWillClose:(NSNotification *)notification
+- (BOOL)windowShouldClose:(id)sender
{
- CocoaWindow *window = lookup_window((NSWindow *)[notification object]);
+ CocoaWindow *window = lookup_window((NSWindow *)sender);
if(window)
{
CocoaEvent event;
event.any.type = WINDOW_CLOSED;
event.any.window = window;
queue_event(window->display, &event);
+ return NO;
}
+ return YES;
}
@end