On Tue, 16 Jan 2007, Matt Fischer <mattfischer84@xxxxxxxxx> wrote : >I believe it's also possible to tell the mainloop about a file >descriptor which should be watched, and have it call a function >whenever new data appears. I have never used this tactic (hopefully >someone else can clarify this) Yes - the GTK "IO Channel" structure allows this. I have used this approach to asynchronously monitor incoming data on a serial port, and it seems to work fairly well. It certainly gave me FAR fewer headaches than trying to do a similar thing on Windows! chan = g_io_channel_unix_new ( fd ); g_io_channel_set_encoding ( chan, NULL, &tErrPtr ); EventSrc = g_io_add_watch ( chan, G_IO_IN, ParseRxData, user_data ); Where ParseRxData is the data handler function: gboolean ParseRxData ( GIOChannel *source, GIOCondition condition, gpointer data ) The only oddity I'm left with is that once I've run that GTK application, the serial port in question just blocks on open for all other applications, though I can re-run the GTK app without problem. -- Rob Pearce http://www.bdt-home.demon.co.uk The contents of this | Windows NT crashed. message are purely | I am the Blue Screen of Death. my opinion. Don't | No one hears your screams. believe a word. | _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list