diff options
| author | Gerd Moellmann | 2002-04-12 09:36:56 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2002-04-12 09:36:56 +0000 |
| commit | db1db309387c253d42ea86465b21acc086120a92 (patch) | |
| tree | e15e1a68c768043eaf88849d00dc88bdacf1de6d /src | |
| parent | 49b996e77a0d0cd5cf438624821d3ac5dd760e57 (diff) | |
| download | emacs-db1db309387c253d42ea86465b21acc086120a92.tar.gz emacs-db1db309387c253d42ea86465b21acc086120a92.zip | |
(marginal_area_string): New.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 0ef62cfb4bc..8217dec33aa 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -5754,6 +5754,57 @@ mode_line_string (w, x, y, mode_line_p, charpos) | |||
| 5754 | } | 5754 | } |
| 5755 | 5755 | ||
| 5756 | 5756 | ||
| 5757 | /* Value is the string under window-relative coordinates X/Y in either | ||
| 5758 | marginal area, or nil if none. *CHARPOS is set to the position in | ||
| 5759 | the string returned. */ | ||
| 5760 | |||
| 5761 | Lisp_Object | ||
| 5762 | marginal_area_string (w, x, y, area, charpos) | ||
| 5763 | struct window *w; | ||
| 5764 | int x, y; | ||
| 5765 | int *charpos; | ||
| 5766 | int area; | ||
| 5767 | { | ||
| 5768 | struct glyph_row *row = w->current_matrix->rows; | ||
| 5769 | struct glyph *glyph, *end; | ||
| 5770 | int x0, i, wy = y; | ||
| 5771 | Lisp_Object string = Qnil; | ||
| 5772 | |||
| 5773 | if (area == 6) | ||
| 5774 | area = LEFT_MARGIN_AREA; | ||
| 5775 | else if (area == 7) | ||
| 5776 | area = RIGHT_MARGIN_AREA; | ||
| 5777 | else | ||
| 5778 | abort (); | ||
| 5779 | |||
| 5780 | for (i = 0; row->enabled_p && i < w->current_matrix->nrows; ++i, ++row) | ||
| 5781 | if (wy >= row->y && wy < MATRIX_ROW_BOTTOM_Y (row)) | ||
| 5782 | break; | ||
| 5783 | |||
| 5784 | if (row->enabled_p) | ||
| 5785 | { | ||
| 5786 | /* Find the glyph under X. If we find one with a string object, | ||
| 5787 | it's the one we were looking for. */ | ||
| 5788 | glyph = row->glyphs[area]; | ||
| 5789 | end = glyph + row->used[area]; | ||
| 5790 | if (area == RIGHT_MARGIN_AREA) | ||
| 5791 | x0 = (window_box_width (w, TEXT_AREA) | ||
| 5792 | + window_box_width (w, LEFT_MARGIN_AREA)); | ||
| 5793 | else | ||
| 5794 | x0 = 0; | ||
| 5795 | for (; glyph < end; x0 += glyph->pixel_width, ++glyph) | ||
| 5796 | if (x >= x0 && x < x0 + glyph->pixel_width) | ||
| 5797 | { | ||
| 5798 | string = glyph->object; | ||
| 5799 | *charpos = glyph->charpos; | ||
| 5800 | break; | ||
| 5801 | } | ||
| 5802 | } | ||
| 5803 | |||
| 5804 | return string; | ||
| 5805 | } | ||
| 5806 | |||
| 5807 | |||
| 5757 | /*********************************************************************** | 5808 | /*********************************************************************** |
| 5758 | Changing Frame Sizes | 5809 | Changing Frame Sizes |
| 5759 | ***********************************************************************/ | 5810 | ***********************************************************************/ |