aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/dispnew.c37
2 files changed, 38 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c3f250aa519..d6b1c2347a2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12010-08-20 Eli Zaretskii <eliz@gnu.org>
2
3 * dispnew.c (buffer_posn_from_coords): Fix calculation of buffer
4 position for R2L lines by mirroring the pixel position wrt the
5 text are box. Improve commentary.
6
12010-08-20 Andreas Schwab <schwab@linux-m68k.org> 72010-08-20 Andreas Schwab <schwab@linux-m68k.org>
2 8
3 * image.c (imagemagick_clear_image): Remove debugging output. 9 * image.c (imagemagick_clear_image): Remove debugging output.
diff --git a/src/dispnew.c b/src/dispnew.c
index 35893872c73..efcfd101782 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5351,9 +5351,15 @@ update_frame_line (struct frame *f, int vpos)
5351 ***********************************************************************/ 5351 ***********************************************************************/
5352 5352
5353/* Determine what's under window-relative pixel position (*X, *Y). 5353/* Determine what's under window-relative pixel position (*X, *Y).
5354 Return the object (string or buffer) that's there. 5354 Return the OBJECT (string or buffer) that's there.
5355 Return in *POS the position in that object. 5355 Return in *POS the position in that object.
5356 Adjust *X and *Y to character positions. */ 5356 Adjust *X and *Y to character positions.
5357 Return in *DX and *DY the pixel coordinates of the click,
5358 relative to the top left corner of OBJECT, or relative to
5359 the top left corner of the character glyph at (*X, *Y)
5360 if OBJECT is nil.
5361 Return WIDTH and HEIGHT of the object at (*X, *Y), or zero
5362 if the coordinates point to an empty area of the display. */
5357 5363
5358Lisp_Object 5364Lisp_Object
5359buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) 5365buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height)
@@ -5366,7 +5372,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5366#ifdef HAVE_WINDOW_SYSTEM 5372#ifdef HAVE_WINDOW_SYSTEM
5367 struct image *img = 0; 5373 struct image *img = 0;
5368#endif 5374#endif
5369 int x0, x1; 5375 int x0, x1, to_x;
5370 5376
5371 /* We used to set current_buffer directly here, but that does the 5377 /* We used to set current_buffer directly here, but that does the
5372 wrong thing with `face-remapping-alist' (bug#2044). */ 5378 wrong thing with `face-remapping-alist' (bug#2044). */
@@ -5377,8 +5383,29 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5377 start_display (&it, w, startp); 5383 start_display (&it, w, startp);
5378 5384
5379 x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); 5385 x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w);
5380 move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1, 5386
5381 MOVE_TO_X | MOVE_TO_Y); 5387 /* First, move to the beginning of the row corresponding to *Y. We
5388 need to be in that row to get the correct value of base paragraph
5389 direction for the paragraph at *X. */
5390 move_it_to (&it, -1, 0, *y, -1, MOVE_TO_X | MOVE_TO_Y);
5391
5392 /* TO_X is the pixel position that the iterator will compute for the
5393 glyph at *X. This is because iterator positions are not offset
5394 due to hscroll. */
5395 to_x = x0 + it.first_visible_x;
5396 if (it.bidi_it.paragraph_dir == R2L)
5397 /* For lines in an R2L paragraph, we need to mirror TO_X wrt the
5398 text area. This is because the iterator, even in R2L
5399 paragraphs, delivers glyphs as if they started at the left
5400 margin of the window. (When we actually produce glyphs for
5401 display, we reverse their order in PRODUCE_GLYPHS, but the
5402 iterator doesn't know about that.) The following line adjusts
5403 the pixel position to the iterator geometry, which is what
5404 move_it_* routines use. */
5405 to_x = window_box_width (w, TEXT_AREA) - to_x;
5406
5407 /* Now move horizontally in the row to the glyph under *X. */
5408 move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X);
5382 5409
5383 Fset_buffer (old_current_buffer); 5410 Fset_buffer (old_current_buffer);
5384 5411