From 32a030c8c666229729c403cfd04da9ddf50770cf Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 1 Jan 2023 20:04:27 -0500 Subject: [PATCH] introduce X11 support for coloring map frame --- win/X11/winmap.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/win/X11/winmap.c b/win/X11/winmap.c index 4bc199d7e..494dda4fe 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -87,7 +87,7 @@ X11_print_glyph( winid window, coordxy x, coordxy y, const glyph_info *glyphinfo, - const glyph_info *bkglyphinfo UNUSED) + const glyph_info *bkglyphinfo) { struct map_info_t *map_info; boolean update_bbox = FALSE; @@ -114,6 +114,11 @@ X11_print_glyph( if (map_info->is_tile) update_bbox = TRUE; } + + if (map_info->tile_map.glyphs[y][x].framecolor != bkglyphinfo->framecolor) { + map_info->tile_map.glyphs[y][x].framecolor = bkglyphinfo->framecolor; + update_bbox = TRUE; + } } { X11_map_symbol ch; @@ -162,6 +167,10 @@ X11_print_glyph( if (!map_info->is_tile) update_bbox = TRUE; } + if (map_info->text_map.framecolors[y][x] != bkglyphinfo->framecolor) { + map_info->text_map.framecolors[y][x] = bkglyphinfo->framecolor; + update_bbox = TRUE; + } #endif } @@ -1049,10 +1058,12 @@ map_all_unexplored(struct map_info_t *map_info) /* [was map_all_stone()] */ tile_map->glyphs[y][x].glyph = !x ? g_nothg : g_unexp; tile_map->glyphs[y][x].glyphflags = 0; tile_map->glyphs[y][x].tileidx = !x ? nothg_idx : unexp_idx; + tile_map->glyphs[y][x].framecolor = NO_COLOR; text_map->text[y][x] = (uchar) (!x ? mgnothg : mgunexp); #ifdef TEXTCOLOR text_map->colors[y][x] = NO_COLOR; + text_map->framecolors[y][x] = NO_COLOR; #endif } } @@ -1425,6 +1436,13 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s XSetForeground(dpy, tile_map->black_gc, BlackPixelOfScreen(screen)); } + if (tile_map->glyphs[row][cur_col].framecolor != NO_COLOR) { + XDrawRectangle(dpy, XtWindow(wp->w), + map_info->text_map.color_gcs[tile_map->glyphs[row][cur_col].framecolor], + dest_x, dest_y, + tile_map->square_width - 1 , + tile_map->square_height - 1); + } } }