bug with themes/gtkclist



There's probably something wrong with pixmap theme engine, X server's
memory usage gets increased by 50M with the included source when running
it with BrushedMetal theme.

It needs a GtkCList widget with autoresize set in some column, create a
hundred rows and set the style of one cell for each line.

#include <gtk/gtk.h>

int main (int argc, char *argv[])
{
    static gchar *titles[] = { "Color", "Red", "Green", "Blue", "Sample text" };
    GdkColor color;
    GtkWidget *win, *scrollbox, *clist;
    GtkStyle *style;
    gint n, row;

    gtk_init (&argc, &argv);

    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    scrollbox = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollbox),
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_container_add(GTK_CONTAINER(win), scrollbox);

    clist = gtk_clist_new_with_titles(5, titles);
    gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_BROWSE);
    gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 0, TRUE);
    gtk_container_add(GTK_CONTAINER(scrollbox), clist);

    for (n = 0; n < 100; n++)
    {
	row = gtk_clist_append(GTK_CLIST(clist), titles);

	color.pixel = rand();
	style = gtk_style_copy(clist->style);
	gtk_style_ref(style);
	style->fg[0] = color;
	gtk_clist_set_cell_style(GTK_CLIST(clist), row, 4, style);
	gtk_style_unref(style);
    }

    gtk_widget_show_all(win);
    gtk_main();
    return 0;
}


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