diff options
| author | Miles Bader | 2008-02-05 02:36:40 +0000 |
|---|---|---|
| committer | Miles Bader | 2008-02-05 02:36:40 +0000 |
| commit | e7d7fd8ccf10888aa241e0c80bc5e6b4242b8331 (patch) | |
| tree | 5aec2f0db1e044e492e61cd3327ff9045845245c /src | |
| parent | 9f432734f6be94e69ee8870008b2de2a7b8e5266 (diff) | |
| download | emacs-e7d7fd8ccf10888aa241e0c80bc5e6b4242b8331.tar.gz emacs-e7d7fd8ccf10888aa241e0c80bc5e6b4242b8331.zip | |
Revert 2008-02-01 change to src/xfaces.c by cyd@stupidchicken.com
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1051
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xfaces.c | 94 |
2 files changed, 70 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ef06b02aa2e..2ef19eca667 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2008-02-05 Miles Bader <miles@gnu.org> | ||
| 2 | |||
| 3 | * xfaces.c (get_lface_attributes, merge_named_face) | ||
| 4 | (lookup_named_face, lookup_derived_face, realize_named_face): | ||
| 5 | Revert 2008-02-01 change by cyd@stupidchicken.com. | ||
| 6 | |||
| 1 | 2008-02-04 Kenichi Handa <handa@ni.aist.go.jp> | 7 | 2008-02-04 Kenichi Handa <handa@ni.aist.go.jp> |
| 2 | 8 | ||
| 3 | * fontset.c (Ffontset_info): Handle the case of inhibitting the | 9 | * fontset.c (Ffontset_info): Handle the case of inhibitting the |
diff --git a/src/xfaces.c b/src/xfaces.c index 2f9db65f80b..c00dade631b 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -492,6 +492,7 @@ static int better_font_p P_ ((int *, struct font_name *, struct font_name *, | |||
| 492 | static int x_face_list_fonts P_ ((struct frame *, char *, | 492 | static int x_face_list_fonts P_ ((struct frame *, char *, |
| 493 | struct font_name **, int, int)); | 493 | struct font_name **, int, int)); |
| 494 | static int font_scalable_p P_ ((struct font_name *)); | 494 | static int font_scalable_p P_ ((struct font_name *)); |
| 495 | static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, int)); | ||
| 495 | static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *)); | 496 | static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *)); |
| 496 | static unsigned char *xstrlwr P_ ((unsigned char *)); | 497 | static unsigned char *xstrlwr P_ ((unsigned char *)); |
| 497 | static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); | 498 | static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); |
| @@ -3438,6 +3439,36 @@ lface_from_face_name (f, face_name, signal_p) | |||
| 3438 | } | 3439 | } |
| 3439 | 3440 | ||
| 3440 | 3441 | ||
| 3442 | /* Get face attributes of face FACE_NAME from frame-local faces on | ||
| 3443 | frame F. Store the resulting attributes in ATTRS which must point | ||
| 3444 | to a vector of Lisp_Objects of size LFACE_VECTOR_SIZE. If SIGNAL_P | ||
| 3445 | is non-zero, signal an error if FACE_NAME does not name a face. | ||
| 3446 | Otherwise, value is zero if FACE_NAME is not a face. */ | ||
| 3447 | |||
| 3448 | static INLINE int | ||
| 3449 | get_lface_attributes (f, face_name, attrs, signal_p) | ||
| 3450 | struct frame *f; | ||
| 3451 | Lisp_Object face_name; | ||
| 3452 | Lisp_Object *attrs; | ||
| 3453 | int signal_p; | ||
| 3454 | { | ||
| 3455 | Lisp_Object lface; | ||
| 3456 | int success_p; | ||
| 3457 | |||
| 3458 | lface = lface_from_face_name (f, face_name, signal_p); | ||
| 3459 | if (!NILP (lface)) | ||
| 3460 | { | ||
| 3461 | bcopy (XVECTOR (lface)->contents, attrs, | ||
| 3462 | LFACE_VECTOR_SIZE * sizeof *attrs); | ||
| 3463 | success_p = 1; | ||
| 3464 | } | ||
| 3465 | else | ||
| 3466 | success_p = 0; | ||
| 3467 | |||
| 3468 | return success_p; | ||
| 3469 | } | ||
| 3470 | |||
| 3471 | |||
| 3441 | /* Non-zero if all attributes in face attribute vector ATTRS are | 3472 | /* Non-zero if all attributes in face attribute vector ATTRS are |
| 3442 | specified, i.e. are non-nil. */ | 3473 | specified, i.e. are non-nil. */ |
| 3443 | 3474 | ||
| @@ -3723,14 +3754,12 @@ merge_face_heights (from, to, invalid) | |||
| 3723 | 3754 | ||
| 3724 | /* Merge two Lisp face attribute vectors on frame F, FROM and TO, and | 3755 | /* Merge two Lisp face attribute vectors on frame F, FROM and TO, and |
| 3725 | store the resulting attributes in TO, which must be already be | 3756 | store the resulting attributes in TO, which must be already be |
| 3726 | completely specified and contain only absolute attributes. The | 3757 | completely specified and contain only absolute attributes. Every |
| 3727 | contents of FROM are not altered. | 3758 | specified attribute of FROM overrides the corresponding attribute of |
| 3728 | 3759 | TO; relative attributes in FROM are merged with the absolute value in | |
| 3729 | Every specified attribute of FROM overrides the corresponding | 3760 | TO and replace it. NAMED_MERGE_POINTS is used internally to detect |
| 3730 | attribute of TO; relative attributes in FROM are merged with the | 3761 | loops in face inheritance; it should be 0 when called from other |
| 3731 | absolute value in TO and replace it. NAMED_MERGE_POINTS is used | 3762 | places. */ |
| 3732 | internally to detect loops in face inheritance; it should be 0 when | ||
| 3733 | called from other places. */ | ||
| 3734 | 3763 | ||
| 3735 | static INLINE void | 3764 | static INLINE void |
| 3736 | merge_face_vectors (f, from, to, named_merge_points) | 3765 | merge_face_vectors (f, from, to, named_merge_points) |
| @@ -3794,15 +3823,17 @@ merge_named_face (f, face_name, to, named_merge_points) | |||
| 3794 | face_name, &named_merge_points)) | 3823 | face_name, &named_merge_points)) |
| 3795 | { | 3824 | { |
| 3796 | struct gcpro gcpro1; | 3825 | struct gcpro gcpro1; |
| 3797 | Lisp_Object lface = lface_from_face_name (f, face_name, 0); | 3826 | Lisp_Object from[LFACE_VECTOR_SIZE]; |
| 3798 | if (NILP (lface)) | 3827 | int ok = get_lface_attributes (f, face_name, from, 0); |
| 3799 | return 0; | ||
| 3800 | 3828 | ||
| 3801 | GCPRO1 (named_merge_point.face_name); | 3829 | if (ok) |
| 3802 | merge_face_vectors (f, XVECTOR (lface)->contents, to, | 3830 | { |
| 3803 | named_merge_points); | 3831 | GCPRO1 (named_merge_point.face_name); |
| 3804 | UNGCPRO; | 3832 | merge_face_vectors (f, from, to, named_merge_points); |
| 3805 | return 1; | 3833 | UNGCPRO; |
| 3834 | } | ||
| 3835 | |||
| 3836 | return ok; | ||
| 3806 | } | 3837 | } |
| 3807 | else | 3838 | else |
| 3808 | return 0; | 3839 | return 0; |
| @@ -3829,8 +3860,6 @@ merge_named_face (f, face_name, to, named_merge_points) | |||
| 3829 | (BACKGROUND-COLOR . COLOR) where COLOR is a color name. This is | 3860 | (BACKGROUND-COLOR . COLOR) where COLOR is a color name. This is |
| 3830 | for compatibility with 20.2. | 3861 | for compatibility with 20.2. |
| 3831 | 3862 | ||
| 3832 | The contents of FACE_REF is not altered by this function. | ||
| 3833 | |||
| 3834 | Face specifications earlier in lists take precedence over later | 3863 | Face specifications earlier in lists take precedence over later |
| 3835 | specifications. */ | 3864 | specifications. */ |
| 3836 | 3865 | ||
| @@ -6088,7 +6117,8 @@ lookup_named_face (f, symbol, signal_p) | |||
| 6088 | Lisp_Object symbol; | 6117 | Lisp_Object symbol; |
| 6089 | int signal_p; | 6118 | int signal_p; |
| 6090 | { | 6119 | { |
| 6091 | Lisp_Object lface, attrs[LFACE_VECTOR_SIZE]; | 6120 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
| 6121 | Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; | ||
| 6092 | struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | 6122 | struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
| 6093 | 6123 | ||
| 6094 | if (default_face == NULL) | 6124 | if (default_face == NULL) |
| @@ -6100,12 +6130,11 @@ lookup_named_face (f, symbol, signal_p) | |||
| 6100 | abort (); /* realize_basic_faces must have set it up */ | 6130 | abort (); /* realize_basic_faces must have set it up */ |
| 6101 | } | 6131 | } |
| 6102 | 6132 | ||
| 6103 | lface = lface_from_face_name (f, symbol, signal_p); | 6133 | if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p)) |
| 6104 | if (NILP (lface)) | ||
| 6105 | return -1; | 6134 | return -1; |
| 6106 | 6135 | ||
| 6107 | bcopy (default_face->lface, attrs, sizeof attrs); | 6136 | bcopy (default_face->lface, attrs, sizeof attrs); |
| 6108 | merge_face_vectors (f, XVECTOR (lface)->contents, attrs, 0); | 6137 | merge_face_vectors (f, symbol_attrs, attrs, 0); |
| 6109 | 6138 | ||
| 6110 | return lookup_face (f, attrs); | 6139 | return lookup_face (f, attrs); |
| 6111 | } | 6140 | } |
| @@ -6236,16 +6265,16 @@ lookup_derived_face (f, symbol, face_id, signal_p) | |||
| 6236 | int face_id; | 6265 | int face_id; |
| 6237 | int signal_p; | 6266 | int signal_p; |
| 6238 | { | 6267 | { |
| 6239 | Lisp_Object lface, attrs[LFACE_VECTOR_SIZE]; | 6268 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
| 6240 | Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; | 6269 | Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; |
| 6241 | struct face *default_face = FACE_FROM_ID (f, face_id); | 6270 | struct face *default_face = FACE_FROM_ID (f, face_id); |
| 6242 | 6271 | ||
| 6243 | if (!default_face) | 6272 | if (!default_face) |
| 6244 | abort (); | 6273 | abort (); |
| 6245 | 6274 | ||
| 6246 | lface = lface_from_face_name (f, symbol, signal_p); | 6275 | get_lface_attributes (f, symbol, symbol_attrs, signal_p); |
| 6247 | bcopy (default_face->lface, attrs, sizeof attrs); | 6276 | bcopy (default_face->lface, attrs, sizeof attrs); |
| 6248 | merge_face_vectors (f, XVECTOR (lface)->contents, attrs, 0); | 6277 | merge_face_vectors (f, symbol_attrs, attrs, 0); |
| 6249 | return lookup_face (f, attrs); | 6278 | return lookup_face (f, attrs); |
| 6250 | } | 6279 | } |
| 6251 | 6280 | ||
| @@ -7536,16 +7565,18 @@ realize_named_face (f, symbol, id) | |||
| 7536 | Lisp_Object symbol; | 7565 | Lisp_Object symbol; |
| 7537 | int id; | 7566 | int id; |
| 7538 | { | 7567 | { |
| 7568 | struct face_cache *c = FRAME_FACE_CACHE (f); | ||
| 7539 | Lisp_Object lface = lface_from_face_name (f, symbol, 0); | 7569 | Lisp_Object lface = lface_from_face_name (f, symbol, 0); |
| 7540 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | 7570 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
| 7541 | struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | 7571 | Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; |
| 7572 | struct face *new_face; | ||
| 7542 | 7573 | ||
| 7543 | /* The default face must exist and be fully specified. */ | 7574 | /* The default face must exist and be fully specified. */ |
| 7544 | bcopy (default_face->lface, attrs, LFACE_VECTOR_SIZE * sizeof *attrs); | 7575 | get_lface_attributes (f, Qdefault, attrs, 1); |
| 7545 | check_lface_attrs (attrs); | 7576 | check_lface_attrs (attrs); |
| 7546 | xassert (lface_fully_specified_p (attrs)); | 7577 | xassert (lface_fully_specified_p (attrs)); |
| 7547 | 7578 | ||
| 7548 | /* If SYMBOL isn't known as a face, create it. */ | 7579 | /* If SYMBOL isn't know as a face, create it. */ |
| 7549 | if (NILP (lface)) | 7580 | if (NILP (lface)) |
| 7550 | { | 7581 | { |
| 7551 | Lisp_Object frame; | 7582 | Lisp_Object frame; |
| @@ -7554,8 +7585,11 @@ realize_named_face (f, symbol, id) | |||
| 7554 | } | 7585 | } |
| 7555 | 7586 | ||
| 7556 | /* Merge SYMBOL's face with the default face. */ | 7587 | /* Merge SYMBOL's face with the default face. */ |
| 7557 | merge_face_vectors (f, XVECTOR (lface)->contents, attrs, 0); | 7588 | get_lface_attributes (f, symbol, symbol_attrs, 1); |
| 7558 | realize_face (FRAME_FACE_CACHE (f), attrs, id); | 7589 | merge_face_vectors (f, symbol_attrs, attrs, 0); |
| 7590 | |||
| 7591 | /* Realize the face. */ | ||
| 7592 | new_face = realize_face (c, attrs, id); | ||
| 7559 | } | 7593 | } |
| 7560 | 7594 | ||
| 7561 | 7595 | ||