label (or table) redrawing since gtk+-1.1.5

Hello all,

I'm having a trouble since gtk+-1.1.5 (through 1.1.12) on the redrawing
of labels in a table.  I have a window of a table that contains many
labels, occasionally updating by timeout (every second), but not all of
them at once.

My problem is that when I update one of the labels, the entire table is
redrawn.  This causes the entire window looks flashing every second.

Since it did not happen in gtk+-1.1.3, I tried to find any differences.
It seems to me by replacing the gtk_widget_queue_clear in 
gtk_label_set_text_internal() of gtk+-1.1.12 to gdk_window_clear_area()
as in gtk+-1.1.3, my problem is gone.  So there must be something wrong
in queueing widget clearing, but I haven't traced further more.

If anybody can point me anything on this, I appreciate it.

Mikihiko Nakao  ///       KEK (High Energy Accelerator Research Organization)
             ///             IPNS (Institute of Particle and Nuclear Studies)

PS. it happens in a simple program as follows, too.

#include <gtk/gtk.h>

GtkWidget *label;
int counter = 0;

gint timeout_handler(gpointer data)
	char buf[256];
	sprintf(buf, "%d", counter++ % 10);
	gtk_label_set(GTK_LABEL(label), buf);
	return TRUE;

static void destroy_handler(GtkWidget *widget, gpointer data)

int main(int argc, char *argv[])
	GtkWidget *window, *vbox, *table;
	int i, j;
	gtk_init(&argc, &argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_container_set_border_width(GTK_CONTAINER(window), 3);

	vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(window), vbox);

	table = gtk_table_new(10, 10, FALSE);
	gtk_table_set_col_spacings(GTK_TABLE(table), 10);
	gtk_table_set_row_spacings(GTK_TABLE(table), 3);
	gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, TRUE, 0);

	for (i=0; i<10; i++) {
		for (j=0; j<10; j++) {
			char buf[256];
			sprintf(buf, "%d", i*10+j);
			label = gtk_label_new(buf);
			gtk_table_attach_defaults(GTK_TABLE(table), label,
				i+0, i+1, j+0, j+1);

	/* -- destroy signal -- */
	gtk_signal_connect(GTK_OBJECT(window), "destroy",
					   GTK_SIGNAL_FUNC(destroy_handler), NULL);

	/* -- timeout -- */
	gtk_timeout_add(1000, timeout_handler, NULL);

	/* -- main loop -- */
	return 0;

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