diff options
| author | Manolo Gouy <Manolo> | 2011-11-23 09:19:39 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-11-23 09:19:39 +0000 |
| commit | a1a9dbd961ac59bf4c49ce7f2ab478b8323d8d86 (patch) | |
| tree | eddba59b0a2aea31a22b1443f5db74b7373915e8 /src | |
| parent | c78bc7900156e39b5330f4fd6b780ca4cb202f6b (diff) | |
Improved the windowShouldClose message processing.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9185 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_cocoa.mm | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 7e6ac9517..770e2acf7 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -566,7 +566,6 @@ static void do_timer(CFRunLoopTimerRef timer, void* data) contentRect:(NSRect)rect styleMask:(NSUInteger)windowStyle; - (Fl_Window *)getFl_Window; -- (BOOL)windowShouldClose:(FLWindow *)w; - (BOOL)containsGLsubwindow; - (void)setContainsGLsubwindow:(BOOL)contains; @end @@ -587,18 +586,6 @@ static void do_timer(CFRunLoopTimerRef timer, void* data) { return w; } -- (BOOL)windowShouldClose:(FLWindow *)fl -{ - fl_lock_function(); - Fl_Window *to_close = [fl getFl_Window]; - Fl::handle( FL_CLOSE, to_close ); // this might or might not close the window - Fl::do_widget_deletion(); - if (!Fl_X::first) return YES; - Fl_Window *l = Fl::first_window(); - while( l != NULL && l != to_close) l = Fl::next_window(l); - fl_unlock_function(); - return (l == NULL ? YES : NO); -} - (BOOL)containsGLsubwindow { return containsGLsubwindow; @@ -918,6 +905,7 @@ void fl_open_callback(void (*cb)(const char *)) { - (void)windowDidBecomeMain:(NSNotification *)notif; - (void)windowDidDeminiaturize:(NSNotification *)notif; - (void)windowDidMiniaturize:(NSNotification *)notif; +- (BOOL)windowShouldClose:(id)fl; - (void)anyWindowWillClose:(NSNotification *)notif; - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; - (void)applicationDidBecomeActive:(NSNotification *)notify; @@ -1006,6 +994,14 @@ void fl_open_callback(void (*cb)(const char *)) { Fl::handle(FL_HIDE, window); fl_unlock_function(); } +- (BOOL)windowShouldClose:(id)fl +{ + fl_lock_function(); + Fl::handle( FL_CLOSE, [(FLWindow *)fl getFl_Window] ); // this might or might not close the window + fl_unlock_function(); + // the system doesn't need to send [fl close] because FLTK does it when needed + return NO; +} - (void)anyWindowWillClose:(NSNotification *)notif { fl_lock_function(); |
