[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/dispnew.c
From: |
Kim F. Storm |
Subject: |
[Emacs-diffs] Changes to emacs/src/dispnew.c |
Date: |
Sat, 22 Nov 2003 19:09:19 -0500 |
Index: emacs/src/dispnew.c
diff -c emacs/src/dispnew.c:1.321 emacs/src/dispnew.c:1.322
*** emacs/src/dispnew.c:1.321 Fri Nov 14 08:04:15 2003
--- emacs/src/dispnew.c Sat Nov 22 19:09:19 2003
***************
*** 5689,5695 ****
/* Determine what's under window-relative pixel position (*X, *Y).
Return in *OBJECT the object (string or buffer) that's there.
Return in *POS the position in that object. Adjust *X and *Y
! to character boundaries. */
void
buffer_posn_from_coords (w, x, y, object, pos)
--- 5689,5695 ----
/* Determine what's under window-relative pixel position (*X, *Y).
Return in *OBJECT the object (string or buffer) that's there.
Return in *POS the position in that object. Adjust *X and *Y
! to character positions. */
void
buffer_posn_from_coords (w, x, y, object, pos)
***************
*** 5701,5707 ****
struct it it;
struct buffer *old_current_buffer = current_buffer;
struct text_pos startp;
! int left_area_width;
current_buffer = XBUFFER (w->buffer);
SET_TEXT_POS_FROM_MARKER (startp, w->start);
--- 5701,5708 ----
struct it it;
struct buffer *old_current_buffer = current_buffer;
struct text_pos startp;
! struct glyph_row *row;
! int x0, x1;
current_buffer = XBUFFER (w->buffer);
SET_TEXT_POS_FROM_MARKER (startp, w->start);
***************
*** 5709,5724 ****
BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
start_display (&it, w, startp);
! left_area_width = WINDOW_LEFT_MARGIN_WIDTH (w);
! move_it_to (&it, -1, *x + it.first_visible_x - left_area_width, *y, -1,
MOVE_TO_X | MOVE_TO_Y);
! *x = it.current_x - it.first_visible_x + left_area_width;
! *y = it.current_y;
current_buffer = old_current_buffer;
*object = STRINGP (it.string) ? it.string : w->buffer;
*pos = it.current;
}
--- 5710,5730 ----
BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
start_display (&it, w, startp);
! x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w);
! move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1,
MOVE_TO_X | MOVE_TO_Y);
! /* Add extra (default width) columns if clicked after EOL. */
! x1 = max(0, it.current_x + it.pixel_width - it.first_visible_x);
! if (x0 > x1)
! it.hpos += (x0 - x1) / WINDOW_FRAME_COLUMN_WIDTH (w);
!
current_buffer = old_current_buffer;
*object = STRINGP (it.string) ? it.string : w->buffer;
*pos = it.current;
+ *x = it.hpos;
+ *y = it.vpos;
}
***************
*** 5730,5736 ****
Lisp_Object
mode_line_string (w, x, y, part, charpos)
struct window *w;
! int x, y;
enum window_part part;
int *charpos;
{
--- 5736,5742 ----
Lisp_Object
mode_line_string (w, x, y, part, charpos)
struct window *w;
! int *x, *y;
enum window_part part;
int *charpos;
{
***************
*** 5744,5763 ****
else
row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
if (row->mode_line_p && row->enabled_p)
{
/* Find the glyph under X. If we find one with a string object,
it's the one we were looking for. */
glyph = row->glyphs[TEXT_AREA];
end = glyph + row->used[TEXT_AREA];
! for (x0 = 0; glyph < end; x0 += glyph->pixel_width, ++glyph)
! if (x >= x0 && x < x0 + glyph->pixel_width)
! {
! string = glyph->object;
! *charpos = glyph->charpos;
! break;
! }
}
return string;
}
--- 5750,5777 ----
else
row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
+ *y = row - MATRIX_FIRST_TEXT_ROW (w->current_matrix);
+
if (row->mode_line_p && row->enabled_p)
{
/* Find the glyph under X. If we find one with a string object,
it's the one we were looking for. */
glyph = row->glyphs[TEXT_AREA];
end = glyph + row->used[TEXT_AREA];
! for (x0 = *x; glyph < end && x0 > glyph->pixel_width; ++glyph)
! x0 -= glyph->pixel_width;
! *x = glyph - row->glyphs[TEXT_AREA];
! if (glyph < end)
! {
! string = glyph->object;
! *charpos = glyph->charpos;
! }
! else
! /* Add extra (default width) columns if clicked after EOL. */
! *x += x0 / WINDOW_FRAME_COLUMN_WIDTH (w);
}
+ else
+ *x = 0;
return string;
}
***************
*** 5770,5782 ****
Lisp_Object
marginal_area_string (w, x, y, part, charpos)
struct window *w;
! int x, y;
enum window_part part;
int *charpos;
{
struct glyph_row *row = w->current_matrix->rows;
struct glyph *glyph, *end;
! int x0, i, wy = y;
int area;
Lisp_Object string = Qnil;
--- 5784,5796 ----
Lisp_Object
marginal_area_string (w, x, y, part, charpos)
struct window *w;
! int *x, *y;
enum window_part part;
int *charpos;
{
struct glyph_row *row = w->current_matrix->rows;
struct glyph *glyph, *end;
! int x0, i, wy = *y;
int area;
Lisp_Object string = Qnil;
***************
*** 5790,5803 ****
for (i = 0; row->enabled_p && i < w->current_matrix->nrows; ++i, ++row)
if (wy >= row->y && wy < MATRIX_ROW_BOTTOM_Y (row))
break;
if (row->enabled_p)
{
/* Find the glyph under X. If we find one with a string object,
it's the one we were looking for. */
- glyph = row->glyphs[area];
- end = glyph + row->used[area];
-
if (area == RIGHT_MARGIN_AREA)
x0 = ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
? WINDOW_LEFT_FRINGE_WIDTH (w)
--- 5804,5815 ----
for (i = 0; row->enabled_p && i < w->current_matrix->nrows; ++i, ++row)
if (wy >= row->y && wy < MATRIX_ROW_BOTTOM_Y (row))
break;
+ *y = row - MATRIX_FIRST_TEXT_ROW (w->current_matrix);
if (row->enabled_p)
{
/* Find the glyph under X. If we find one with a string object,
it's the one we were looking for. */
if (area == RIGHT_MARGIN_AREA)
x0 = ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
? WINDOW_LEFT_FRINGE_WIDTH (w)
***************
*** 5809,5822 ****
? WINDOW_LEFT_FRINGE_WIDTH (w)
: 0);
! for (; glyph < end; x0 += glyph->pixel_width, ++glyph)
! if (x >= x0 && x < x0 + glyph->pixel_width)
! {
! string = glyph->object;
! *charpos = glyph->charpos;
! break;
! }
}
return string;
}
--- 5821,5842 ----
? WINDOW_LEFT_FRINGE_WIDTH (w)
: 0);
! glyph = row->glyphs[area];
! end = glyph + row->used[area];
! for (x0 = *x - x0; glyph < end && x0 > glyph->pixel_width; ++glyph)
! x0 -= glyph->pixel_width;
! *x = glyph - row->glyphs[area];
! if (glyph < end)
! {
! string = glyph->object;
! *charpos = glyph->charpos;
! }
! else
! /* Add extra (default width) columns if clicked after EOL. */
! *x += x0 / WINDOW_FRAME_COLUMN_WIDTH (w);
}
+ else
+ *x = 0;
return string;
}