#include <gtk/gtk.h>

GtkWidget *window=NULL, *drawing_area=NULL;

gboolean periodic_function(gpointer data)
{
	GtkWidget *w = GTK_WIDGET(data);
	gtk_widget_queue_draw(w);
	return TRUE;
}

gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
{
	return TRUE;
}

int main(int argc, char *argv[])
{
	gtk_init(&argc, &argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size(GTK_WINDOW(window), 640, 480);
	drawing_area = gtk_drawing_area_new();
	gtk_container_add(GTK_CONTAINER(window), drawing_area);
	gtk_widget_set_double_buffered(drawing_area, FALSE);

    g_signal_connect(G_OBJECT(drawing_area), "expose_event", G_CALLBACK(expose_event), NULL);
	g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
	gtk_widget_show_all(window);

	g_timeout_add(10, &periodic_function, (gpointer)drawing_area);

    gtk_main();

    return 0;
}
