RE: How to redraw the application window of a multithreaded GTK a pp?



hello
first i think that 15 fps is too much for gtk , it explains why behaviour is
never the same...
only specialized multimedia APIs like DirectX or openGL can reach those
rates 
maybe that if u don t change ur image often u could put ur image in drawing
area back buffer (gdk_window_set_back_pixmap() )
if u do so u dont need to deal with the expose events 
hope it helps




-----Message d'origine-----
De : Joerg Vogler [mailto:vogler panasonic de]
Envoyé : mardi 24 septembre 2002 17:41
À : GTK Mailing List
Objet : How to redraw the application window of a multithreaded GTK app?


Hello,

I'm developing a multithreaded application based on GTK+ 1.2. The main
thread creates the application window and calls gtk_main() then. The
application window comprises a menu, a drawing area and a status bar.

The drawing area is intended to display a GdkImage created and manipulated
by another thread. This thread calls gtk_widget_queue_draw() periodically
(10 to 15 times per second) to let the expose_event handler of the drawing
area draw the GdkImage.

Now my problem is that the application sometimes refreshes the window as
expexted, and sometimes it doesn't. Even sometimes it runs perfectly for
several seconds and then the display freezes.

This behaviour is not determinable. If I stop and restart the application,
the behaviour may differ from the previous run.

I have surrounded all GTK operations in the background thread (i.e.
manipulation of the GdkImage as well as the calls of
gtk_widget_queue_draw()) by pairs of gdk_threads_enter() and
gdk_threads_leave(). But that didn't help.

Also the call of gdk_draw_image() in my expose_event handler is surrounded
by gdk_threads_enter() and gdk_threads_leave().

Moreover, my expose_event handler executes the loop "while (g_main_iteration
(FALSE));" to process all all outstanding events. The implementation of this
loop improved the situation, but the problem described above still occurs.

Does anyone have an idea about this problem?

Regards,
Joerg

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
SG Asset Management et ses filiales declinent toute responsabilite au titre
de ce message s'il a ete altere, deforme ou falsifie.

Découvrez l'offre et les services de SG Asset Management sur le site
www.sgam.fr 

				********

This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SG Asset Management nor any of its subsidiaries or affiliates shall
be liable for the message if altered, changed or falsified. 

*************************************************************************






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