+static struct app_state state;
+
+static void proc_exit(Widget w, XEvent *e, String *argv, Cardinal *argc)
+{
+ XtAppSetExitFlag(XtWidgetToApplicationContext(w));
+}
+
+static void proc_new_game(Widget w, XEvent *e, String *argv, Cardinal *argc)
+{
+ Widget shell;
+
+ for (shell = w; !XtIsWMShell(shell);)
+ shell = XtParent(shell);
+
+ game_reset(&state.board);
+ x11_redraw_goal(&state);
+ x11_redraw_game(&state);
+ x11_redraw_icon(&state, shell);
+}
+
+static const XtActionsRec menu_actions[] = {
+ { "gameNew", proc_new_game },
+ { "gameExit", proc_exit }
+};
+