The Surprises wrote: > I am developing a gtk app that uses motion events to capture mouse > pointer location and continuously update a gtk label. I have also > implemented routines to drag various gnome canvas items around a canvas. > I have found that calling the gtk_label_set_text routine to update the > label significantly degrades performance of the app. There is a serious > lag during fast canvas item drag that disappears completely when I > comment out the gtk_label_set_text call. Without this line, the items > drag completely smooth even at full screen zoom. With the line, I get > smooth scrolling up to a certain app size, any larger causes slowdown. > > The label, along with the canvas, is packed into a table. My thinking > is that the label changing text is causing all the widgets within the > table to trigger a size_allocate or something. The bigger the app, the > more expensive the size allocate. I did notice that the label widget > changes size depending on the text size. I played around with various > packing options (x expand, fill, etc, etc), but couldn't get any > improvement. Any ideas on how to fix this?
Hi, as an experiment you could try gtk_widget_set_usize(100,100) on the label. This would give it a useless but fixed size ... if your app still runs slowly, you'll be able to rule out resizing problems. Another solution would be to add a timer to your motion callback, and limit label updates to no more than (eg.) 5 per second. That should be fast enough for the user and it'll take the CPU load right down. John ========================================================== Madame de Pompadour Images of a Mistress 16 October 2002 - 12 January 2003 For information and tickets: http://www.nationalgallery.org.uk/exhibitions/pompadour/default.htm _______________________________________________ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
