]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/cocoa/cocoawindow.m
Compatibility changes for building on OS X 10.5
[libs/gui.git] / source / graphics / cocoa / cocoawindow.m
index 9ed5133162d3c6ff791a62521b67624f38eb3550..745488bfd3dfc89863d2bf895ee4648cfd3c52fe 100644 (file)
@@ -1,11 +1,18 @@
+#import <AppKit/NSApplication.h>
 #import <AppKit/NSWindow.h>
 #import <CoreFoundation/CFArray.h>
 #include "cocoadisplay.h"
 #include "cocoawindow.h"
 
-@interface WindowDelegate: NSObject <NSWindowDelegate>
+#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+@protocol NSWindowDelegate <NSObject> @end
+#endif
 
-- (void)windowWillClose:(NSNotification *)notification;
+@interface WindowDelegate: NSObject <NSWindowDelegate> {
+       int dummy_member;
+}
+
+- (BOOL)windowShouldClose:(id)sender;
 
 @end
 
@@ -18,7 +25,6 @@ struct _CocoaWindow
 };
 
 CFMutableDictionaryRef windows = NULL;
-CFMutableArrayRef event_queue = NULL;
 
 CocoaWindow *create_window(CocoaDisplay *display, unsigned width, unsigned height, bool fullscreen, bool resizable)
 {
@@ -96,16 +102,18 @@ void hide_window(CocoaWindow *window)
 
 @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