]> git.draconx.ca Git - rrace.git/blobdiff - src/x11.c
Separate EWMH colour conversion from icon generation.
[rrace.git] / src / x11.c
index 0326db95049afc12827bcf656e95053a982a5353..dd59fd7e24acadb3f40e3f565273214cc17f4d2f 100644 (file)
--- a/src/x11.c
+++ b/src/x11.c
@@ -223,6 +223,7 @@ static void set_icon(struct app_state *state, Display *display,
                }
 
                XQueryColors(display, cmap, colours, XtNumber(colours));
+               ewmh_icon_prepare_cmap(colours, XtNumber(colours));
                wm_icon = ewmh_icon_generate(ewmhseq, colours);
                if (wm_icon) {
                        XChangeProperty(display, XtWindow(shell), net_wm_icon,
@@ -281,18 +282,15 @@ void x11_redraw_game(struct app_state *state, uint_fast32_t mask)
        unsigned sz = state->game_tile_sz;
        int i;
 
-       if (state->flags & FLAG_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;
-       }
+       if (state->flags & FLAG_VIEW_GOAL_ON_GAME)
+               gp = game_overlay_goal(&state->board, buf);
 
        /* Optimize the game end case where the outer frame is cleared */
-       if (((gp[0] | gp[1] | gp[2]) & ~GOAL_MASK) == 0) {
-               clear_border(display, game, sz);
-               mask &= GOAL_MASK;
+       if (mask & GAME_MASK & ~GOAL_MASK) {
+               if (((gp[0] | gp[1] | gp[2]) & ~GOAL_MASK) == 0) {
+                       clear_border(display, game, sz);
+                       mask &= GOAL_MASK;
+               }
        }
 
        for (i = 0; i < 25; i++) {