On 05.11.2011 21:32, David wrote: > I was trying to find out some basics about X. I see an XFlush exists that > supposed to send all XLib queued message all at once. Wouldn't that do it, > or are the messages queued up by fltk?? This is probably the last thing I > need to work out.
David, I'm far from an X expert, but ISTR that there are more messages involved for creating a window on an X server. IIRC this is a process that needs some messages to flow to an from the server and client, resp.. If that is true, then there is no way to flush a queue and do it all at once. I can tell you from practical experience that there is a general difference between X and Windows, so that on Windows you can use just one (or maybe two) Fl::wait() calls to get a window on your display, but you need more calls to do the same on X (there was a problem of another user some time ago). This is something you really shouldn't want to care about - this is what FLTK is supposed to handle for you. > What was the reason we can't start a thread and run fltk in it? Is it in the > X issue or in fltk design issue? This is a platform dependent restriction, i.e. on one platform it may work, but on another platform it may fail. Hence, there is the guideline not to use threads (other than the main thread) to create and delete windows. Other GUI actions (changing widget attributes etc.) are allowed and work in threads, if you use Fl::lock() etc.. This is (or should be) described in the docs - RTFM. > If I could at least start a thread that does nothing but run do a wait(.5) > loop and exited when signal is detected from main thread for it to end. The thread that runs the wait loop *will* execute all GUI functions WRT the OS, i.e. it will also create and delete windows, and that should be avoided if you want to write portable code that runs reliably on different platforms. Honestly said: what you are trying to do is to find out if something works that is said to be avoided, because it can't work reliably. Think about it: even if you find it to work in your use cases when you're testing, there may be other cases where it fails. Is it worth the effort? Albrecht _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

