aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeoff Voelker1998-04-17 05:08:02 +0000
committerGeoff Voelker1998-04-17 05:08:02 +0000
commit8be05193e8c8bde6006aec8abd7f521ee78caab5 (patch)
treeffd93c7a19ac37bb011d6feb7c20ba7bc260ce89 /src
parentead2be985a6434e33488e1e60571a6c1c75be1b6 (diff)
downloademacs-8be05193e8c8bde6006aec8abd7f521ee78caab5.tar.gz
emacs-8be05193e8c8bde6006aec8abd7f521ee78caab5.zip
(Qforeground_color, Qbackground_color): Declare.
(compute_char_face, merge_face_list): Update from xterm.c.
Diffstat (limited to 'src')
-rw-r--r--src/w32faces.c136
1 files changed, 67 insertions, 69 deletions
diff --git a/src/w32faces.c b/src/w32faces.c
index 1a229f4ff22..cc61c5017ec 100644
--- a/src/w32faces.c
+++ b/src/w32faces.c
@@ -139,6 +139,9 @@ static int new_computed_face ( /* FRAME_PTR, struct face * */ );
139static int intern_computed_face ( /* FRAME_PTR, struct face * */ ); 139static int intern_computed_face ( /* FRAME_PTR, struct face * */ );
140static void ensure_face_ready ( /* FRAME_PTR, int id */ ); 140static void ensure_face_ready ( /* FRAME_PTR, int id */ );
141void recompute_basic_faces ( /* FRAME_PTR f */ ); 141void recompute_basic_faces ( /* FRAME_PTR f */ );
142static void merge_face_list ( /* FRAME_PTR, struct face *, Lisp_Object */ );
143
144extern Lisp_Object Qforeground_color, Qbackground_color;
142 145
143/* Allocating, copying, and comparing struct faces. */ 146/* Allocating, copying, and comparing struct faces. */
144 147
@@ -663,7 +666,6 @@ compute_glyph_face_1 (f, face_name, current_face)
663 the time this function can take. 666 the time this function can take.
664 667
665 If MOUSE is nonzero, use the character's mouse-face, not its face. */ 668 If MOUSE is nonzero, use the character's mouse-face, not its face. */
666
667int 669int
668compute_char_face (f, w, pos, region_beg, region_end, endptr, limit, mouse) 670compute_char_face (f, w, pos, region_beg, region_end, endptr, limit, mouse)
669 struct frame *f; 671 struct frame *f;
@@ -746,82 +748,23 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr, limit, mouse)
746 748
747 compute_base_face (f, &face); 749 compute_base_face (f, &face);
748 750
749 if (CONSP (prop)) 751 merge_face_list (f, &face, prop);
750 {
751 /* We have a list of faces, merge them in reverse order */
752 Lisp_Object length = Flength (prop);
753 int len = XINT (length);
754 Lisp_Object *faces;
755
756 /* Put them into an array */
757 faces = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
758 for (j = 0; j < len; j++)
759 {
760 faces[j] = Fcar (prop);
761 prop = Fcdr (prop);
762 }
763 /* So that we can merge them in the reverse order */
764 for (j = len - 1; j >= 0; j--)
765 {
766 facecode = face_name_id_number (f, faces[j]);
767 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
768 && FRAME_PARAM_FACES (f) [facecode] != 0)
769 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face);
770 }
771 }
772 else if (!NILP (prop))
773 {
774 facecode = face_name_id_number (f, prop);
775 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
776 && FRAME_PARAM_FACES (f) [facecode] != 0)
777 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face);
778 }
779 752
780 noverlays = sort_overlays (overlay_vec, noverlays, w); 753 noverlays = sort_overlays (overlay_vec, noverlays, w);
781 754
782 /* Now merge the overlay data in that order. */ 755 /* Now merge the overlay data in that order. */
783 for (i = 0; i < noverlays; i++) 756 for (i = 0; i < noverlays; i++)
784 { 757 {
785 prop = Foverlay_get (overlay_vec[i], propname); 758 Lisp_Object oend;
786 if (CONSP (prop)) 759 int oendpos;
787 {
788 /* We have a list of faces, merge them in reverse order */
789 Lisp_Object length = Flength (prop);
790 int len = XINT (length);
791 Lisp_Object *faces;
792 int i;
793
794 /* Put them into an array */
795 faces = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
796 for (j = 0; j < len; j++)
797 {
798 faces[j] = Fcar (prop);
799 prop = Fcdr (prop);
800 }
801 /* So that we can merge them in the reverse order */
802 for (j = len - 1; j >= 0; j--)
803 {
804 facecode = face_name_id_number (f, faces[j]);
805 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
806 && FRAME_PARAM_FACES (f) [facecode] != 0)
807 merge_faces (FRAME_PARAM_FACES (f) [facecode], &face);
808 }
809 }
810 else if (!NILP (prop))
811 {
812 Lisp_Object oend;
813 int oendpos;
814 760
815 facecode = face_name_id_number (f, prop); 761 prop = Foverlay_get (overlay_vec[i], propname);
816 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f) 762 merge_face_list (f, &face, prop);
817 && FRAME_PARAM_FACES (f) [facecode] != 0)
818 merge_faces (FRAME_PARAM_FACES (f)[facecode], &face);
819 763
820 oend = OVERLAY_END (overlay_vec[i]); 764 oend = OVERLAY_END (overlay_vec[i]);
821 oendpos = OVERLAY_POSITION (oend); 765 oendpos = OVERLAY_POSITION (oend);
822 if (oendpos < endpos) 766 if (oendpos < endpos)
823 endpos = oendpos; 767 endpos = oendpos;
824 }
825 } 768 }
826 769
827 if (pos >= region_beg && pos < region_end) 770 if (pos >= region_beg && pos < region_end)
@@ -836,6 +779,61 @@ compute_char_face (f, w, pos, region_beg, region_end, endptr, limit, mouse)
836 779
837 return intern_computed_face (f, &face); 780 return intern_computed_face (f, &face);
838} 781}
782
783static void
784merge_face_list (f, face, prop)
785 FRAME_PTR f;
786 struct face *face;
787 Lisp_Object prop;
788{
789 Lisp_Object length;
790 int len;
791 Lisp_Object *faces;
792 int j;
793
794 if (CONSP (prop)
795 && ! STRINGP (XCONS (prop)->cdr))
796 {
797 /* We have a list of faces, merge them in reverse order. */
798
799 length = Fsafe_length (prop);
800 len = XFASTINT (length);
801
802 /* Put them into an array. */
803 faces = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
804 for (j = 0; j < len; j++)
805 {
806 faces[j] = Fcar (prop);
807 prop = Fcdr (prop);
808 }
809 /* So that we can merge them in the reverse order. */
810 }
811 else
812 {
813 faces = (Lisp_Object *) alloca (sizeof (Lisp_Object));
814 faces[0] = prop;
815 len = 1;
816 }
817
818 for (j = len - 1; j >= 0; j--)
819 {
820 if (CONSP (faces[j]))
821 {
822 if (EQ (XCONS (faces[j])->car, Qbackground_color))
823 face->background = load_color (f, XCONS (faces[j])->cdr);
824 if (EQ (XCONS (faces[j])->car, Qforeground_color))
825 face->foreground = load_color (f, XCONS (faces[j])->cdr);
826 }
827 else
828 {
829 int facecode = face_name_id_number (f, faces[j]);
830 if (facecode >= 0 && facecode < FRAME_N_PARAM_FACES (f)
831 && FRAME_PARAM_FACES (f) [facecode] != 0)
832 merge_faces (FRAME_PARAM_FACES (f) [facecode], face);
833 }
834 }
835}
836
839 837
840/* Recompute the GC's for the default and modeline faces. 838/* Recompute the GC's for the default and modeline faces.
841 We call this after changing frame parameters on which those GC's 839 We call this after changing frame parameters on which those GC's