Re: [gtk-list] Re: CList updates



Owen Taylor wrote:
> 
> Matt Goodall <mgg@isotek.co.uk> writes:
> 
> > Owen Taylor wrote:
> >
> > <snip>
> >
> > > Thread support in GTK+ definitely works if you know a few
> > > simple rules. There are some fairly significant apps using
> > > it - gFTP and the Red Hat installer, to list a couple.
> > >
> > > The necessary rules should be covered in the section on
> > > threading in the GTK+ FAQ.
> >
> > Thanks Owen,
> >
> > I went back to my test code after you said it definitely does work and
> > started playing with it again. I've got this widget structure:
> >
> >       GtkWindow
> >               GtkScrolledWindow
> >                       GtkCList
> >
> > The problem appears to be that I was adding the clist to the scrolled
> > window using gtk_container_add(). Once I changed this to use
> > gtk_scrolled_window_add_with_viewport() it started working perfectly.
> 
> Well, not to make things difficult :-), but you _do_ need to use
> gtk_container_add(). If you use gtk_scrolled_window_add_with_viewport(),
> then you'll have the the following problems:
> 
>  - The column titles will scroll with the clist
>  - Your CList will be limited to 32,768 pixels in height
> 
> I can't really see how this has any relation to threading, but
> maybe there is some really funky interaction going on.

Finally got some time to go back this...

I've put it back to gtk_container_add() as you (and others) recommended
and it definitely doesn't work quite right. Basically the thread is
doing this:

	while(...)
	{
		gtk_threads_enter();
		gtk_clist_append(...);
		gtk_threads_leave();
	}

Anyway, this doesn't update the clist correctly but adding a gdk_flush()
before the gdk_threads_leave() seems to solve this and everything is ok
(again).

I don't remember reading anything about gdk_flush() related to threads
so is there a problem somewhere or was I supposed to do that all along?

Cheers, Matt.

-- 
Matt Goodall             |  Isotek Electronics Ltd
email: mgg@isotek.co.uk  |  Claro House, Servia Road
Tel: +44 113 2343202     |  Leeds, LS7 1NL
Fax: +44 113 2342918     |  England



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