Re: [gtkmm] once again : problems with "refreshing the screen"



On Sat, Jan 18, 2003 at 03:34:23PM +0100, Bart Hakvoort wrote:
> In the attached sourcecode i have a progressbar which i use in
> "pulse-modus". Everything works fine, but you only see the bar animate
> when i focus and unfocus the applicationwindow. Otherwise nothing
> happens...

The preferred way to handle multi-threading in an application with a
GUI is to perform all GUI operations inside a single GUI thread. This
is a better programming paradigm than mixing them up inside any other
thread and leads to better separation and encapsulation, yadayada,
etc..

If you really want to be calling gtk functions throughout different
threads you should be using gdk_threads_enter()/gdk_threads_leave(),
to ensure only one thread is accessing gtk structures at one
point. But this is messy, and strongly discouraged..

There's some very decent examples of the Glib::Dispatcher in the
examples/thread directory distribution which provide a very neat way
of doing the multi-threaded, single GUI thread approach.

Barnaby




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