Mercurial > hg > xemacs-beta
comparison src/faces.c @ 380:8626e4521993 r21-2-5
Import from CVS: tag r21-2-5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:07:10 +0200 |
parents | 6240c7796c7a |
children | bbff43aa5eb7 |
comparison
equal
deleted
inserted
replaced
379:76b7d63099ad | 380:8626e4521993 |
---|---|
34 #include "elhash.h" | 34 #include "elhash.h" |
35 #include "extents.h" | 35 #include "extents.h" |
36 #include "faces.h" | 36 #include "faces.h" |
37 #include "frame.h" | 37 #include "frame.h" |
38 #include "glyphs.h" | 38 #include "glyphs.h" |
39 #include "hash.h" | |
40 #include "objects.h" | 39 #include "objects.h" |
41 #include "specifier.h" | 40 #include "specifier.h" |
42 #include "window.h" | 41 #include "window.h" |
43 | 42 |
44 Lisp_Object Qfacep; | 43 Lisp_Object Qfacep; |
76 static Lisp_Object | 75 static Lisp_Object |
77 mark_face (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 76 mark_face (Lisp_Object obj, void (*markobj) (Lisp_Object)) |
78 { | 77 { |
79 struct Lisp_Face *face = XFACE (obj); | 78 struct Lisp_Face *face = XFACE (obj); |
80 | 79 |
81 ((markobj) (face->name)); | 80 markobj (face->name); |
82 ((markobj) (face->doc_string)); | 81 markobj (face->doc_string); |
83 | 82 |
84 ((markobj) (face->foreground)); | 83 markobj (face->foreground); |
85 ((markobj) (face->background)); | 84 markobj (face->background); |
86 ((markobj) (face->font)); | 85 markobj (face->font); |
87 ((markobj) (face->display_table)); | 86 markobj (face->display_table); |
88 ((markobj) (face->background_pixmap)); | 87 markobj (face->background_pixmap); |
89 ((markobj) (face->underline)); | 88 markobj (face->underline); |
90 ((markobj) (face->strikethru)); | 89 markobj (face->strikethru); |
91 ((markobj) (face->highlight)); | 90 markobj (face->highlight); |
92 ((markobj) (face->dim)); | 91 markobj (face->dim); |
93 ((markobj) (face->blinking)); | 92 markobj (face->blinking); |
94 ((markobj) (face->reverse)); | 93 markobj (face->reverse); |
95 | 94 |
96 ((markobj) (face->charsets_warned_about)); | 95 markobj (face->charsets_warned_about); |
97 | 96 |
98 return face->plist; | 97 return face->plist; |
99 } | 98 } |
100 | 99 |
101 static void | 100 static void |
127 be eq. | 126 be eq. |
128 | 127 |
129 This isn't concerned with "unspecified" attributes, that's what | 128 This isn't concerned with "unspecified" attributes, that's what |
130 #'face-differs-from-default-p is for. */ | 129 #'face-differs-from-default-p is for. */ |
131 static int | 130 static int |
132 face_equal (Lisp_Object o1, Lisp_Object o2, int depth) | 131 face_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) |
133 { | 132 { |
134 struct Lisp_Face *f1 = XFACE (o1); | 133 struct Lisp_Face *f1 = XFACE (obj1); |
135 struct Lisp_Face *f2 = XFACE (o2); | 134 struct Lisp_Face *f2 = XFACE (obj2); |
136 | 135 |
137 depth++; | 136 depth++; |
138 | 137 |
139 return | 138 return |
140 (internal_equal (f1->foreground, f2->foreground, depth) && | 139 (internal_equal (f1->foreground, f2->foreground, depth) && |
373 { | 372 { |
374 Lisp_Object *face_list; | 373 Lisp_Object *face_list; |
375 }; | 374 }; |
376 | 375 |
377 static int | 376 static int |
378 add_face_to_list_mapper (CONST void *hash_key, void *hash_contents, | 377 add_face_to_list_mapper (Lisp_Object key, Lisp_Object value, |
379 void *face_list_closure) | 378 void *face_list_closure) |
380 { | 379 { |
381 /* This function can GC */ | 380 /* This function can GC */ |
382 Lisp_Object key, contents; | |
383 Lisp_Object *face_list; | |
384 struct face_list_closure *fcl = | 381 struct face_list_closure *fcl = |
385 (struct face_list_closure *) face_list_closure; | 382 (struct face_list_closure *) face_list_closure; |
386 CVOID_TO_LISP (key, hash_key); | 383 |
387 VOID_TO_LISP (contents, hash_contents); | 384 *(fcl->face_list) = Fcons (XFACE (value)->name, (*fcl->face_list)); |
388 face_list = fcl->face_list; | |
389 | |
390 *face_list = Fcons (XFACE (contents)->name, *face_list); | |
391 return 0; | 385 return 0; |
392 } | 386 } |
393 | 387 |
394 static Lisp_Object | 388 static Lisp_Object |
395 faces_list_internal (Lisp_Object list) | 389 faces_list_internal (Lisp_Object list) |
418 return faces_list_internal (Vtemporary_faces_cache); | 412 return faces_list_internal (Vtemporary_faces_cache); |
419 } | 413 } |
420 | 414 |
421 | 415 |
422 static int | 416 static int |
423 mark_face_as_clean_mapper (CONST void *hash_key, void *hash_contents, | 417 mark_face_as_clean_mapper (Lisp_Object key, Lisp_Object value, |
424 void *flag_closure) | 418 void *flag_closure) |
425 { | 419 { |
426 /* This function can GC */ | 420 /* This function can GC */ |
427 Lisp_Object key, contents; | |
428 int *flag = (int *) flag_closure; | 421 int *flag = (int *) flag_closure; |
429 CVOID_TO_LISP (key, hash_key); | 422 XFACE (value)->dirty = *flag; |
430 VOID_TO_LISP (contents, hash_contents); | |
431 XFACE (contents)->dirty = *flag; | |
432 return 0; | 423 return 0; |
433 } | 424 } |
434 | 425 |
435 static void | 426 static void |
436 mark_all_faces_internal (int flag) | 427 mark_all_faces_internal (int flag) |
1005 { | 996 { |
1006 int i; | 997 int i; |
1007 | 998 |
1008 for (i = 0; i < NUM_LEADING_BYTES; i++) | 999 for (i = 0; i < NUM_LEADING_BYTES; i++) |
1009 if (!NILP (cachel->font[i]) && !UNBOUNDP (cachel->font[i])) | 1000 if (!NILP (cachel->font[i]) && !UNBOUNDP (cachel->font[i])) |
1010 ((markobj) (cachel->font[i])); | 1001 markobj (cachel->font[i]); |
1011 } | 1002 } |
1012 ((markobj) (cachel->face)); | 1003 markobj (cachel->face); |
1013 ((markobj) (cachel->foreground)); | 1004 markobj (cachel->foreground); |
1014 ((markobj) (cachel->background)); | 1005 markobj (cachel->background); |
1015 ((markobj) (cachel->display_table)); | 1006 markobj (cachel->display_table); |
1016 ((markobj) (cachel->background_pixmap)); | 1007 markobj (cachel->background_pixmap); |
1017 } | 1008 } |
1018 } | 1009 } |
1019 | 1010 |
1020 /* ensure that the given cachel contains an updated font value for | 1011 /* ensure that the given cachel contains an updated font value for |
1021 the given charset. Return the updated font value. */ | 1012 the given charset. Return the updated font value. */ |
1636 EQ (property, Qfont))) | 1627 EQ (property, Qfont))) |
1637 update_EmacsFrames (locale, property); | 1628 update_EmacsFrames (locale, property); |
1638 | 1629 |
1639 if (WINDOWP (locale)) | 1630 if (WINDOWP (locale)) |
1640 { | 1631 { |
1641 struct frame *f = XFRAME (XWINDOW (locale)->frame); | 1632 MARK_FRAME_FACES_CHANGED (XFRAME (XWINDOW (locale)->frame)); |
1642 MARK_FRAME_FACES_CHANGED (f); | |
1643 } | 1633 } |
1644 else if (FRAMEP (locale)) | 1634 else if (FRAMEP (locale)) |
1645 { | 1635 { |
1646 struct frame *f = XFRAME (locale); | 1636 MARK_FRAME_FACES_CHANGED (XFRAME (locale)); |
1647 MARK_FRAME_FACES_CHANGED (f); | |
1648 } | 1637 } |
1649 else if (DEVICEP (locale)) | 1638 else if (DEVICEP (locale)) |
1650 { | 1639 { |
1651 struct device *d = XDEVICE (locale); | 1640 MARK_DEVICE_FRAMES_FACES_CHANGED (XDEVICE (locale)); |
1652 MARK_DEVICE_FRAMES_FACES_CHANGED (d); | |
1653 } | 1641 } |
1654 else | 1642 else |
1655 { | 1643 { |
1656 Lisp_Object devcons, concons; | 1644 Lisp_Object devcons, concons; |
1657 | |
1658 DEVICE_LOOP_NO_BREAK (devcons, concons) | 1645 DEVICE_LOOP_NO_BREAK (devcons, concons) |
1659 MARK_DEVICE_FRAMES_FACES_CHANGED (XDEVICE (XCAR (devcons))); | 1646 MARK_DEVICE_FRAMES_FACES_CHANGED (XDEVICE (XCAR (devcons))); |
1660 } | 1647 } |
1661 | 1648 |
1662 /* | 1649 /* |
1844 } | 1831 } |
1845 | 1832 |
1846 void | 1833 void |
1847 complex_vars_of_faces (void) | 1834 complex_vars_of_faces (void) |
1848 { | 1835 { |
1849 Vpermanent_faces_cache = make_lisp_hashtable (10, HASHTABLE_NONWEAK, | 1836 Vpermanent_faces_cache = |
1850 HASHTABLE_EQ); | 1837 make_lisp_hash_table (10, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); |
1851 Vtemporary_faces_cache = make_lisp_hashtable (0, HASHTABLE_WEAK, | 1838 Vtemporary_faces_cache = |
1852 HASHTABLE_EQ); | 1839 make_lisp_hash_table (0, HASH_TABLE_WEAK, HASH_TABLE_EQ); |
1853 | 1840 |
1854 /* Create the default face now so we know what it is immediately. */ | 1841 /* Create the default face now so we know what it is immediately. */ |
1855 | 1842 |
1856 Vdefault_face = Qnil; /* so that Fmake_face() doesn't set up a bogus | 1843 Vdefault_face = Qnil; /* so that Fmake_face() doesn't set up a bogus |
1857 default value */ | 1844 default value */ |
1939 list1 (Fcons (Qnil, Qnil))); | 1926 list1 (Fcons (Qnil, Qnil))); |
1940 set_specifier_fallback (Fget (Vdefault_face, Qblinking, Qnil), | 1927 set_specifier_fallback (Fget (Vdefault_face, Qblinking, Qnil), |
1941 list1 (Fcons (Qnil, Qnil))); | 1928 list1 (Fcons (Qnil, Qnil))); |
1942 set_specifier_fallback (Fget (Vdefault_face, Qreverse, Qnil), | 1929 set_specifier_fallback (Fget (Vdefault_face, Qreverse, Qnil), |
1943 list1 (Fcons (Qnil, Qnil))); | 1930 list1 (Fcons (Qnil, Qnil))); |
1944 | 1931 |
1945 /* gui-element is the parent face of all gui elements such as | 1932 /* gui-element is the parent face of all gui elements such as |
1946 modeline, vertical divider and toolbar. */ | 1933 modeline, vertical divider and toolbar. */ |
1947 Vgui_element_face = Fmake_face (Qgui_element, | 1934 Vgui_element_face = Fmake_face (Qgui_element, |
1948 build_string ("gui element face"), | 1935 build_string ("gui element face"), |
1949 Qnil); | 1936 Qnil); |
1982 set_specifier_fallback (Fget (Vmodeline_face, Qbackground, Qunbound), | 1969 set_specifier_fallback (Fget (Vmodeline_face, Qbackground, Qunbound), |
1983 Fget (Vgui_element_face, Qbackground, Qunbound)); | 1970 Fget (Vgui_element_face, Qbackground, Qunbound)); |
1984 set_specifier_fallback (Fget (Vmodeline_face, Qbackground_pixmap, Qnil), | 1971 set_specifier_fallback (Fget (Vmodeline_face, Qbackground_pixmap, Qnil), |
1985 Fget (Vgui_element_face, Qbackground_pixmap, | 1972 Fget (Vgui_element_face, Qbackground_pixmap, |
1986 Qunbound)); | 1973 Qunbound)); |
1987 | 1974 |
1988 /* toolbar is another gui element */ | 1975 /* toolbar is another gui element */ |
1989 Vtoolbar_face = Fmake_face (Qtoolbar, | 1976 Vtoolbar_face = Fmake_face (Qtoolbar, |
1990 build_string ("toolbar face"), | 1977 build_string ("toolbar face"), |
1991 Qnil); | 1978 Qnil); |
1992 set_specifier_fallback (Fget (Vtoolbar_face, Qforeground, Qunbound), | 1979 set_specifier_fallback (Fget (Vtoolbar_face, Qforeground, Qunbound), |