diff options
| author | Kim F. Storm | 2004-09-14 20:04:09 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-09-14 20:04:09 +0000 |
| commit | 46b00436e7462db7f94dfa4b057259ab3262a2a4 (patch) | |
| tree | 7cf00938cea655ead68dd5374f76a8e9f50ee09b | |
| parent | bfa025635408c58b385d7a7b64e13cf1c8fd3ec6 (diff) | |
| download | emacs-46b00436e7462db7f94dfa4b057259ab3262a2a4.tar.gz emacs-46b00436e7462db7f94dfa4b057259ab3262a2a4.zip | |
(Qface_no_inherit): New var.
(syms_of_xfaces): Intern and staticpro it.
(Finternal_make_lisp_face, Finternal_set_lisp_face_attribute)
(Finternal_copy_lisp_face, update_face_from_frame_parameter):
Don't increment face_change_count when face has non-nil
face-no-inherit property.
| -rw-r--r-- | src/xfaces.c | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index aafd762b73b..8f604e33cce 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -385,6 +385,10 @@ Lisp_Object Qforeground_color, Qbackground_color; | |||
| 385 | Lisp_Object Qface; | 385 | Lisp_Object Qface; |
| 386 | extern Lisp_Object Qmouse_face; | 386 | extern Lisp_Object Qmouse_face; |
| 387 | 387 | ||
| 388 | /* Property for basic faces which other faces cannot inherit. */ | ||
| 389 | |||
| 390 | Lisp_Object Qface_no_inherit; | ||
| 391 | |||
| 388 | /* Error symbol for wrong_type_argument in load_pixmap. */ | 392 | /* Error symbol for wrong_type_argument in load_pixmap. */ |
| 389 | 393 | ||
| 390 | Lisp_Object Qbitmap_spec_p; | 394 | Lisp_Object Qbitmap_spec_p; |
| @@ -3865,8 +3869,11 @@ Value is a vector of face attributes. */) | |||
| 3865 | depend on the face, make sure they are all removed. This is done | 3869 | depend on the face, make sure they are all removed. This is done |
| 3866 | by incrementing face_change_count. The next call to | 3870 | by incrementing face_change_count. The next call to |
| 3867 | init_iterator will then free realized faces. */ | 3871 | init_iterator will then free realized faces. */ |
| 3868 | ++face_change_count; | 3872 | if (NILP (Fget (face, Qface_no_inherit))) |
| 3869 | ++windows_or_buffers_changed; | 3873 | { |
| 3874 | ++face_change_count; | ||
| 3875 | ++windows_or_buffers_changed; | ||
| 3876 | } | ||
| 3870 | 3877 | ||
| 3871 | xassert (LFACEP (lface)); | 3878 | xassert (LFACEP (lface)); |
| 3872 | check_lface (lface); | 3879 | check_lface (lface); |
| @@ -3941,8 +3948,11 @@ The value is TO. */) | |||
| 3941 | depend on the face, make sure they are all removed. This is done | 3948 | depend on the face, make sure they are all removed. This is done |
| 3942 | by incrementing face_change_count. The next call to | 3949 | by incrementing face_change_count. The next call to |
| 3943 | init_iterator will then free realized faces. */ | 3950 | init_iterator will then free realized faces. */ |
| 3944 | ++face_change_count; | 3951 | if (NILP (Fget (to, Qface_no_inherit))) |
| 3945 | ++windows_or_buffers_changed; | 3952 | { |
| 3953 | ++face_change_count; | ||
| 3954 | ++windows_or_buffers_changed; | ||
| 3955 | } | ||
| 3946 | 3956 | ||
| 3947 | return to; | 3957 | return to; |
| 3948 | } | 3958 | } |
| @@ -4299,6 +4309,7 @@ FRAME 0 means change the face on all frames, and change the default | |||
| 4299 | by incrementing face_change_count. The next call to | 4309 | by incrementing face_change_count. The next call to |
| 4300 | init_iterator will then free realized faces. */ | 4310 | init_iterator will then free realized faces. */ |
| 4301 | if (!EQ (frame, Qt) | 4311 | if (!EQ (frame, Qt) |
| 4312 | && NILP (Fget (face, Qface_no_inherit)) | ||
| 4302 | && (EQ (attr, QCfont) | 4313 | && (EQ (attr, QCfont) |
| 4303 | || NILP (Fequal (old_value, value)))) | 4314 | || NILP (Fequal (old_value, value)))) |
| 4304 | { | 4315 | { |
| @@ -4451,6 +4462,7 @@ update_face_from_frame_parameter (f, param, new_value) | |||
| 4451 | struct frame *f; | 4462 | struct frame *f; |
| 4452 | Lisp_Object param, new_value; | 4463 | Lisp_Object param, new_value; |
| 4453 | { | 4464 | { |
| 4465 | Lisp_Object face = Qnil; | ||
| 4454 | Lisp_Object lface; | 4466 | Lisp_Object lface; |
| 4455 | 4467 | ||
| 4456 | /* If there are no faces yet, give up. This is the case when called | 4468 | /* If there are no faces yet, give up. This is the case when called |
| @@ -4459,17 +4471,10 @@ update_face_from_frame_parameter (f, param, new_value) | |||
| 4459 | if (NILP (f->face_alist)) | 4471 | if (NILP (f->face_alist)) |
| 4460 | return; | 4472 | return; |
| 4461 | 4473 | ||
| 4462 | /* Changing a named face means that all realized faces depending on | ||
| 4463 | that face are invalid. Since we cannot tell which realized faces | ||
| 4464 | depend on the face, make sure they are all removed. This is done | ||
| 4465 | by incrementing face_change_count. The next call to | ||
| 4466 | init_iterator will then free realized faces. */ | ||
| 4467 | ++face_change_count; | ||
| 4468 | ++windows_or_buffers_changed; | ||
| 4469 | |||
| 4470 | if (EQ (param, Qforeground_color)) | 4474 | if (EQ (param, Qforeground_color)) |
| 4471 | { | 4475 | { |
| 4472 | lface = lface_from_face_name (f, Qdefault, 1); | 4476 | face = Qdefault; |
| 4477 | lface = lface_from_face_name (f, face, 1); | ||
| 4473 | LFACE_FOREGROUND (lface) = (STRINGP (new_value) | 4478 | LFACE_FOREGROUND (lface) = (STRINGP (new_value) |
| 4474 | ? new_value : Qunspecified); | 4479 | ? new_value : Qunspecified); |
| 4475 | realize_basic_faces (f); | 4480 | realize_basic_faces (f); |
| @@ -4484,29 +4489,45 @@ update_face_from_frame_parameter (f, param, new_value) | |||
| 4484 | XSETFRAME (frame, f); | 4489 | XSETFRAME (frame, f); |
| 4485 | call1 (Qframe_update_face_colors, frame); | 4490 | call1 (Qframe_update_face_colors, frame); |
| 4486 | 4491 | ||
| 4487 | lface = lface_from_face_name (f, Qdefault, 1); | 4492 | face = Qdefault; |
| 4493 | lface = lface_from_face_name (f, face, 1); | ||
| 4488 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) | 4494 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
| 4489 | ? new_value : Qunspecified); | 4495 | ? new_value : Qunspecified); |
| 4490 | realize_basic_faces (f); | 4496 | realize_basic_faces (f); |
| 4491 | } | 4497 | } |
| 4492 | if (EQ (param, Qborder_color)) | 4498 | else if (EQ (param, Qborder_color)) |
| 4493 | { | 4499 | { |
| 4494 | lface = lface_from_face_name (f, Qborder, 1); | 4500 | face = Qborder; |
| 4501 | lface = lface_from_face_name (f, face, 1); | ||
| 4495 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) | 4502 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
| 4496 | ? new_value : Qunspecified); | 4503 | ? new_value : Qunspecified); |
| 4497 | } | 4504 | } |
| 4498 | else if (EQ (param, Qcursor_color)) | 4505 | else if (EQ (param, Qcursor_color)) |
| 4499 | { | 4506 | { |
| 4500 | lface = lface_from_face_name (f, Qcursor, 1); | 4507 | face = Qcursor; |
| 4508 | lface = lface_from_face_name (f, face, 1); | ||
| 4501 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) | 4509 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
| 4502 | ? new_value : Qunspecified); | 4510 | ? new_value : Qunspecified); |
| 4503 | } | 4511 | } |
| 4504 | else if (EQ (param, Qmouse_color)) | 4512 | else if (EQ (param, Qmouse_color)) |
| 4505 | { | 4513 | { |
| 4506 | lface = lface_from_face_name (f, Qmouse, 1); | 4514 | face = Qmouse; |
| 4515 | lface = lface_from_face_name (f, face, 1); | ||
| 4507 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) | 4516 | LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
| 4508 | ? new_value : Qunspecified); | 4517 | ? new_value : Qunspecified); |
| 4509 | } | 4518 | } |
| 4519 | |||
| 4520 | /* Changing a named face means that all realized faces depending on | ||
| 4521 | that face are invalid. Since we cannot tell which realized faces | ||
| 4522 | depend on the face, make sure they are all removed. This is done | ||
| 4523 | by incrementing face_change_count. The next call to | ||
| 4524 | init_iterator will then free realized faces. */ | ||
| 4525 | if (!NILP (face) | ||
| 4526 | && NILP (Fget (face, Qface_no_inherit))) | ||
| 4527 | { | ||
| 4528 | ++face_change_count; | ||
| 4529 | ++windows_or_buffers_changed; | ||
| 4530 | } | ||
| 4510 | } | 4531 | } |
| 4511 | 4532 | ||
| 4512 | 4533 | ||
| @@ -7758,6 +7779,8 @@ syms_of_xfaces () | |||
| 7758 | { | 7779 | { |
| 7759 | Qface = intern ("face"); | 7780 | Qface = intern ("face"); |
| 7760 | staticpro (&Qface); | 7781 | staticpro (&Qface); |
| 7782 | Qface_no_inherit = intern ("face-no-inherit"); | ||
| 7783 | staticpro (&Qface_no_inherit); | ||
| 7761 | Qbitmap_spec_p = intern ("bitmap-spec-p"); | 7784 | Qbitmap_spec_p = intern ("bitmap-spec-p"); |
| 7762 | staticpro (&Qbitmap_spec_p); | 7785 | staticpro (&Qbitmap_spec_p); |
| 7763 | Qframe_update_face_colors = intern ("frame-update-face-colors"); | 7786 | Qframe_update_face_colors = intern ("frame-update-face-colors"); |