gtk_main_loop callback?



I have come into a dilema.  Currently I use TWO event loops.  1 is the event
loop of a library developed by our company (and is closed source) and the
other is GTK's main loop.  Up till now, I have got away with using the
inhouse event loop and every time there is an event, i also
gtk_main_iterate() GTK's events.

The main problem with this is that before GTK's events will be processed, an
event in our own library must first occur.  I have recently noticed a
problem in my software where I receive an event on a socket (handled my our
library) and following that, I update a GtkLabel.  Now because there are no
pending events in our queue, the GTK event loop does not get iterated.  If
the mouse is moved over the window of a key is pressed or something about
the window's focus, etc changes, then the modifications are applied.

Now if I understand it correctly, this means that there will always be a
problem running the two event loops.  If the table are turned and we iterate
our own event loop, then it requires events generated by GTK, and if it is a
socket event we are expecting, that won't work.

Is it possible at all to have a function which GTK calls when events are
pending?  Perhaps by calling gtk_events_pending_callback() ?

If anyone has had this problem before, or has further ideas, let me know...
Any thoughts?

Regards,
Martyn



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]