I asked once to add a callback to fltk to allow manage exceptions through  
dlls and it was accepted and works fine, but now I'm facing that timeouts  
on win32 comes directly from the internal event handler giving no chance  
to catch exceptions on then.

Maybe we should as well have a placeholder on Fl:

/** Signature of user hook to call timeouts */
typedef void (*Fl_Do_Call_Timeout)(Fl_Timeout_Handler th, void *data);

static Fl_Do_Call_Timeout do_call_timeout_;

static Fl::do_call_timeout_ = 0;

// Now it is safe for the callback to do add_timeout:
if(Fl::do_call_timeout_) (*Fl::do_call_timeout_)(cb, argp);
else cb(argp);

static LRESULT CALLBACK s_TimerProc(HWND hwnd, UINT msg,
                                     WPARAM wParam, LPARAM lParam)
{
   switch (msg) {
   case WM_TIMER:
     {
...
         if (cb) {
                  if(Fl::do_call_timeout_) (*Fl::do_call_timeout_)(cb, data);
           else (*cb)(data);
         }
...
}

static void do_timer(CFRunLoopTimerRef timer, void* data)
{
  ...
   if(Fl::do_call_timeout_) (*Fl::do_call_timeout_)(t.callback, data);
   else (*t.callback)(data);
...
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to