[cells-gtk-devel] start-app and multithreading?
Peter Denno
peter.denno at nist.gov
Tue Dec 4 16:57:47 UTC 2007
I think Kenny intended to send this note to the whole cells-gtk-devel
list.
I've added my two cents below also.
On Tuesday 04 December 2007 11:35, you wrote:
> Peter Denno wrote:
> > On Tuesday 04 December 2007 09:57, Peter Hildebrandt wrote:
> >>Peter,
> >>
> >>thanks for your reply. I've made some progress, but before
> >>suggesting a patch I'd like to verify a few internals.
> >>
> >>The GTK/GDK doc says, that you're fine as long as you use gdk/gtk
> >>only in callback functions such as on-click-handlers. These
> >>callbacks are apparently run within the lock we supply for
> >>gtk-main. However in "Idles, timeouts, and input functions" [1]
> >>you'd need to sorround calls to gtk/gdk with the equivalent of
> >>with-gdk-threads.
> >
> > I see that the entire main loop in gtk-app is surrounded in
> > with-gdk-threads, but nothing on a finer grain. Is this the
> > problem?
> >
> >>[1]
> >>http://www.gnu.org/software/guile-gnome/docs/gdk/html/Threads.htm
> >>l
> >
> > I recall reading this page after struggling with the behavior in
> > the Win32 port of my program.
> >
> > It has been about a year since I've worked with cells-gtk (Not
> > that I don't like it, or have given up on it. I'm just busy with
> > some server stuff and hunchentoot).
> >
> >>Now I have poked around the code for a while, and did not find
> >> any of those. Does cells-gtk use "Idles, timeouts, and input
> >> functions"? If yes, where?
> >
> > I did a quick tutorial at
> > http://www.gtk.org/tutorial1.2/gtk_tut-17.html
> >
> > fgrep timeout `find . -name \*.lisp` ...
> >
> > widgets.lisp timeout-add. This is used in
> > test-gtk/test-display... In fact I have noted that this test
> > doesn't work in some lisps! I don't see in my notes where though.
> >
> > Under lispworks, gtk-app does a process-wait-with-timeout.
> >
> > Grep on idle and input doesn't show anything.
> >
> >>My second question: Is there somewhere a list of all windows
> >> that have been created using to-be? Or will I have to hack my
> >> own using
> >>
> >>:after methods? (for details why I need this, see below)
> >
> > Maybe Kenny Tilton could answer that one.
>
> I usually structure my applications with a "system" instance at the
> top, system being a family subclass, each child being a window. Or
> I go further and have system be a tree of applications of windows.
> That sort of thing. If I was doing a network app I would extend
> that to model a bigger world. Anyway, then new windows are made at
> the repl with:
>
> (push (my-new-window) (kids *sys*))
>
> Where I have bound the system instance to *sys*.
Come to think of it you could call,
(depth-first-search <root-window> #'fail #'kids :do #'(lambda (k)
(push k <whatever>)))
at any point, and <whatever> would contain the list of all widgets
found through navigating the kids slot.
#'depth-first-search and #'fail are in pod-utils. It is part of the
distribution.
>
> The other way I have been known to get to all windows is to use
> some hook offered by the windowing API, but I do not know if GTk
> offers such a beast.
>
> As for the rest, yes, many times I have wrestled with the different
> world view held by the C developer to get to the point where I can
> do iterative development in Lisp calling a C windowing library that
> expects to get a fresh process with each run. Obviously a
> make/break deal for us Lispniks, and it can indeed require detailed
> analysis of the internals of the target platform, especially at the
> edges where we are creating and disposing of windows. It took me
> more than a few hours to sort out the various sequences of
> messages/events arising during the various ways a window can be
> closed, such as by the user clicking the close box vs the
> application initiating a close in response to alt-F4 vs etc etc
>
> So you all are on the right track, don't get discouraged, use as
> much duct tape as you need to get to interactive development. And
> to be honest, if certain nasty combinations arise and force a
> complete bounce of my Lisp once a day I just get on with it. :)
>
> kt
--
Best regards,
- Peter
More information about the cells-gtk-devel
mailing list