| 1250 | } |
| 1251 | |
| 1252 | static void |
| 1253 | set_button_values(Widget w, int x, int y, unsigned int button) |
| 1254 | { |
| 1255 | struct xwindow *wp; |
| 1256 | struct map_info_t *map_info; |
| 1257 | |
| 1258 | wp = find_widget(w); |
| 1259 | map_info = wp->map_information; |
| 1260 | |
| 1261 | if (map_info->is_tile) { |
| 1262 | click_x = x / map_info->tile_map.square_width; |
| 1263 | click_y = y / map_info->tile_map.square_height; |
| 1264 | } else { |
| 1265 | click_x = x / map_info->text_map.square_width; |
| 1266 | click_y = y / map_info->text_map.square_height; |
| 1267 | } |
| 1268 | click_x += COL0_OFFSET; /* note: reverse of usual adjustment */ |
| 1269 | |
| 1270 | /* The values can be out of range if the map window has been resized |
| 1271 | to be larger than the max size. */ |
| 1272 | if (click_x >= COLNO) |
| 1273 | click_x = COLNO - 1; |
| 1274 | if (click_y >= ROWNO) |
| 1275 | click_y = ROWNO - 1; |
| 1276 | |
| 1277 | /* Map all buttons but the first to the second click */ |
| 1278 | click_button = (button == Button1) ? CLICK_1 : CLICK_2; |
| 1279 | } |
| 1280 | |
| 1281 | /* |
| 1282 | * Map window expose callback. |
no test coverage detected