incomprehensible number of main loop iteration



Hi all!

I'm creating a splashscreen window with an image
see code:
      GtkWidget *oSplashScreen;
      oSplashScreen = gtk_window_new(GTK_WINDOW_POPUP);
        gtk_window_set_position(GTK_WINDOW(oSplashScreen),GTK_WIN_POS_CENTER);
        gtk_window_set_default_size (GTK_WINDOW(oSplashScreen),500,300);
        gtk_window_set_type_hint (GTK_WINDOW(oSplashScreen),
GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);

        GtkWidget *oImage=gtk_image_new_from_file("splash.png");
      gtk_container_add(GTK_CONTAINER(oSplashScreen), oImage);
      gtk_widget_show_all(oSplashScreen);

so splash image is not visible if main loop is not called

I can not use gtk_main() function because i don't wait an event...
so I use gtk_main_iteration() function!
But call this function one time,it is not enough, the image is always
invisible...
I try several iteration, so I need six iterations to see my image
Why????

so my code is:
   gtk_widget_show_all(oSplashScreen);
   gtk_main_iteration();
   gtk_main_iteration();
   gtk_main_iteration();
   gtk_main_iteration();
   gtk_main_iteration();
   gtk_main_iteration();


Thanks!





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