Re: [gtk-list] Re: Integrating guile-gtk with other event loops




gdt@ir.bbn.com writes:
> 
>   I am trying to figure out a way to integrate guile-gtk's event loop
>   with another event loop, specifically that of scwm.
> 
> In general I believe it is broken for a library to demand that it own
> the select loop.  

I certainly agree that it makes things more complicated. I am not
certain if the Gtk developers would be interested in integrating your
solution, but it would definitely make things easier for a lot of
packages.


> A solution to this might be to create for each
> library that can do so a function
> 
>   gtk_get_select_fds(...)
> 
>   gtk_select_result(...)
> 

Perhaps these should be in gdk rather than gtk calls, since it is
actually gdk that insists on owning the select() loop, as far as I can
tell.

> that can be called, and then have those fds from each of the N
> libraries or'd into a list, call select, 

Actually, I don't believe there is a portable way to merge two
select() fd_Sets. The interface should probably be changed to be
passed a pointer to an fd_set and a pointer int containing it's
current maximum fd plus one, and update both as appropriate. You'd
also need to be able to get a possible timeout as well, since gdk uses
that to implement gdk_timout_add.

> and then dispatch with
> gtk_select_result to the back half of select processing for that
> library.  In general, one probably has to call get_select_fds before
> each select(2) call, since what is being selected on will change.
> 
> Then, gtk_main would just call these the first routine, select, and
> the second routine; one wouldn't use gtk_main if one was controlling
> the select loop explicitly.
> 

This sounds like a fairly good idea to me, modulo the details
mentioned above.

 - Maciej



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