}
}
-static gboolean
+static gboolean UNUSED
print_startup_time (gpointer data)
{
g_timer_stop (startup);
return FALSE;
}
-static GMemVTable vtable =
- {
- xmalloc,
- xrealloc,
- free,
- xcalloc,
- malloc,
- realloc
- };
-
#ifdef __APPLE__
static const bool apple = true;
#else
}
\f
-
-struct init_source
-{
- GSource parent;
- int state;
- GMainLoop *loop;
- gchar *file;
-};
-
-
gboolean
init_prepare (GSource *source, gint *timeout_)
{
{
struct init_source *is = (struct init_source *)ss;
- bool finished = initialize (is->file, is->state++);
+ bool finished = initialize (is);
+ is->state++;
if (finished)
{
set_program_name (argv[0]);
- g_mem_set_vtable (&vtable);
-
#if !GLIB_CHECK_VERSION(2,32,0)
/* g_thread_init() was required before glib 2.32, but it is deprecated since
then and calling it yields a compile-time warning. */
startup = g_timer_new ();
g_timer_start (startup);
- if ( ! gtk_parse_args (&argc, &argv) )
- {
- perror ("Error parsing arguments");
- exit (1);
- }
-
if ( (vers = gtk_check_version (GTK_MAJOR_VERSION,
GTK_MINOR_VERSION,
GTK_MICRO_VERSION)) )
exit (EXIT_FAILURE);
argv_parser_destroy (parser);
- /* Initialise GDK. Theoretically this call can remove options from argc,argv if
- it thinks they are gdk options.
- However there shouldn't be any here because of the gtk_parse_args call above. */
+ /* Initialise GDK. GTK gets initialized later. */
gdk_init (&argc, &argv);
GMainContext *context = g_main_context_new ();
g_source_attach (ss, context);
+ ((struct init_source *) ss)->argc = &argc;
+ ((struct init_source *) ss)->argv = &argv;
((struct init_source *) ss)->loop = loop;
((struct init_source *) ss)->file = optind < argc ? argv[optind] : NULL;
g_main_loop_unref (loop);
g_main_context_unref (context);
- if (win)
+ if (win)
g_timeout_add (500, destroy_splash_window, win);
-
+
gtk_main ();
/* Not much point in this except to check for memory leaks */
splash_prepare (GSource *source,
gint *timeout_)
{
+ GdkEvent *e = gdk_event_peek ();
+ if (!e)
+ return FALSE;
+
+ gdk_event_free (e);
return TRUE;
}
gboolean
splash_check (GSource *source)
{
+ GdkEvent *e = gdk_event_peek ();
+ if (!e)
+ return FALSE;
+
+ gdk_event_free (e);
return TRUE;
}
+
gboolean
splash_dispatch (GSource *ss,
GSourceFunc callback,
gpointer user_data)
{
struct splash_source *source = (struct splash_source *) ss;
-
GdkEvent *e = gdk_event_get ();
if (!e)
- return FALSE;
+ return TRUE;
GdkWindow *w = ((GdkEventAny *)e)->window;
}
fill_splash_window (w, source->sfc);
+ gdk_display_flush (gdk_window_get_display (w));
- gdk_window_show (w);
gdk_event_free (e);
return TRUE;