* Map window expose callback. */ ARGSUSED*/
| 1283 | */ |
| 1284 | /*ARGSUSED*/ |
| 1285 | static void |
| 1286 | map_exposed(Widget w, XtPointer client_data, /* unused */ |
| 1287 | XtPointer widget_data) /* expose event from Window widget */ |
| 1288 | { |
| 1289 | int x, y; |
| 1290 | struct xwindow *wp; |
| 1291 | struct map_info_t *map_info; |
| 1292 | unsigned width, height; |
| 1293 | int start_row, stop_row, start_col, stop_col; |
| 1294 | XExposeEvent *event = (XExposeEvent *) widget_data; |
| 1295 | int t_height, t_width; /* tile/text height & width */ |
| 1296 | |
| 1297 | nhUse(client_data); |
| 1298 | |
| 1299 | if (!XtIsRealized(w) || event->count > 0) |
| 1300 | return; |
| 1301 | |
| 1302 | wp = find_widget(w); |
| 1303 | map_info = wp->map_information; |
| 1304 | if (wp->keep_window && !map_info) |
| 1305 | return; |
| 1306 | /* |
| 1307 | * The map is sent an expose event when the viewport resizes. Make sure |
| 1308 | * that the cursor is still in the viewport after the resize. |
| 1309 | */ |
| 1310 | map_check_size_change(wp); |
| 1311 | |
| 1312 | if (event) { /* called from button-event */ |
| 1313 | x = event->x; |
| 1314 | y = event->y; |
| 1315 | width = event->width; |
| 1316 | height = event->height; |
| 1317 | } else { |
| 1318 | x = 0; |
| 1319 | y = 0; |
| 1320 | width = wp->pixel_width; |
| 1321 | height = wp->pixel_height; |
| 1322 | } |
| 1323 | /* |
| 1324 | * Convert pixels into INCLUSIVE text rows and columns. |
| 1325 | */ |
| 1326 | if (map_info->is_tile) { |
| 1327 | t_height = map_info->tile_map.square_height; |
| 1328 | t_width = map_info->tile_map.square_width; |
| 1329 | } else { |
| 1330 | t_height = map_info->text_map.square_height; |
| 1331 | t_width = map_info->text_map.square_width; |
| 1332 | } |
| 1333 | start_row = y / t_height; |
| 1334 | stop_row = ((y + height) / t_height) + 1; |
| 1335 | |
| 1336 | start_col = x / t_width; |
| 1337 | stop_col = ((x + width) / t_width) + 1; |
| 1338 | |
| 1339 | #ifdef VERBOSE |
| 1340 | printf("map_exposed: x = %d, y = %d, width = %d, height = %d\n", x, y, |
| 1341 | width, height); |
| 1342 | printf("chars %d x %d, rows %d to %d, columns %d to %d\n", t_height, |
nothing calls this directly
no test coverage detected