Ok, I've figured out how to make the actual
splash screen using an undecorated window, but now I face the fact that the window gets created on the top-left corner, how do I make it appear in the center of the screen always?
edit: I should really first look into the API reference before posting
BTW I think the best way to have it
temporized would be to do so as the actual callback function, that while it's running the main window will not appear. Here's the code that (thus far) I have:
Code:
/* Test program to see if a splash image can be loaded prior a program window */
#include <gtk/gtk.h>
static GtkWidget *splash (void)
{
static GtkWidget *splash;
GtkWidget *imgbox;
GtkWidget *image;
/* Splash window */
splash = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* Not managed window */
gtk_window_set_decorated (GTK_WINDOW (splash), FALSE);
gtk_window_set_psoition (GTK_WINDOW (splash), GTK_WIN_POS_CENTER_ALWAYS);
/* Image container box */
imgbox = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (splash), imgbox);
/* Image */
image = gtk_image_new_from_file ("/path/to/image/image.xpm");
gtk_box_pack_start (GTK_BOX (imgbox), image, FALSE, FALSE, 0);
/* Set the signals */
g_signal_connect (G_OBJECT (splash), "destroy", G_CALLBACK (gtk_main_quit),NULL);
g_signal_connect (G_OBJECT (splash), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (splash);
}
int main (int argc, char **argv)
{
gtk_init (&argc, &argv);
splash ();
gtk_main ();
return 0;
}
As you can see the only way to destroy the window right now is by catching the delete_event event from the WM (in my case with FC1 and GNOME, alt-F4)
Now I've gotta get to write the code for the timed window kill