Improved the windowShouldClose message processing.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9185 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2011-11-23 09:19:39 +00:00
parent c78bc79001
commit a1a9dbd961

View File

@ -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();