Mercurial > emacs
comparison src/xdisp.c @ 59676:7e0248c89780
(pos_visible_p): Replace FULLY arg by RTOP and RBOT args
to return number of partially invisible pixels at top and bottom
of the dislay row at POS.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 22 Jan 2005 01:41:36 +0000 |
parents | 55df25f51581 |
children | 95fe2047f466 6d92d69fae33 |
comparison
equal
deleted
inserted
replaced
59675:5c0ac872ffdb | 59676:7e0248c89780 |
---|---|
1241 | 1241 |
1242 return line_top_y + line_height; | 1242 return line_top_y + line_height; |
1243 } | 1243 } |
1244 | 1244 |
1245 | 1245 |
1246 /* Return 1 if position CHARPOS is visible in window W. Set *FULLY to | 1246 /* Return 1 if position CHARPOS is visible in window W. |
1247 1 if POS is visible and the line containing POS is fully visible. | 1247 If visible, set *X and *Y to pixel coordinates of top left corner. |
1248 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS. | |
1248 EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line | 1249 EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line |
1249 and header-lines heights. */ | 1250 and header-lines heights. */ |
1250 | 1251 |
1251 int | 1252 int |
1252 pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p) | 1253 pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) |
1253 struct window *w; | 1254 struct window *w; |
1254 int charpos, *fully, *x, *y, exact_mode_line_heights_p; | 1255 int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; |
1255 { | 1256 { |
1256 struct it it; | 1257 struct it it; |
1257 struct text_pos top; | 1258 struct text_pos top; |
1258 int visible_p; | 1259 int visible_p; |
1259 struct buffer *old_buffer = NULL; | 1260 struct buffer *old_buffer = NULL; |
1262 { | 1263 { |
1263 old_buffer = current_buffer; | 1264 old_buffer = current_buffer; |
1264 set_buffer_internal_1 (XBUFFER (w->buffer)); | 1265 set_buffer_internal_1 (XBUFFER (w->buffer)); |
1265 } | 1266 } |
1266 | 1267 |
1267 *fully = visible_p = 0; | 1268 visible_p = 0; |
1268 SET_TEXT_POS_FROM_MARKER (top, w->start); | 1269 SET_TEXT_POS_FROM_MARKER (top, w->start); |
1269 | 1270 |
1270 /* Compute exact mode line heights, if requested. */ | 1271 /* Compute exact mode line heights, if requested. */ |
1271 if (exact_mode_line_heights_p) | 1272 if (exact_mode_line_heights_p) |
1272 { | 1273 { |
1293 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); | 1294 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); |
1294 | 1295 |
1295 if (top_y < window_top_y) | 1296 if (top_y < window_top_y) |
1296 visible_p = bottom_y > window_top_y; | 1297 visible_p = bottom_y > window_top_y; |
1297 else if (top_y < it.last_visible_y) | 1298 else if (top_y < it.last_visible_y) |
1298 { | |
1299 visible_p = 1; | 1299 visible_p = 1; |
1300 *fully = bottom_y <= it.last_visible_y; | |
1301 } | |
1302 if (visible_p && x) | 1300 if (visible_p && x) |
1303 { | 1301 { |
1304 *x = it.current_x; | 1302 *x = it.current_x; |
1305 *y = max (top_y + it.max_ascent - it.ascent, window_top_y); | 1303 *y = max (top_y + it.max_ascent - it.ascent, window_top_y); |
1304 if (rtop) | |
1305 { | |
1306 *rtop = max (0, window_top_y - top_y); | |
1307 *rbot = max (0, bottom_y - it.last_visible_y); | |
1308 } | |
1306 } | 1309 } |
1307 } | 1310 } |
1308 else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) | 1311 else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) |
1309 { | 1312 { |
1310 struct it it2; | 1313 struct it it2; |
1317 if (x) | 1320 if (x) |
1318 { | 1321 { |
1319 move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); | 1322 move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); |
1320 *x = it2.current_x; | 1323 *x = it2.current_x; |
1321 *y = it2.current_y + it2.max_ascent - it2.ascent; | 1324 *y = it2.current_y + it2.max_ascent - it2.ascent; |
1325 if (rtop) | |
1326 { | |
1327 *rtop = 0; | |
1328 *rbot = max (0, (it2.current_y + it2.max_ascent + it2.max_descent) - it.last_visible_y); | |
1329 } | |
1322 } | 1330 } |
1323 } | 1331 } |
1324 } | 1332 } |
1325 | 1333 |
1326 if (old_buffer) | 1334 if (old_buffer) |