splash window



Hi,

when splash screen is made by this code:

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

	GtkWidget *splash_window;
	GtkWidget *vbox;
	static struct timespec const req = { 1, 0};

	splash_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_position (GTK_WINDOW (splash_window), GTK_WIN_POS_CENTER);

	vbox = gtk_vbox_new(FALSE, 0);
        gtk_container_add(GTK_CONTAINER(splash_window), vbox);
	gtk_widget_show(vbox);

	gtk_widget_realize(splash_window);
	gdk_window_set_decorations(splash_window->window, 0);
	{
		GdkPixbuf* pixbuf;
		GtkWidget *image;

		pixbuf = gdk_pixbuf_new_from_file(image_file_path,NULL);
		image = gtk_image_new_from_pixbuf(pixbuf);

		gtk_container_add(GTK_CONTAINER(vbox), image);
		gtk_widget_realize(image);
		g_object_unref(pixbuf);

		gtk_widget_show(image);
	}

	gtk_widget_show(splash_window);
	gdk_window_process_updates(splash_window->window, TRUE);

	while(g_main_context_pending(NULL))
	  g_main_context_iteration (NULL, TRUE);

	nanosleep(&req, NULL);

	/* other code */
	do_anything();

	gtk_widget_destroy(splash_window);

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

I got a grey box at center of the screen. If I restart program quickly,
image is loaded correctly. Why?
(I have noticed that with or without "gdk_window_process_updates(splash_window->window,
TRUE);" I got same effect)
(code above it's found on gnome mail archive)

Thanks
Francesco

__________________________________________________________________
Tiscali ADSL SENZA CANONE:
Attivazione GRATIS, contributo adesione GRATIS, modem GRATIS,
50 ore di navigazione GRATIS.  ABBONARTI TI COSTA SOLO UN CLICK!
http://point.tiscali.it/adsl/index.shtml






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