aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-10-16 12:04:03 +0200
committerEli Zaretskii2010-10-16 12:04:03 +0200
commit9a3d704fa95b96df3ec9a6027b15a76a770c4154 (patch)
tree8622ab1c42c54423c2fd6cafbeeda6d550c150bb /src
parent2f3f89b323266e4acba71ae0e96acaf78a1584d1 (diff)
downloademacs-9a3d704fa95b96df3ec9a6027b15a76a770c4154.tar.gz
emacs-9a3d704fa95b96df3ec9a6027b15a76a770c4154.zip
Start working on mouse highlight of mode- and header-lines.
xdisp.c (rows_from_pos_range, mouse_face_from_buffer_pos) (note_mode_line_or_margin_highlight): Fix comments.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xdisp.c46
2 files changed, 27 insertions, 24 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3a1e0810d41..0f7d39e4d8a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12010-10-16 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (rows_from_pos_range, mouse_face_from_buffer_pos)
4 (note_mode_line_or_margin_highlight): Fix comments.
5
12010-10-09 Eli Zaretskii <eliz@gnu.org> 62010-10-09 Eli Zaretskii <eliz@gnu.org>
2 7
3 Finished work on mouse_face_from_buffer_pos for bidi-reordered 8 Finished work on mouse_face_from_buffer_pos for bidi-reordered
diff --git a/src/xdisp.c b/src/xdisp.c
index 9f39046b1f5..4a7cc275c47 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -23926,7 +23926,7 @@ rows_from_pos_range (struct window *w,
23926 glyphs it displays has a charpos from the range 23926 glyphs it displays has a charpos from the range
23927 [START_CHARPOS..END_CHARPOS). 23927 [START_CHARPOS..END_CHARPOS).
23928 23928
23929 This is not obvious because bidi reordering could have 23929 This is not obvious because bidi reordering could make
23930 buffer positions of a row be 1,2,3,102,101,100, and if we 23930 buffer positions of a row be 1,2,3,102,101,100, and if we
23931 want to highlight characters in [50..60), we don't want 23931 want to highlight characters in [50..60), we don't want
23932 this row, even though [50..60) does intersect [1..103), 23932 this row, even though [50..60) does intersect [1..103),
@@ -24031,17 +24031,12 @@ mouse_face_from_buffer_pos (Lisp_Object window,
24031 xassert (NILP (before_string) || STRINGP (before_string)); 24031 xassert (NILP (before_string) || STRINGP (before_string));
24032 xassert (NILP (after_string) || STRINGP (after_string)); 24032 xassert (NILP (after_string) || STRINGP (after_string));
24033 24033
24034 /* FIXME: Sometimes the caller gets "wise" and gives us the window
24035 start position instead of the real start of the mouse face
24036 property. This completely messes up the logic of finding the
24037 beg_row and end_row. */
24038
24039 /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ 24034 /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */
24040 rows_from_pos_range (w, start_charpos, end_charpos, &r1, &r2); 24035 rows_from_pos_range (w, start_charpos, end_charpos, &r1, &r2);
24041 if (r1 == NULL) 24036 if (r1 == NULL)
24042 r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); 24037 r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
24043 /* If the before-string or display-string contains newlines, 24038 /* If the before-string or display-string contains newlines,
24044 row_containing_pos skips to its last row. Move back. */ 24039 rows_from_pos_range skips to its last row. Move back. */
24045 if (!NILP (before_string) || !NILP (display_string)) 24040 if (!NILP (before_string) || !NILP (display_string))
24046 { 24041 {
24047 struct glyph_row *prev; 24042 struct glyph_row *prev;
@@ -24614,7 +24609,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24614 ? MATRIX_MODE_LINE_ROW (w->current_matrix) 24609 ? MATRIX_MODE_LINE_ROW (w->current_matrix)
24615 : MATRIX_HEADER_LINE_ROW (w->current_matrix)); 24610 : MATRIX_HEADER_LINE_ROW (w->current_matrix));
24616 24611
24617 /* Find glyph */ 24612 /* Find the glyph under the mouse pointer. */
24618 if (row->mode_line_p && row->enabled_p) 24613 if (row->mode_line_p && row->enabled_p)
24619 { 24614 {
24620 glyph = row_start_glyph = row->glyphs[TEXT_AREA]; 24615 glyph = row_start_glyph = row->glyphs[TEXT_AREA];
@@ -24733,14 +24728,15 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24733 if (NILP (e)) 24728 if (NILP (e))
24734 e = make_number (SCHARS (string)); 24729 e = make_number (SCHARS (string));
24735 24730
24736 /* Calculate the position(glyph position: GPOS) of GLYPH in 24731 /* Calculate the glyph position GPOS of GLYPH in the
24737 displayed string. GPOS is different from CHARPOS. 24732 displayed string.
24738 24733
24739 CHARPOS is the position of glyph in internal string 24734 Note: GPOS is different from CHARPOS. CHARPOS is the
24740 object. A mode line string format has structures which 24735 position of GLYPH in the internal string object. A mode
24741 is converted to a flatten by emacs lisp interpreter. 24736 line string format has structures which are converted to
24742 The internal string is an element of the structures. 24737 a flattened string by the Emacs Lisp interpreter. The
24743 The displayed string is the flatten string. */ 24738 internal string is an element of those structures. The
24739 displayed string is the flattened string. */
24744 gpos = 0; 24740 gpos = 0;
24745 if (glyph > row_start_glyph) 24741 if (glyph > row_start_glyph)
24746 { 24742 {
@@ -24754,11 +24750,10 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24754 } 24750 }
24755 } 24751 }
24756 24752
24757 /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of 24753 /* Calculate the glyph sequence length GSEQ_LENGTH of the
24758 displayed string holding GLYPH. 24754 displayed string to which GLYPH belongs. Note:
24759 24755 GSEQ_LENGTH is different from SCHARS (STRING), because
24760 GSEQ_LENGTH is different from SCHARS (STRING). 24756 the latter returns the length of the internal string. */
24761 SCHARS (STRING) returns the length of the internal string. */
24762 for (tmp_glyph = glyph, gseq_length = gpos; 24757 for (tmp_glyph = glyph, gseq_length = gpos;
24763 tmp_glyph->charpos < XINT (e); 24758 tmp_glyph->charpos < XINT (e);
24764 tmp_glyph++, gseq_length++) 24759 tmp_glyph++, gseq_length++)
@@ -24771,14 +24766,14 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
24771 for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++) 24766 for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++)
24772 total_pixel_width += tmp_glyph->pixel_width; 24767 total_pixel_width += tmp_glyph->pixel_width;
24773 24768
24774 /* Pre calculation of re-rendering position */ 24769 /* Pre calculation of re-rendering position. */
24775 hpos = (x - gpos); 24770 hpos = x - gpos;
24776 vpos = (area == ON_MODE_LINE 24771 vpos = (area == ON_MODE_LINE
24777 ? (w->current_matrix)->nrows - 1 24772 ? (w->current_matrix)->nrows - 1
24778 : 0); 24773 : 0);
24779 24774
24780 /* If the re-rendering position is included in the last 24775 /* If the re-rendering position is included in the last
24781 re-rendering area, we should do nothing. */ 24776 re-rendering area, we should do nothing. */
24782 if ( EQ (window, dpyinfo->mouse_face_window) 24777 if ( EQ (window, dpyinfo->mouse_face_window)
24783 && dpyinfo->mouse_face_beg_col <= hpos 24778 && dpyinfo->mouse_face_beg_col <= hpos
24784 && hpos < dpyinfo->mouse_face_end_col 24779 && hpos < dpyinfo->mouse_face_end_col
@@ -25137,7 +25132,10 @@ note_mouse_highlight (struct frame *f, int x, int y)
25137 previous-single-property-change and 25132 previous-single-property-change and
25138 next-single-property-change, because 25133 next-single-property-change, because
25139 rows_from_pos_range needs the real start and end 25134 rows_from_pos_range needs the real start and end
25140 positions to DTRT in this case. */ 25135 positions to DTRT in this case. That's because
25136 the first row visible in a window does not
25137 necessarily display the character whose position
25138 is the smallest. */
25141 Lisp_Object lim1 = 25139 Lisp_Object lim1 =
25142 NILP (XBUFFER (buffer)->bidi_display_reordering) 25140 NILP (XBUFFER (buffer)->bidi_display_reordering)
25143 ? Fmarker_position (w->start) 25141 ? Fmarker_position (w->start)