]> granicus.if.org Git - nethack/commitdiff
X11: Fix map expose area
authorPasi Kallinen <paxed@alt.org>
Tue, 25 Jan 2022 09:19:12 +0000 (11:19 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 25 Jan 2022 09:26:47 +0000 (11:26 +0200)
The stop_row and stop_col were off-by-one in some cases, leaving
black lines on the map when a window on top was closed.
Simplify the calculation by always going one row/col further,
ensuring previously covered area gets redrawn for sure.
This should not affect speed or resource usage noticeably these days.

doc/fixes37.0
win/X11/winmap.c

index 5870e6bf9041980658becf581f63fa455b645638..90724a91a44f1c10fec1e85ec9b312c58aac6150 100644 (file)
@@ -1414,6 +1414,7 @@ Unix: can define NOSUSPEND in config.h or src/Makefile's CFLAGS to prevent
 X11: implement 'selectsaved', restore via menu of saved games
 X11: echo getline prompt and response (wishes, applying names) to message
        window and dumplog message history
+X11: fix map expose area, no longer leaving black bars on the map
 
 
 NetHack Community Patches (or Variation) Included
index bf75717967138e945c43ea0f6a5f41ab6bbf2cd5..88dbb728f5fad75b24ca2f953a453e101f8cd570 100644 (file)
@@ -1199,12 +1199,10 @@ map_exposed(Widget w, XtPointer client_data, /* unused */
         t_width = map_info->text_map.square_width;
     }
     start_row = y / t_height;
-    stop_row = ((y + height) / t_height)
-               + ((((y + height) % t_height) == 0) ? 0 : 1) - 1;
+    stop_row = ((y + height) / t_height) + 1;
 
     start_col = x / t_width;
-    stop_col = ((x + width) / t_width)
-               + ((((x + width) % t_width) == 0) ? 0 : 1) - 1;
+    stop_col = ((x + width) / t_width) + 1;
 
 #ifdef VERBOSE
     printf("map_exposed: x = %d, y = %d, width = %d, height = %d\n", x, y,