Matthias, Thanks for the quick reply. I had to try a few things but found a working combination. All FLTK object are now created in the main thread as well as the first call to "show" the widgets and Fl::check() (or Fl::run). The only thing the separate thread does is: Fl::lock(); ... update widget data Fl::unlock();
Two things to note: - "Fl::awake" seems optional, at least on Mac OS and for what I am doing. - My initial problem was that I was calling both "Fl::check" AND "widget->show" in the separate thread. On Mac OS, it looks like both need to be in the main thread. Thanks again, it's nice to have FLTK back on Mac OS running in 64 bits mode. Anton On Jan 29, 2011, at 5:04 AM, Matthias Melcher wrote: > > On 29.01.2011, at 04:57, Anton Deguet wrote: > >> I am using fltk from MacPort (fltk-devel @1.3.x-r7794_1) on Mac OS 10.6 and >> my code doesn't work anymore. It works on Linux, Windows and used to work >> on Mac OS in the pre Cocoa era. The symptom is a blank area where widgets >> should be and the spinning beach ball. Interestingly enough, I have an >> example with an OpenGL window and this windows keeps being updated but the >> widgets still don't show up. >> >> I have no knowledge of Cocoa whatsoever so I hope this is not a hard >> limitation ... > > Haha, that's the idea with FLTK that you don't have to know a thing about > your target. > >> I did a bit of testing and it seems that the issue comes from the fact that >> all my FLTK calls are performed in a separate thread, i.e. not the "main" >> thread. Is this possibly the cause of my problem? If it is, is there a >> known solution, ideally an Fl function usable on all OSs so the code remains >> portable? > > You cant call any functions that create windows or call run, flush, wait, > etc. from a thread. These functions need to be called from the main thread. > Usually MSWindows is the platform that fails if you don't, but OS X does not > like that either. > > You can read all about this in the documentation under "Advanced: threading" > > http://www.fltk.org/doc-1.3/advanced.html > > To call anything FLTK from a thread (except the functions I mentioned above), > call > > Fl::lock(); > someWidget->value(someValue); > someOtherWidget->color(FL_RED); > someOtherWidget->redraw(); > Fl::unlock(); > Fl::awake(); > _______________________________________________ > fltk mailing list > [email protected] > http://lists.easysw.com/mailman/listinfo/fltk _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

