Author: manolo
Date: 2011-11-23 01:19:39 -0800 (Wed, 23 Nov 2011)
New Revision: 9185
Log:
Improved the windowShouldClose message processing.

Modified:
   branches/branch-1.3/src/Fl_cocoa.mm

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2011-11-22 17:24:51 UTC (rev 9184)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-11-23 09:19:39 UTC (rev 9185)
@@ -566,7 +566,6 @@
              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 @@
 {
   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)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 @@
   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();

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to