how to show animation with gtk/gdk?



hi,
i'm trying to make a program that shows "animated pictures" using gtk/gdk.
the pictures are in xpm format ( they were on to another format but i can easily 
convert them "on the fly" ).
i looked to the gtk tutorial and i found some example on how to use 
 gdk_pixmap_create_from_xpm_d() and attach them to a POPUP window .

it all works if i pick a frame , attach it to the windows through a "fixed"
and then exec gtk_main().

Problem: if i use gtk_main i can't pick-up a newer frame through
gdk_pixmap_create_from_xpm_d()  because the window is displaying
and i get "Xlib async ..." error.
if i comment gtk_main()  i can pick up next frame of my animation
but i can't display it 'cause i can't  add the fixed widget to the window 
as it was a container ( gtk_container_add( GTK_CONTAINER(mainWindow), fixed )) .

here's what it looks on to the code :

pixmap = gdk_pixmap_create_from_xpm_d(mainWindow->window,&mask,
                &style->bg[GTK_STATE_NORMAL],(gchar **)data);
gtkpix = gtk_pixmap_new (pixmap,mask);
fixed = gtk_fixed_new();
gtk_widget_show(gtkpix);
gtk_widget_set_usize(fixed, xmax, ymax);
gtk_fixed_put( GTK_FIXED(fixed), gtkpix, 0, 0 );
gtk_container_add( GTK_CONTAINER(mainWindow), fixed );
gtk_widget_show(fixed);
gtk_widget_shape_combine_mask( mainWindow, mask, 0, 0 );


where i'm in wrong ?
how could i use gtk_main() and make the "refresh" of the window 
through callback ? (i don't want to push any button , just show 
a frame every X seconds ) .

thanks Samuele 



-- 
Samuele Tonon  <samu linuxasylum net> http://www.linuxasylum.net/~samu/
Undergraduate Student  of  Computer Science at  University of Bologna, Italy    
System administrator at Computer Science Lab's, University of Bologna, Italy  
Founder & Member of A.A.H.T.
                Acid -- better living through chemistry.
                               Timothy Leary




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