-/* Render the goal area as the window's icon */
-void x11_redraw_icon(struct app_state *state, Widget shell)
-{
- Display *display = XtDisplay(shell);
- Dimension tilesz = ICON_SIZE/3;
- int i, j, tile;
-
- XColor colours[(TILE_MAX-1)*COLOUR_MAX];
- unsigned long *icons[ICON_MAX];
- void *wm_icon = NULL;
-
- if (state->use_ewmh_icons && (wm_icon = ewmh_icon_alloc(icons))) {
- Colormap cmap = DefaultColormapOfScreen(XtScreen(shell));
-
- for (i = 0; i < TILE_MAX-1; i++) {
- for (j = 0; j < COLOUR_MAX; j++) {
- XColor *c = &colours[i*COLOUR_MAX+j];
- c->pixel = state->tile_colour[i][j];
- }
- }
-
- XQueryColors(display, cmap, colours, i*j);
- }
-
- for (i = 0; i < 9; i++) {
- tile = redraw_goal_tile(state, display, state->icon_pixmap,
- i%3, i/3, tilesz, tilesz);
-
- if (wm_icon) {
- XColor *c = &colours[(tile-1)*COLOUR_MAX];
- ewmh_tile16(icons[ICON_16x16], c, i%3, i/3);
- ewmh_tile24(icons[ICON_24x24], c, i%3, i/3);
- ewmh_tile32(icons[ICON_32x32], c, i%3, i/3);
- ewmh_tile48(icons[ICON_48x48], c, i%3, i/3);
- }
- }
-
- /*
- * Clear and reset XtNiconPixmap otherwise it seems dtwm will not
- * notice the changed icon.
- */
- 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);
-
- XChangeProperty(display, XtWindow(shell), net_wm_icon,
- XA_CARDINAL, 32, PropModeReplace,
- wm_icon, EWMH_ICON_NELEM);
-
- free(wm_icon);
- }