summaryrefslogtreecommitdiff
path: root/src/ui-window.c
diff options
context:
space:
mode:
authorJoshua Judson Rosen2017-03-26 22:24:41 -0400
committerJoshua Judson Rosen2017-03-28 22:07:50 -0400
commit7be1d57200e9672910ae0cef74ee0074e171dbf1 (patch)
tree4f0a00643d025d9404484f4592a8f6c81bc40710 /src/ui-window.c
parentapi: accept symbols (as well as strings) (diff)
downloadgnurobots-7be1d57200e9672910ae0cef74ee0074e171dbf1.tar.gz
Invert GTK+/guile thread relationship
Making the GTK+ thread the main thread, and subordinating the guile thread, lets the GUI continue to live after the robot has died-- which means that we'll be able to switch to just doing everything in the GUI without requiring a separate xterm to see the final stats after the robot dies.
Diffstat (limited to 'src/ui-window.c')
-rw-r--r--src/ui-window.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ui-window.c b/src/ui-window.c
index fb6f2ed..e923c24 100644
--- a/src/ui-window.c
+++ b/src/ui-window.c
@@ -56,16 +56,21 @@ static void ui_window_init(UIWindow *window)
gtk_window_set_title(GTK_WINDOW(window), "GNU Robots");
gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
+
+ window->priv->cmdwin = ui_cmdwin_new();
+ window->priv->arena = ui_arena_new();
}
-void ui_window_postinit(UIWindow *window, Map* map)
+void ui_window_postinit(UIWindow *window, Map* volatile* map)
{
GtkWidget *vbox;
vbox = gtk_vbox_new(FALSE, 2);
- window->priv->cmdwin = ui_cmdwin_new();
- window->priv->arena = ui_arena_new();
- ui_arena_set_map(UI_ARENA(window->priv->arena), map);
+
+ while(!*map); /* wait for map object creation by guile thread */
+
+ /* ... because we need guile to load the map before we do this: */
+ ui_arena_set_map(UI_ARENA(window->priv->arena), *map);
/* TODO: Add menu first etc */
gtk_box_pack_start(GTK_BOX(vbox), window->priv->arena, TRUE, TRUE, 0);