I'm working on an app that drives fltk from a client program. I'd like to be able to pass events out to the client and also for the client to be able to run things in fltk. So on the client end I have a thread which sits in a Fl::wait() loop. When the client wants to do some fltk stuff, it sticks the actions in a queue and calls Fl::awake(0). When wait() returns, it goes through the queue and does the actions. Now I want to be able to pull all of the UI events that have happened and do something with them on the client end.
The problem is I can't see any kind of guarantee that exactly one event was delivered since the last time wait() returned, so I can't use the Fl::event_* functions directly. One way I came up with to do this is for each window to keep a queue, and its handler append the event to the queue before going about its business. Then when wait returns I can go through each of the windows and clear out their queues. This seems like it would work but also seems clumsy. Isn't there a better way? Also, since I am only ever calling FLTK from one thread, I don't think I need all the locking and unlocking. Is there a simpler way to interrupt wait()? I gather I could wait on an fd, but that seems harder than just calling Fl::awake(). If I could deliver a custom ui event that said "message arrived", I could know that wait() returns on every arriving event, and dispense with the per-window queues. thanks! _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

