diff options
| author | Richard M. Stallman | 1994-03-31 23:12:26 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-31 23:12:26 +0000 |
| commit | 6f13448620a9b66c014947fbfe3834c72f7b7f30 (patch) | |
| tree | 86c03d589c1e056820bc313397e0d871c955299c /src | |
| parent | 3e9367e7decfabe3d62aebd73d9e2848ee05d753 (diff) | |
| download | emacs-6f13448620a9b66c014947fbfe3834c72f7b7f30.tar.gz emacs-6f13448620a9b66c014947fbfe3834c72f7b7f30.zip | |
(compute_char_face): New arg MOUSE.
(Qmouse_face): New variable.
(syms_of_xfaces): Initialize Qmouse_face.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 5d296319d97..707991824b8 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -170,7 +170,7 @@ int region_face; | |||
| 170 | does not specify that display aspect. */ | 170 | does not specify that display aspect. */ |
| 171 | #define FACE_DEFAULT (~0) | 171 | #define FACE_DEFAULT (~0) |
| 172 | 172 | ||
| 173 | Lisp_Object Qface; | 173 | Lisp_Object Qface, Qmouse_face; |
| 174 | 174 | ||
| 175 | static void build_face ( /* FRAME_PTR, struct face * */ ); | 175 | static void build_face ( /* FRAME_PTR, struct face * */ ); |
| 176 | int face_name_id_number ( /* FRAME_PTR, Lisp_Object name */ ); | 176 | int face_name_id_number ( /* FRAME_PTR, Lisp_Object name */ ); |
| @@ -709,16 +709,19 @@ compute_base_face (f, face) | |||
| 709 | REGION_BEG, REGION_END delimit the region, so it can be highlighted. | 709 | REGION_BEG, REGION_END delimit the region, so it can be highlighted. |
| 710 | 710 | ||
| 711 | LIMIT is a position not to scan beyond. That is to limit | 711 | LIMIT is a position not to scan beyond. That is to limit |
| 712 | the time this function can take. */ | 712 | the time this function can take. |
| 713 | |||
| 714 | If MOUSE is nonzero, use the character's mouse-face, not its face. */ | ||
| 713 | 715 | ||
| 714 | int | 716 | int |
| 715 | compute_char_face (f, w, pos, region_beg, region_end, endptr, limit) | 717 | compute_char_face (f, w, pos, region_beg, region_end, endptr, limit, mouse) |
| 716 | struct frame *f; | 718 | struct frame *f; |
| 717 | struct window *w; | 719 | struct window *w; |
| 718 | int pos; | 720 | int pos; |
| 719 | int region_beg, region_end; | 721 | int region_beg, region_end; |
| 720 | int *endptr; | 722 | int *endptr; |
| 721 | int limit; | 723 | int limit; |
| 724 | int mouse; | ||
| 722 | { | 725 | { |
| 723 | struct face face; | 726 | struct face face; |
| 724 | Lisp_Object prop, position; | 727 | Lisp_Object prop, position; |
| @@ -727,6 +730,7 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr, limit) | |||
| 727 | Lisp_Object *overlay_vec; | 730 | Lisp_Object *overlay_vec; |
| 728 | Lisp_Object frame; | 731 | Lisp_Object frame; |
| 729 | int endpos; | 732 | int endpos; |
| 733 | Lisp_Object propname; | ||
| 730 | 734 | ||
| 731 | /* W must display the current buffer. We could write this function | 735 | /* W must display the current buffer. We could write this function |
| 732 | to use the frame and buffer of W, but right now it doesn't. */ | 736 | to use the frame and buffer of W, but right now it doesn't. */ |
| @@ -740,12 +744,19 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr, limit) | |||
| 740 | endpos = region_beg; | 744 | endpos = region_beg; |
| 741 | 745 | ||
| 742 | XFASTINT (position) = pos; | 746 | XFASTINT (position) = pos; |
| 743 | prop = Fget_text_property (position, Qface, w->buffer); | 747 | |
| 748 | if (mouse) | ||
| 749 | propname = Qmouse_face; | ||
| 750 | else | ||
| 751 | propname = Qface; | ||
| 752 | |||
| 753 | prop = Fget_text_property (position, propname, w->buffer); | ||
| 754 | |||
| 744 | { | 755 | { |
| 745 | Lisp_Object limit1, end; | 756 | Lisp_Object limit1, end; |
| 746 | 757 | ||
| 747 | XFASTINT (limit1) = (limit < endpos ? limit : endpos); | 758 | XFASTINT (limit1) = (limit < endpos ? limit : endpos); |
| 748 | end = Fnext_single_property_change (position, Qface, w->buffer, limit1); | 759 | end = Fnext_single_property_change (position, propname, w->buffer, limit1); |
| 749 | if (INTEGERP (end)) | 760 | if (INTEGERP (end)) |
| 750 | endpos = XINT (end); | 761 | endpos = XINT (end); |
| 751 | } | 762 | } |
| @@ -795,7 +806,7 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr, limit) | |||
| 795 | /* Now merge the overlay data in that order. */ | 806 | /* Now merge the overlay data in that order. */ |
| 796 | for (i = 0; i < noverlays; i++) | 807 | for (i = 0; i < noverlays; i++) |
| 797 | { | 808 | { |
| 798 | prop = Foverlay_get (overlay_vec[i], Qface); | 809 | prop = Foverlay_get (overlay_vec[i], propname); |
| 799 | if (!NILP (prop)) | 810 | if (!NILP (prop)) |
| 800 | { | 811 | { |
| 801 | Lisp_Object oend; | 812 | Lisp_Object oend; |
| @@ -804,7 +815,7 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr, limit) | |||
| 804 | facecode = face_name_id_number (f, prop); | 815 | facecode = face_name_id_number (f, prop); |
| 805 | if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f) | 816 | if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f) |
| 806 | && FRAME_PARAM_FACES (f) [facecode] != 0) | 817 | && FRAME_PARAM_FACES (f) [facecode] != 0) |
| 807 | merge_faces (FRAME_PARAM_FACES (f) [facecode], &face); | 818 | merge_faces (FRAME_PARAM_FACES (f)[facecode], &face); |
| 808 | 819 | ||
| 809 | oend = OVERLAY_END (overlay_vec[i]); | 820 | oend = OVERLAY_END (overlay_vec[i]); |
| 810 | oendpos = OVERLAY_POSITION (oend); | 821 | oendpos = OVERLAY_POSITION (oend); |
| @@ -818,7 +829,7 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr, limit) | |||
| 818 | if (region_end < endpos) | 829 | if (region_end < endpos) |
| 819 | endpos = region_end; | 830 | endpos = region_end; |
| 820 | if (region_face >= 0 && region_face < next_face_id) | 831 | if (region_face >= 0 && region_face < next_face_id) |
| 821 | merge_faces (FRAME_PARAM_FACES (f) [region_face], &face); | 832 | merge_faces (FRAME_PARAM_FACES (f)[region_face], &face); |
| 822 | } | 833 | } |
| 823 | 834 | ||
| 824 | *endptr = endpos; | 835 | *endptr = endpos; |
| @@ -1043,6 +1054,8 @@ syms_of_xfaces () | |||
| 1043 | { | 1054 | { |
| 1044 | Qface = intern ("face"); | 1055 | Qface = intern ("face"); |
| 1045 | staticpro (&Qface); | 1056 | staticpro (&Qface); |
| 1057 | Qmouse_face = intern ("mouse-face"); | ||
| 1058 | staticpro (&Qmouse_face); | ||
| 1046 | 1059 | ||
| 1047 | DEFVAR_INT ("region-face", ®ion_face, | 1060 | DEFVAR_INT ("region-face", ®ion_face, |
| 1048 | "Face number to use to highlight the region\n\ | 1061 | "Face number to use to highlight the region\n\ |