/* -*-C-*-
-Copyright (C) 2008, 2009, 2010, 2011 Matthew Birkholz
+Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Matthew Birkholz
This file is part of MIT/GNU Scheme.
if (src->time_limit == 0.0)
{
trace (";scheme_source_prepare: polling\n");
- /* 0 here does not allow expose events to be delivered? */
*timeout = 0;
return (FALSE);
}
static gboolean
do_scheme (GSource *source)
{
- SchemeSource * src = (SchemeSource *)source;
-
slice_counter += 1;
- if (slice_window != NULL)
- {
- gchar * fdstr, * text;
-
- text = g_strdup_printf ("Scheme time-slice: %d", slice_counter);
- gtk_label_set_text (GTK_LABEL (slice_label), text);
- g_free (text);
-
- fdstr = gpollfds_string (src->gpollfds);
- text = g_strdup_printf ("Channels:%s", fdstr);
- if (fdstr[0] != '\0')
- g_free (fdstr);
- gtk_label_set_text (GTK_LABEL (status_label), text);
- g_free (text);
- }
trace (";scheme_source_dispatch: running time slice %d\n", slice_counter);
Interpret (1);
if (fdstr[0] != '\0')
g_free (fdstr);
}
+
+ /* Update the time-slice window before "sleeping". */
+ if (slice_window != NULL)
+ {
+ gchar * fdstr, * text;
+
+ text = g_strdup_printf ("Scheme time-slice: %d", slice_counter);
+ gtk_label_set_text (GTK_LABEL (slice_label), text);
+ g_free (text);
+ fdstr = gpollfds_string (scheme_source->gpollfds);
+ text = g_strdup_printf ("Channels:%s", fdstr);
+ if (fdstr[0] != '\0')
+ g_free (fdstr);
+ gtk_label_set_text (GTK_LABEL (status_label), text);
+ g_free (text);
+ }
+
/* Force expose event delivery, so that animations continue to move
even when Scheme is not "idle". */
gdk_window_process_all_updates ();
{
slice_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkWidget * grid = gtk_grid_new ();
- status_label = gtk_label_new ("Channels:");
+ status_label = gtk_label_new ("Channels: -");
slice_label = gtk_label_new ("Scheme time-slice: 0");
g_signal_connect (slice_window, "delete_event",
G_CALLBACK (slice_window_delete_event), NULL);
gtk_container_add (GTK_CONTAINER (grid), status_label);
gtk_container_add (GTK_CONTAINER (grid), slice_label);
gtk_container_add (GTK_CONTAINER (slice_window), grid);
- gtk_container_set_border_width (GTK_CONTAINER (slice_window), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (slice_window), 5);
gtk_window_set_title (GTK_WINDOW (slice_window), "Scheme Time-Slice Counter");
gtk_window_set_type_hint (GTK_WINDOW (slice_window),
GDK_WINDOW_TYPE_HINT_UTILITY);