]> git.draconx.ca Git - rrace.git/blobdiff - src/x11.c
Right clicking on game area now shows the objective.
[rrace.git] / src / x11.c
index ea0fdbac90a47688a38c4787a125118b93d655c1..3b4818e1f67659a9a8edad9b8971e147c8fab6a2 100644 (file)
--- a/src/x11.c
+++ b/src/x11.c
@@ -23,7 +23,7 @@
 #include <assert.h>
 
 #include <X11/Intrinsic.h>
-#include <Xm/XmStrDefs.h>
+#include <X11/StringDefs.h>
 #include <X11/Xatom.h>
 #include <X11/Shell.h>
 #include "motif.h"
@@ -171,7 +171,7 @@ void x11_redraw_goal(struct app_state *state, uint_fast32_t mask)
        Dimension w, h;
        int i;
 
-       XtVaGetValues(state->goal, XmNwidth, &w, XmNheight, &h, (char *)NULL);
+       XtVaGetValues(state->goal, XtNwidth, &w, XtNheight, &h, (char *)NULL);
        for (i = 0; i < 9; i++) {
                int x = i%3, y = i/3;
 
@@ -226,11 +226,11 @@ void x11_redraw_icon(struct app_state *state, Widget shell)
        }
 
        /*
-        * Clear and reset XmNiconPixmap otherwise it seems dtwm will not
+        * Clear and reset XtNiconPixmap otherwise it seems dtwm will not
         * notice the changed icon.
         */
-       XtVaSetValues(shell, XmNiconPixmap, None, (char *)NULL);
-       XtVaSetValues(shell, XmNiconPixmap, state->icon_pixmap, (char *)NULL);
+       XtVaSetValues(shell, XtNiconPixmap, None, (char *)NULL);
+       XtVaSetValues(shell, XtNiconPixmap, state->icon_pixmap, (char *)NULL);
 
        if (wm_icon) {
                Atom net_wm_icon = XInternAtom(display, "_NET_WM_ICON", FALSE);
@@ -247,13 +247,21 @@ void x11_redraw_game(struct app_state *state, uint_fast32_t mask)
 {
        Display *display = XtDisplay(state->goal);
        Window game = XtWindow(state->game);
-       uint_least32_t *gp = state->board.game;
+       uint_least32_t buf[3], *gp = state->board.game;
        Dimension w, h;
        int i;
 
-       XtVaGetValues(state->game, XmNwidth, &w, XmNheight, &h, (char *)NULL);
+       XtVaGetValues(state->game, XtNwidth, &w, XtNheight, &h, (char *)NULL);
        w /= 5; h /= 5;
 
+       if (state->view_goal_on_game) {
+               for (i = 0; i < 3; i++) {
+                       buf[i] = state->board.goal[i];
+                       buf[i] = (gp[i] & ~GOAL_MASK) | (buf[i] << GOAL_SHIFT);
+               }
+               gp = buf;
+       }
+
        for (i = 0; i < 25; i++) {
                if (mask & 1) {
                        redraw_tile(state, display, game,