DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2134
Version: 1.3-current


The doc says to use Fl::delete_widget(Fl_Widget *) rather than the delete
statement to delete a widget inside a callback. So, window callback
functions don't delete them, but schedule them for deletion. Fair enough. 
But, on Mac OS X, this interferes with function QuitAppleEventHandler of
file Fl_mac.cxx that processes apple-Q keystrokes. The function does not
stop the program if more than one windows are displayed. The function
schedules deletion of the first window, but does not delete it, then tests
if it was deleted, and exits leaving other windows, if any, still running.
To repair that, I would suggest to add
Fl::do_widget_deletion() in the QuitAppleEventHandler function.
Alternatively, because Fl.cxx says that Fl::do_widget_deletion is for
internal use only, Fl::wait(0) works as well.
The function would then become:

static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt,
AppleEvent* reply, UInt32 refcon )
{
  fl_lock_function();

  while ( Fl_X::first ) {
    Fl_X *x = Fl_X::first;
    Fl::handle( FL_CLOSE, x->w );
//alternative solution: Fl::wait(0);
    Fl::do_widget_deletion();
    if ( Fl_X::first == x ) {
      fl_unlock_function();
      return noErr; // FLTK has not closed all windows, so we return to
the main program now
    }
  }

  fl_unlock_function();

  return noErr;
}

In my hands, apple-Q keystrokes are correctly handled after this minor
change.


Link: http://www.fltk.org/str.php?L2134
Version: 1.3-current

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

Reply via email to