aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-09-03 15:43:10 +0000
committerGerd Moellmann2001-09-03 15:43:10 +0000
commit7e376260321bdc436767a7e43e124362af8cb372 (patch)
tree317b503dbbc0080e9760880ec4907166a026d7ad /src
parentc625688cf269aa13106406fd395360af5bc24b6d (diff)
downloademacs-7e376260321bdc436767a7e43e124362af8cb372.tar.gz
emacs-7e376260321bdc436767a7e43e124362af8cb372.zip
(note_mouse_highlight) <help-echo>: When looking for
help-echo for a string which doesn't have help-echo itself, use get-char-property to obtain the help-echo from the string's buffer (note_mouse_highlight) <mouse-face>: When on a string that doesn't have mouse-face, look for mouse-face ``under'' the string for mouse-face from an overlay. (fast_find_position): Add parameter STOP. In the final row, stop before glyphs having STOP as object. Don't consider glyphs that are not from a buffer.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/xterm.c93
2 files changed, 84 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8a9f85555fa..9df54f3666f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,15 @@
12001-09-03 Gerd Moellmann <gerd@gnu.org> 12001-09-03 Gerd Moellmann <gerd@gnu.org>
2 2
3 * xterm.c (note_mouse_highlight) <help-echo>: When looking for
4 help-echo for a string which doesn't have help-echo itself, use
5 get-char-property to obtain the help-echo from the string's buffer
6 (note_mouse_highlight) <mouse-face>: When on a string that doesn't
7 have mouse-face, look ``under'' the string for mouse-face from an
8 overlay.
9 (fast_find_position): Add parameter STOP. In the final row, stop
10 before glyphs having STOP as object. Don't consider glyphs that
11 are not from a buffer.
12
3 * buffer.c (syms_of_buffer) <default-directory>: Doc fix. 13 * buffer.c (syms_of_buffer) <default-directory>: Doc fix.
4 14
52001-09-01 Eli Zaretskii <eliz@is.elta.co.il> 152001-09-01 Eli Zaretskii <eliz@is.elta.co.il>
diff --git a/src/xterm.c b/src/xterm.c
index 66e5c5cfd08..6b442b7abf9 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -410,7 +410,7 @@ void x_delete_display P_ ((struct x_display_info *));
410static unsigned int x_x_to_emacs_modifiers P_ ((struct x_display_info *, 410static unsigned int x_x_to_emacs_modifiers P_ ((struct x_display_info *,
411 unsigned)); 411 unsigned));
412static int fast_find_position P_ ((struct window *, int, int *, int *, 412static int fast_find_position P_ ((struct window *, int, int *, int *,
413 int *, int *)); 413 int *, int *, Lisp_Object));
414static int fast_find_string_pos P_ ((struct window *, int, Lisp_Object, 414static int fast_find_string_pos P_ ((struct window *, int, Lisp_Object,
415 int *, int *, int *, int *, int)); 415 int *, int *, int *, int *, int));
416static void set_output_cursor P_ ((struct cursor_pos *)); 416static void set_output_cursor P_ ((struct cursor_pos *));
@@ -7049,13 +7049,14 @@ note_mouse_highlight (f, x, y)
7049 &dpyinfo->mouse_face_beg_col, 7049 &dpyinfo->mouse_face_beg_col,
7050 &dpyinfo->mouse_face_beg_row, 7050 &dpyinfo->mouse_face_beg_row,
7051 &dpyinfo->mouse_face_beg_x, 7051 &dpyinfo->mouse_face_beg_x,
7052 &dpyinfo->mouse_face_beg_y); 7052 &dpyinfo->mouse_face_beg_y, Qnil);
7053
7053 dpyinfo->mouse_face_past_end 7054 dpyinfo->mouse_face_past_end
7054 = !fast_find_position (w, XFASTINT (after), 7055 = !fast_find_position (w, XFASTINT (after),
7055 &dpyinfo->mouse_face_end_col, 7056 &dpyinfo->mouse_face_end_col,
7056 &dpyinfo->mouse_face_end_row, 7057 &dpyinfo->mouse_face_end_row,
7057 &dpyinfo->mouse_face_end_x, 7058 &dpyinfo->mouse_face_end_x,
7058 &dpyinfo->mouse_face_end_y); 7059 &dpyinfo->mouse_face_end_y, Qnil);
7059 dpyinfo->mouse_face_window = window; 7060 dpyinfo->mouse_face_window = window;
7060 dpyinfo->mouse_face_face_id 7061 dpyinfo->mouse_face_face_id
7061 = face_at_buffer_position (w, pos, 0, 0, 7062 = face_at_buffer_position (w, pos, 0, 0,
@@ -7089,13 +7090,13 @@ note_mouse_highlight (f, x, y)
7089 &dpyinfo->mouse_face_beg_col, 7090 &dpyinfo->mouse_face_beg_col,
7090 &dpyinfo->mouse_face_beg_row, 7091 &dpyinfo->mouse_face_beg_row,
7091 &dpyinfo->mouse_face_beg_x, 7092 &dpyinfo->mouse_face_beg_x,
7092 &dpyinfo->mouse_face_beg_y); 7093 &dpyinfo->mouse_face_beg_y, Qnil);
7093 dpyinfo->mouse_face_past_end 7094 dpyinfo->mouse_face_past_end
7094 = !fast_find_position (w, XFASTINT (after), 7095 = !fast_find_position (w, XFASTINT (after),
7095 &dpyinfo->mouse_face_end_col, 7096 &dpyinfo->mouse_face_end_col,
7096 &dpyinfo->mouse_face_end_row, 7097 &dpyinfo->mouse_face_end_row,
7097 &dpyinfo->mouse_face_end_x, 7098 &dpyinfo->mouse_face_end_x,
7098 &dpyinfo->mouse_face_end_y); 7099 &dpyinfo->mouse_face_end_y, Qnil);
7099 dpyinfo->mouse_face_window = window; 7100 dpyinfo->mouse_face_window = window;
7100 7101
7101 if (BUFFERP (object)) 7102 if (BUFFERP (object))
@@ -7139,6 +7140,54 @@ note_mouse_highlight (f, x, y)
7139 show_mouse_face (dpyinfo, DRAW_MOUSE_FACE); 7140 show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
7140 cursor = None; 7141 cursor = None;
7141 } 7142 }
7143 else if (STRINGP (object) && NILP (mouse_face))
7144 {
7145 /* A string which doesn't have mouse-face, but
7146 the text ``under'' it might have. */
7147 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos);
7148 int start = MATRIX_ROW_START_CHARPOS (r);
7149
7150 pos = string_buffer_position (w, object, start);
7151 if (pos > 0)
7152 mouse_face = get_char_property_and_overlay (make_number (pos),
7153 Qmouse_face,
7154 w->buffer,
7155 &overlay);
7156 if (!NILP (mouse_face) && !NILP (overlay))
7157 {
7158 Lisp_Object before = Foverlay_start (overlay);
7159 Lisp_Object after = Foverlay_end (overlay);
7160 Lisp_Object ignore;
7161
7162 /* Note that we might not be able to find position
7163 BEFORE in the glyph matrix if the overlay is
7164 entirely covered by a `display' property. In
7165 this case, we overshoot. So let's stop in
7166 the glyph matrix before glyphs for OBJECT. */
7167 fast_find_position (w, XFASTINT (before),
7168 &dpyinfo->mouse_face_beg_col,
7169 &dpyinfo->mouse_face_beg_row,
7170 &dpyinfo->mouse_face_beg_x,
7171 &dpyinfo->mouse_face_beg_y,
7172 object);
7173
7174 dpyinfo->mouse_face_past_end
7175 = !fast_find_position (w, XFASTINT (after),
7176 &dpyinfo->mouse_face_end_col,
7177 &dpyinfo->mouse_face_end_row,
7178 &dpyinfo->mouse_face_end_x,
7179 &dpyinfo->mouse_face_end_y,
7180 Qnil);
7181 dpyinfo->mouse_face_window = window;
7182 dpyinfo->mouse_face_face_id
7183 = face_at_buffer_position (w, pos, 0, 0,
7184 &ignore, pos + 1, 1);
7185
7186 /* Display it as active. */
7187 show_mouse_face (dpyinfo, DRAW_MOUSE_FACE);
7188 cursor = None;
7189 }
7190 }
7142 } 7191 }
7143 7192
7144 check_help_echo: 7193 check_help_echo:
@@ -7184,7 +7233,7 @@ note_mouse_highlight (f, x, y)
7184 int pos = string_buffer_position (w, object, start); 7233 int pos = string_buffer_position (w, object, start);
7185 if (pos > 0) 7234 if (pos > 0)
7186 { 7235 {
7187 help = Fget_text_property (make_number (pos), 7236 help = Fget_char_property (make_number (pos),
7188 Qhelp_echo, w->buffer); 7237 Qhelp_echo, w->buffer);
7189 if (!NILP (help)) 7238 if (!NILP (help))
7190 { 7239 {
@@ -7452,13 +7501,15 @@ note_tool_bar_highlight (f, x, y)
7452 *HPOS, *VPOS, *X, and *Y are set to the positions found. W's 7501 *HPOS, *VPOS, *X, and *Y are set to the positions found. W's
7453 current glyphs must be up to date. If POS is above window start 7502 current glyphs must be up to date. If POS is above window start
7454 return (0, 0, 0, 0). If POS is after end of W, return end of 7503 return (0, 0, 0, 0). If POS is after end of W, return end of
7455 last line in W. */ 7504 last line in W. In the row containing POS, stop before glyphs
7505 having STOP as object. */
7456 7506
7457static int 7507static int
7458fast_find_position (w, pos, hpos, vpos, x, y) 7508fast_find_position (w, pos, hpos, vpos, x, y, stop)
7459 struct window *w; 7509 struct window *w;
7460 int pos; 7510 int pos;
7461 int *hpos, *vpos, *x, *y; 7511 int *hpos, *vpos, *x, *y;
7512 Lisp_Object stop;
7462{ 7513{
7463 int i; 7514 int i;
7464 int lastcol; 7515 int lastcol;
@@ -7508,22 +7559,26 @@ fast_find_position (w, pos, hpos, vpos, x, y)
7508 for (i = 0; i < best_row->used[TEXT_AREA]; i++) 7559 for (i = 0; i < best_row->used[TEXT_AREA]; i++)
7509 { 7560 {
7510 struct glyph *glyph = best_row->glyphs[TEXT_AREA] + i; 7561 struct glyph *glyph = best_row->glyphs[TEXT_AREA] + i;
7511 int charpos; 7562 int charpos = glyph->charpos;
7512 7563
7513 charpos = glyph->charpos; 7564 if (BUFFERP (glyph->object))
7514 if (charpos == pos)
7515 { 7565 {
7516 *hpos = i; 7566 if (charpos == pos)
7517 *vpos = best_row_vpos; 7567 {
7518 *x = current_x; 7568 *hpos = i;
7519 *y = best_row->y; 7569 *vpos = best_row_vpos;
7520 return 1; 7570 *x = current_x;
7571 *y = best_row->y;
7572 return 1;
7573 }
7574 else if (charpos > pos)
7575 break;
7521 } 7576 }
7522 else if (charpos > pos) 7577 else if (EQ (glyph->object, stop))
7523 break; 7578 break;
7524 else if (charpos > 0)
7525 lastcol = i;
7526 7579
7580 if (charpos > 0)
7581 lastcol = i;
7527 current_x += glyph->pixel_width; 7582 current_x += glyph->pixel_width;
7528 } 7583 }
7529 7584