On 21 May 2008, at 19:16, Peer-Timo Bremer wrote:

> Must the gui run completely in the main thread or does it only need  
> its own thread ?
>
> Meaning, what I would like to do is to create a thread that runs  
> the complete gui (all window creating, rendering, etc. will happen  
> in this thread) but for internal reasons this thread cannot be the  
> main thread. Does this has a hope of working (portable)?

Short answer is: No that won't work - the GUI needs to be in the  
*main* thread (on some platforms, that's the thread the WM system  
knows about, and it has certain "privileges" as it were.)

The long answer is "it depends" and is much more complex - for  
example, on win32 it is possible to make the child thread known to  
the WM using platform specific calls, and some X-windows systems  
don't mind at all... But for portability, better play safe.

Note also that it is (generally) only the creating, mapping,  
destroying of widgets that is restricted - you can manipulate a pre- 
existing widget from any thread (suitable locking provided, of course!)

Al alternate is to run the GUI in a different process (rather than a  
different thread) but then the communication to/from the GUI becomes  
more complex. That might suit your needs better though?




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

Reply via email to