21253 |
Lisp_Object mouse_face; |
Lisp_Object mouse_face; |
21254 |
int original_x_pixel = x; |
int original_x_pixel = x; |
21255 |
struct glyph * glyph = NULL; |
struct glyph * glyph = NULL; |
21256 |
struct glyph_row *row; |
struct glyph_row *row; |
21257 |
|
|
21258 |
if (area == ON_MODE_LINE || area == ON_HEADER_LINE) |
if (area == ON_MODE_LINE || area == ON_HEADER_LINE) |
21259 |
{ |
{ |
21260 |
int x0; |
int x0; |
21263 |
string = mode_line_string (w, area, &x, &y, &charpos, |
string = mode_line_string (w, area, &x, &y, &charpos, |
21264 |
&object, &dx, &dy, &width, &height); |
&object, &dx, &dy, &width, &height); |
21265 |
|
|
21266 |
row = (area == ON_MODE_LINE)? |
row = (area == ON_MODE_LINE)? |
21267 |
MATRIX_MODE_LINE_ROW (w->current_matrix): |
MATRIX_MODE_LINE_ROW (w->current_matrix): |
21268 |
MATRIX_HEADER_LINE_ROW(w->current_matrix); |
MATRIX_HEADER_LINE_ROW(w->current_matrix); |
21269 |
|
|
21270 |
/* Find glyph */ |
/* Find glyph */ |
21271 |
if (row->mode_line_p && row->enabled_p) |
if (row->mode_line_p && row->enabled_p) |
21272 |
{ |
{ |
21273 |
glyph = row->glyphs[TEXT_AREA]; |
glyph = row->glyphs[TEXT_AREA]; |
21274 |
end = glyph + row->used[TEXT_AREA]; |
end = glyph + row->used[TEXT_AREA]; |
21275 |
|
|
21276 |
for (x0 = original_x_pixel; |
for (x0 = original_x_pixel; |
21277 |
glyph < end && x0 >= glyph->pixel_width; |
glyph < end && x0 >= glyph->pixel_width; |
21278 |
++glyph) |
++glyph) |
21279 |
x0 -= glyph->pixel_width; |
x0 -= glyph->pixel_width; |
21280 |
|
|
21281 |
if (glyph >= end) |
if (glyph >= end) |
21282 |
glyph = NULL; |
glyph = NULL; |
21283 |
} |
} |
21359 |
if (!KEYMAPP (map)) |
if (!KEYMAPP (map)) |
21360 |
cursor = dpyinfo->vertical_scroll_bar_cursor; |
cursor = dpyinfo->vertical_scroll_bar_cursor; |
21361 |
} |
} |
21362 |
|
|
21363 |
/* Change the mouse face according to what is under X/Y. */ |
/* Change the mouse face according to what is under X/Y. */ |
21364 |
mouse_face = Fget_text_property (pos, Qmouse_face, string); |
mouse_face = Fget_text_property (pos, Qmouse_face, string); |
21365 |
if (!NILP (mouse_face) |
if (!NILP (mouse_face) |
21375 |
int total_pixel_width; |
int total_pixel_width; |
21376 |
int ignore; |
int ignore; |
21377 |
|
|
21378 |
|
|
21379 |
if (clear_mouse_face (dpyinfo)) |
if (clear_mouse_face (dpyinfo)) |
21380 |
cursor = No_Cursor; |
cursor = No_Cursor; |
21381 |
|
|
21382 |
/* Calculate the position(glyph position: GPOS) of GLYPH in |
b = Fprevious_single_property_change(make_number (charpos + 1), |
21383 |
displayed string. GPOS is different from CHARPOS. |
Qmouse_face, string, Qnil); |
21384 |
|
if (NILP (b)) |
21385 |
|
b = make_number (0); |
21386 |
|
|
21387 |
|
e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil); |
21388 |
|
if (NILP (e)) |
21389 |
|
e = make_number (SCHARS (string)); |
21390 |
|
|
21391 |
|
/* Calculate the position(glyph position: GPOS) of GLYPH in |
21392 |
|
displayed string. GPOS is different from CHARPOS. |
21393 |
|
|
21394 |
CHARPOS is the position of glyph in internal string |
CHARPOS is the position of glyph in internal string |
21395 |
object. A mode line string format has structures which |
object. A mode line string format has structures which |
21396 |
is converted to a flatten by emacs lisp interpreter. |
is converted to a flatten by emacs lisp interpreter. |
21397 |
The internal string is an element of the structures. |
The internal string is an element of the structures. |
21398 |
The displayed string is the flatten string. */ |
The displayed string is the flatten string. */ |
21399 |
for (tmp_glyph = glyph - 1, gpos = 0; |
for (tmp_glyph = glyph - 1, gpos = 0; |
21400 |
tmp_glyph >= row->glyphs[TEXT_AREA]; |
tmp_glyph->charpos >= XINT(b); |
21401 |
tmp_glyph--, gpos++) |
tmp_glyph--, gpos++) |
21402 |
{ |
{ |
21403 |
if (tmp_glyph->object != glyph->object) |
if (tmp_glyph->object != glyph->object) |
21405 |
} |
} |
21406 |
|
|
21407 |
/* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of |
/* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of |
21408 |
displayed string holding GLYPH. |
displayed string holding GLYPH. |
21409 |
|
|
21410 |
GSEQ_LENGTH is different from SCHARS (STRING). |
GSEQ_LENGTH is different from SCHARS (STRING). |
21411 |
SCHARS (STRING) returns the length of the internal string. */ |
SCHARS (STRING) returns the length of the internal string. */ |
21412 |
for (tmp_glyph = glyph, gseq_length = gpos; |
for (tmp_glyph = glyph, gseq_length = gpos; |
21413 |
tmp_glyph < glyph + row->used[TEXT_AREA]; |
tmp_glyph->charpos < XINT(e); |
21414 |
tmp_glyph++, gseq_length++) |
tmp_glyph++, gseq_length++) |
21415 |
{ |
{ |
21416 |
if (tmp_glyph->object != glyph->object) |
if (tmp_glyph->object != glyph->object) |
21417 |
break; |
break; |
21418 |
} |
} |
|
|
|
|
b = Fprevious_single_property_change(make_number (charpos + 1), |
|
|
Qmouse_face, string, Qnil); |
|
|
e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil); |
|
|
|
|
|
if (NILP (b)) |
|
|
b = make_number (0); |
|
|
|
|
|
if (NILP (e)) |
|
|
e = make_number(gseq_length); |
|
21419 |
|
|
21420 |
total_pixel_width = 0; |
total_pixel_width = 0; |
21421 |
for (tmp_glyph = glyph - (gpos - XINT(b)); tmp_glyph != glyph; tmp_glyph++) |
for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++) |
21422 |
total_pixel_width += tmp_glyph->pixel_width; |
total_pixel_width += tmp_glyph->pixel_width; |
21423 |
|
|
21424 |
dpyinfo->mouse_face_beg_col = (x - gpos) + XINT(b); |
dpyinfo->mouse_face_beg_col = (x - gpos); |
21425 |
dpyinfo->mouse_face_beg_row = (area == ON_MODE_LINE)? |
dpyinfo->mouse_face_beg_row = (area == ON_MODE_LINE)? |
21426 |
(w->current_matrix)->nrows - 1: |
(w->current_matrix)->nrows - 1: |
21427 |
0; |
0; |
21428 |
|
|
21429 |
dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); |
dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); |
21430 |
dpyinfo->mouse_face_beg_y = 0; |
dpyinfo->mouse_face_beg_y = 0; |
21431 |
|
|
21432 |
dpyinfo->mouse_face_end_col = (x - gpos) + XINT(e); |
dpyinfo->mouse_face_end_col = (x - gpos) + gseq_length; |
21433 |
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; |
dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; |
21434 |
|
|
21435 |
dpyinfo->mouse_face_end_x = 0; |
dpyinfo->mouse_face_end_x = 0; |
21438 |
dpyinfo->mouse_face_past_end = 0; |
dpyinfo->mouse_face_past_end = 0; |
21439 |
dpyinfo->mouse_face_window = window; |
dpyinfo->mouse_face_window = window; |
21440 |
|
|
21441 |
dpyinfo->mouse_face_face_id = face_at_string_position(w, string, |
dpyinfo->mouse_face_face_id = face_at_string_position(w, string, |
21442 |
charpos, |
charpos, |
21443 |
0, 0, 0, &ignore, |
0, 0, 0, &ignore, |
21444 |
glyph->face_id, 1); |
glyph->face_id, 1); |
21784 |
b = make_number (0); |
b = make_number (0); |
21785 |
if (NILP (e)) |
if (NILP (e)) |
21786 |
e = make_number (SCHARS (object) - 1); |
e = make_number (SCHARS (object) - 1); |
21787 |
|
|
21788 |
fast_find_string_pos (w, XINT (b), object, |
fast_find_string_pos (w, XINT (b), object, |
21789 |
&dpyinfo->mouse_face_beg_col, |
&dpyinfo->mouse_face_beg_col, |
21790 |
&dpyinfo->mouse_face_beg_row, |
&dpyinfo->mouse_face_beg_row, |