]> git.draconx.ca Git - rrace.git/blobdiff - src/motif.c
Set default program title.
[rrace.git] / src / motif.c
index f98b3078b2fbb5600a611df90907f25830f3e39f..2d4fe94d0b1f1e5e8683cf803725c156c7daf531 100644 (file)
@@ -33,6 +33,7 @@ static const char *progname = PROGNAME;
 static const struct option lopts[] = { LOPTS_INITIALIZER, {0} };
 
 static char * const default_resources[] = {
+       "*title: RRace",
        "*game.height: 371", // 365 + 2*shadowThickness
        "*game.width: 498",
 
@@ -105,7 +106,7 @@ static Widget early_setup(XtAppContext *app, int argc, char **argv)
 
        shell = XtOpenApplication(app, PROGNAME, NULL, 0,
                                  &argc, argv, (String *)default_resources,
-                                 sessionShellWidgetClass, NULL, 0);
+                                 sessionShellWidgetClass, NULL, 0);
 
        opterr = optind = 1;
        while ((opt = getopt_long_only(argc, argv, "", lopts, NULL)) != -1) {
@@ -135,9 +136,15 @@ static void proc_exit(Widget w, XEvent *e, String *argv, Cardinal *argc)
 
 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_goal(&state, -1);
+       x11_redraw_game(&state, -1);
+       x11_redraw_icon(&state, shell);
 }
 
 static const XtActionsRec menu_actions[] = {
@@ -156,10 +163,13 @@ static XtAppContext app_initialize(int argc, char **argv)
        shell = early_setup(&app, argc, argv);
        XtAppAddActions(app, (void *)menu_actions, XtNumber(menu_actions));
        ui_initialize(&state, shell);
-       x11_initialize(&state, XtScreen(shell));
+       x11_initialize(&state, shell);
        game_reset(&state.board);
+       state.use_ewmh_icons = ewmh_probe_wm_icon(shell);
        XtRealizeWidget(shell);
 
+       x11_redraw_icon(&state, shell);
+
        return app;
 }