diff options
| author | Jason Rumney | 2000-03-04 14:56:00 +0000 |
|---|---|---|
| committer | Jason Rumney | 2000-03-04 14:56:00 +0000 |
| commit | c3cee01337f6c09aa3444c99d76fdc3f257f0e1c (patch) | |
| tree | aaca22c4f5c87afc62c2ffd52c03492e3effe2f0 /src | |
| parent | 00150e8a22b200eb6e18c39a177aef8b9162ed9d (diff) | |
| download | emacs-c3cee01337f6c09aa3444c99d76fdc3f257f0e1c.tar.gz emacs-c3cee01337f6c09aa3444c99d76fdc3f257f0e1c.zip | |
Change many FRAME_X... macros to FRAME_WINDOW... or other
non-platform-specific equivalents.
[WINDOWSNT]: include w32term.h, fontset.h and define X specific
functions and macros as their w32 equivalents where
non-platform-specifics are not available.
[HAVE_X_WINDOWS]: Change most of these to HAVE_WINDOW_SYSTEM.
(x_create_gc, x_free_gc) [WINDOWSNT]: Add W32 versions.
(clear_font_table) [WINDOWSNT]: Call w32_unload_font.
(frame_update_line_height): Use macros to access f->output_data.
(defined_color): Remove FIXME comments; fixed.
(x_face_list_fonts, prepare_face_for_display): Put X specifics into
#ifdef blocks. Add WINDOWSNT blocks.
(Fx_list_fonts): Use macros for accessing font data.
(set_lface_from_font_name): Different default fonts for X and WINDOWSNT.
(font_scalable_p) [WINDOWSNT]: Treat wildcard XLFD_AVGWIDTH as
scalable for backward compatibility.
(realize_tty_face) [MSDOS]: do the same for WINDOWSNT.
(syms_of_xfaces) [WINDOWSNT]: Allow scalable fonts by default.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 28 | ||||
| -rw-r--r-- | src/xfaces.c | 334 |
2 files changed, 267 insertions, 95 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8d783d5993f..725a012544a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,31 @@ | |||
| 1 | 2000-03-04 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * xfaces.c Change many FRAME_X... macros to FRAME_WINDOW... or | ||
| 4 | other non-platform-specific equivalents. | ||
| 5 | [WINDOWSNT]: include w32term.h, fontset.h and define X | ||
| 6 | specific functions and macros as their w32 equivalents where | ||
| 7 | non-platform-specifics are not available. | ||
| 8 | [HAVE_X_WINDOWS]: Change most of these to HAVE_WINDOW_SYSTEM. | ||
| 9 | (x_create_gc, x_free_gc) [WINDOWSNT]: Add W32 versions. | ||
| 10 | (clear_font_table) [WINDOWSNT]: Call w32_unload_font. | ||
| 11 | (frame_update_line_height): Use macros to access f->output_data. | ||
| 12 | (defined_color): Remove FIXME comments; fixed. | ||
| 13 | (x_face_list_fonts, prepare_face_for_display): Put X specifics | ||
| 14 | into #ifdef blocks. Add WINDOWSNT blocks. | ||
| 15 | (Fx_list_fonts): Use macros for accessing font data. | ||
| 16 | (set_lface_from_font_name): Different default fonts for X and | ||
| 17 | WINDOWSNT. | ||
| 18 | (font_scalable_p) [WINDOWSNT]: Treat wildcard XLFD_AVGWIDTH as | ||
| 19 | scalable for backward compatibility. | ||
| 20 | (realize_tty_face) [MSDOS]: do the same for WINDOWSNT. | ||
| 21 | (syms_of_xfaces) [WINDOWSNT]: Allow scalable fonts by default. | ||
| 22 | |||
| 23 | * emacs.c (main) [HAVE_NTGUI]: call syms_of_xfaces instead of | ||
| 24 | syms_of_w32faces. | ||
| 25 | |||
| 26 | * makefile.nt (w32faces.obj): Remove. | ||
| 27 | (xfaces.obj): Add. | ||
| 28 | |||
| 1 | 2000-03-03 Jason Rumney <jasonr@gnu.org> | 29 | 2000-03-03 Jason Rumney <jasonr@gnu.org> |
| 2 | 30 | ||
| 3 | * keyboard.c (make_lispy_event): Call buffer_posn_from_coords with | 31 | * keyboard.c (make_lispy_event): Call buffer_posn_from_coords with |
diff --git a/src/xfaces.c b/src/xfaces.c index 3004cfaea02..829fb6e7eda 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -196,6 +196,22 @@ Boston, MA 02111-1307, USA. */ | |||
| 196 | #include "dosfns.h" | 196 | #include "dosfns.h" |
| 197 | #endif | 197 | #endif |
| 198 | 198 | ||
| 199 | #ifdef WINDOWSNT | ||
| 200 | #include "w32term.h" | ||
| 201 | #include "fontset.h" | ||
| 202 | /* Redefine X specifics to W32 equivalents to avoid cluttering the | ||
| 203 | code with #ifdef blocks. */ | ||
| 204 | #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO | ||
| 205 | #define x_display_info w32_display_info | ||
| 206 | #define FRAME_X_FONT_TABLE FRAME_W32_FONT_TABLE | ||
| 207 | #define check_x check_w32 | ||
| 208 | #define x_list_fonts w32_list_fonts | ||
| 209 | #define GCGraphicsExposures 0 | ||
| 210 | /* For historic reasons, FONT_WIDTH refers to average width on W32, | ||
| 211 | not maximum as on X. Redefine here. */ | ||
| 212 | #define FONT_WIDTH FONT_MAX_WIDTH | ||
| 213 | #endif | ||
| 214 | |||
| 199 | #include "buffer.h" | 215 | #include "buffer.h" |
| 200 | #include "dispextern.h" | 216 | #include "dispextern.h" |
| 201 | #include "blockinput.h" | 217 | #include "blockinput.h" |
| @@ -492,7 +508,7 @@ static Lisp_Object xlfd_symbolic_value P_ ((struct table_entry *, int, | |||
| 492 | static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int, | 508 | static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int, |
| 493 | struct font_name *, int)); | 509 | struct font_name *, int)); |
| 494 | 510 | ||
| 495 | #ifdef HAVE_X_WINDOWS | 511 | #ifdef HAVE_WINDOW_SYSTEM |
| 496 | 512 | ||
| 497 | static int split_font_name P_ ((struct frame *, struct font_name *, int)); | 513 | static int split_font_name P_ ((struct frame *, struct font_name *, int)); |
| 498 | static int xlfd_point_size P_ ((struct frame *, struct font_name *)); | 514 | static int xlfd_point_size P_ ((struct frame *, struct font_name *)); |
| @@ -502,7 +518,11 @@ static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *)); | |||
| 502 | static void x_free_gc P_ ((struct frame *, GC)); | 518 | static void x_free_gc P_ ((struct frame *, GC)); |
| 503 | static void clear_font_table P_ ((struct frame *)); | 519 | static void clear_font_table P_ ((struct frame *)); |
| 504 | 520 | ||
| 505 | #endif /* HAVE_X_WINDOWS */ | 521 | #ifdef WINDOWSNT |
| 522 | extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); | ||
| 523 | #endif /* WINDOWSNT */ | ||
| 524 | |||
| 525 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 506 | 526 | ||
| 507 | 527 | ||
| 508 | /*********************************************************************** | 528 | /*********************************************************************** |
| @@ -578,6 +598,38 @@ x_free_gc (f, gc) | |||
| 578 | 598 | ||
| 579 | #endif /* HAVE_X_WINDOWS */ | 599 | #endif /* HAVE_X_WINDOWS */ |
| 580 | 600 | ||
| 601 | #ifdef WINDOWSNT | ||
| 602 | /* W32 emulation of GCs */ | ||
| 603 | |||
| 604 | static INLINE GC | ||
| 605 | x_create_gc (f, mask, xgcv) | ||
| 606 | struct frame *f; | ||
| 607 | unsigned long mask; | ||
| 608 | XGCValues *xgcv; | ||
| 609 | { | ||
| 610 | GC gc; | ||
| 611 | BLOCK_INPUT; | ||
| 612 | gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv); | ||
| 613 | UNBLOCK_INPUT; | ||
| 614 | IF_DEBUG (++ngcs); | ||
| 615 | return gc; | ||
| 616 | } | ||
| 617 | |||
| 618 | |||
| 619 | /* Free GC which was used on frame F. */ | ||
| 620 | |||
| 621 | static INLINE void | ||
| 622 | x_free_gc (f, gc) | ||
| 623 | struct frame *f; | ||
| 624 | GC gc; | ||
| 625 | { | ||
| 626 | BLOCK_INPUT; | ||
| 627 | xassert (--ngcs >= 0); | ||
| 628 | xfree (gc); | ||
| 629 | UNBLOCK_INPUT; | ||
| 630 | } | ||
| 631 | |||
| 632 | #endif /* WINDOWSNT */ | ||
| 581 | 633 | ||
| 582 | /* Like strdup, but uses xmalloc. */ | 634 | /* Like strdup, but uses xmalloc. */ |
| 583 | 635 | ||
| @@ -673,21 +725,24 @@ init_frame_faces (f) | |||
| 673 | if (FRAME_FACE_CACHE (f) == NULL) | 725 | if (FRAME_FACE_CACHE (f) == NULL) |
| 674 | FRAME_FACE_CACHE (f) = make_face_cache (f); | 726 | FRAME_FACE_CACHE (f) = make_face_cache (f); |
| 675 | 727 | ||
| 676 | #ifdef HAVE_X_WINDOWS | 728 | #ifdef HAVE_WINDOW_SYSTEM |
| 677 | /* Make the image cache. */ | 729 | /* Make the image cache. */ |
| 678 | if (FRAME_X_P (f)) | 730 | if (FRAME_WINDOW_P (f)) |
| 679 | { | 731 | { |
| 680 | if (FRAME_X_IMAGE_CACHE (f) == NULL) | 732 | if (FRAME_X_IMAGE_CACHE (f) == NULL) |
| 681 | FRAME_X_IMAGE_CACHE (f) = make_image_cache (); | 733 | FRAME_X_IMAGE_CACHE (f) = make_image_cache (); |
| 682 | ++FRAME_X_IMAGE_CACHE (f)->refcount; | 734 | ++FRAME_X_IMAGE_CACHE (f)->refcount; |
| 683 | } | 735 | } |
| 684 | #endif /* HAVE_X_WINDOWS */ | 736 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 685 | 737 | ||
| 686 | /* Realize basic faces. Must have enough information in frame | 738 | /* Realize basic faces. Must have enough information in frame |
| 687 | parameters to realize basic faces at this point. */ | 739 | parameters to realize basic faces at this point. */ |
| 688 | #ifdef HAVE_X_WINDOWS | 740 | #ifdef HAVE_X_WINDOWS |
| 689 | if (!FRAME_X_P (f) || FRAME_X_WINDOW (f)) | 741 | if (!FRAME_X_P (f) || FRAME_X_WINDOW (f)) |
| 690 | #endif | 742 | #endif |
| 743 | #ifdef WINDOWSNT | ||
| 744 | if (!FRAME_WINDOW_P (f) || FRAME_W32_WINDOW (f)) | ||
| 745 | #endif | ||
| 691 | if (!realize_basic_faces (f)) | 746 | if (!realize_basic_faces (f)) |
| 692 | abort (); | 747 | abort (); |
| 693 | } | 748 | } |
| @@ -707,8 +762,8 @@ free_frame_faces (f) | |||
| 707 | FRAME_FACE_CACHE (f) = NULL; | 762 | FRAME_FACE_CACHE (f) = NULL; |
| 708 | } | 763 | } |
| 709 | 764 | ||
| 710 | #ifdef HAVE_X_WINDOWS | 765 | #ifdef HAVE_WINDOW_SYSTEM |
| 711 | if (FRAME_X_P (f)) | 766 | if (FRAME_WINDOW_P (f)) |
| 712 | { | 767 | { |
| 713 | struct image_cache *image_cache = FRAME_X_IMAGE_CACHE (f); | 768 | struct image_cache *image_cache = FRAME_X_IMAGE_CACHE (f); |
| 714 | if (image_cache) | 769 | if (image_cache) |
| @@ -718,7 +773,7 @@ free_frame_faces (f) | |||
| 718 | free_image_cache (f); | 773 | free_image_cache (f); |
| 719 | } | 774 | } |
| 720 | } | 775 | } |
| 721 | #endif /* HAVE_X_WINDOWS */ | 776 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 722 | } | 777 | } |
| 723 | 778 | ||
| 724 | 779 | ||
| @@ -747,7 +802,7 @@ void | |||
| 747 | clear_face_cache (clear_fonts_p) | 802 | clear_face_cache (clear_fonts_p) |
| 748 | int clear_fonts_p; | 803 | int clear_fonts_p; |
| 749 | { | 804 | { |
| 750 | #ifdef HAVE_X_WINDOWS | 805 | #ifdef HAVE_WINDOW_SYSTEM |
| 751 | Lisp_Object tail, frame; | 806 | Lisp_Object tail, frame; |
| 752 | struct frame *f; | 807 | struct frame *f; |
| 753 | 808 | ||
| @@ -762,7 +817,7 @@ clear_face_cache (clear_fonts_p) | |||
| 762 | FOR_EACH_FRAME (tail, frame) | 817 | FOR_EACH_FRAME (tail, frame) |
| 763 | { | 818 | { |
| 764 | f = XFRAME (frame); | 819 | f = XFRAME (frame); |
| 765 | if (FRAME_X_P (f) | 820 | if (FRAME_WINDOW_P (f) |
| 766 | && FRAME_X_DISPLAY_INFO (f)->n_fonts > CLEAR_FONT_TABLE_NFONTS) | 821 | && FRAME_X_DISPLAY_INFO (f)->n_fonts > CLEAR_FONT_TABLE_NFONTS) |
| 767 | { | 822 | { |
| 768 | free_all_realized_faces (frame); | 823 | free_all_realized_faces (frame); |
| @@ -776,14 +831,14 @@ clear_face_cache (clear_fonts_p) | |||
| 776 | FOR_EACH_FRAME (tail, frame) | 831 | FOR_EACH_FRAME (tail, frame) |
| 777 | { | 832 | { |
| 778 | f = XFRAME (frame); | 833 | f = XFRAME (frame); |
| 779 | if (FRAME_X_P (f)) | 834 | if (FRAME_WINDOW_P (f)) |
| 780 | { | 835 | { |
| 781 | clear_face_gcs (FRAME_FACE_CACHE (f)); | 836 | clear_face_gcs (FRAME_FACE_CACHE (f)); |
| 782 | clear_image_cache (f, 0); | 837 | clear_image_cache (f, 0); |
| 783 | } | 838 | } |
| 784 | } | 839 | } |
| 785 | } | 840 | } |
| 786 | #endif /* HAVE_X_WINDOWS */ | 841 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 787 | } | 842 | } |
| 788 | 843 | ||
| 789 | 844 | ||
| @@ -799,7 +854,7 @@ Optional THOROUGHLY non-nil means try to free unused fonts, too.") | |||
| 799 | 854 | ||
| 800 | 855 | ||
| 801 | 856 | ||
| 802 | #ifdef HAVE_X_WINDOWS | 857 | #ifdef HAVE_WINDOW_SYSTEM |
| 803 | 858 | ||
| 804 | 859 | ||
| 805 | /* Remove those fonts from the font table of frame F that are not used | 860 | /* Remove those fonts from the font table of frame F that are not used |
| @@ -814,7 +869,7 @@ clear_font_table (f) | |||
| 814 | Lisp_Object rest, frame; | 869 | Lisp_Object rest, frame; |
| 815 | int i; | 870 | int i; |
| 816 | 871 | ||
| 817 | xassert (FRAME_X_P (f)); | 872 | xassert (FRAME_WINDOW_P (f)); |
| 818 | 873 | ||
| 819 | used = (char *) alloca (dpyinfo->n_fonts * sizeof *used); | 874 | used = (char *) alloca (dpyinfo->n_fonts * sizeof *used); |
| 820 | bzero (used, dpyinfo->n_fonts * sizeof *used); | 875 | bzero (used, dpyinfo->n_fonts * sizeof *used); |
| @@ -860,7 +915,12 @@ clear_font_table (f) | |||
| 860 | 915 | ||
| 861 | /* Free the font. */ | 916 | /* Free the font. */ |
| 862 | BLOCK_INPUT; | 917 | BLOCK_INPUT; |
| 918 | #ifdef HAVE_X_WINDOWS | ||
| 863 | XFreeFont (dpyinfo->display, font_info->font); | 919 | XFreeFont (dpyinfo->display, font_info->font); |
| 920 | #endif | ||
| 921 | #ifdef WINDOWSNT | ||
| 922 | w32_unload_font (dpyinfo, font_info->font); | ||
| 923 | #endif | ||
| 864 | UNBLOCK_INPUT; | 924 | UNBLOCK_INPUT; |
| 865 | 925 | ||
| 866 | /* Mark font table slot free. */ | 926 | /* Mark font table slot free. */ |
| @@ -870,7 +930,7 @@ clear_font_table (f) | |||
| 870 | } | 930 | } |
| 871 | 931 | ||
| 872 | 932 | ||
| 873 | #endif /* HAVE_X_WINDOWS */ | 933 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 874 | 934 | ||
| 875 | 935 | ||
| 876 | 936 | ||
| @@ -878,7 +938,7 @@ clear_font_table (f) | |||
| 878 | X Pixmaps | 938 | X Pixmaps |
| 879 | ***********************************************************************/ | 939 | ***********************************************************************/ |
| 880 | 940 | ||
| 881 | #ifdef HAVE_X_WINDOWS | 941 | #ifdef HAVE_WINDOW_SYSTEM |
| 882 | 942 | ||
| 883 | DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0, | 943 | DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0, |
| 884 | "Value is non-nil if OBJECT is a valid bitmap specification.\n\ | 944 | "Value is non-nil if OBJECT is a valid bitmap specification.\n\ |
| @@ -1000,7 +1060,7 @@ load_pixmap (f, name, w_ptr, h_ptr) | |||
| 1000 | return bitmap_id; | 1060 | return bitmap_id; |
| 1001 | } | 1061 | } |
| 1002 | 1062 | ||
| 1003 | #endif /* HAVE_X_WINDOWS */ | 1063 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 1004 | 1064 | ||
| 1005 | 1065 | ||
| 1006 | 1066 | ||
| @@ -1008,7 +1068,7 @@ load_pixmap (f, name, w_ptr, h_ptr) | |||
| 1008 | Minimum font bounds | 1068 | Minimum font bounds |
| 1009 | ***********************************************************************/ | 1069 | ***********************************************************************/ |
| 1010 | 1070 | ||
| 1011 | #ifdef HAVE_X_WINDOWS | 1071 | #ifdef HAVE_WINDOW_SYSTEM |
| 1012 | 1072 | ||
| 1013 | /* Update the line_height of frame F. Return non-zero if line height | 1073 | /* Update the line_height of frame F. Return non-zero if line height |
| 1014 | changes. */ | 1074 | changes. */ |
| @@ -1019,25 +1079,25 @@ frame_update_line_height (f) | |||
| 1019 | { | 1079 | { |
| 1020 | int fontset, line_height, changed_p; | 1080 | int fontset, line_height, changed_p; |
| 1021 | 1081 | ||
| 1022 | fontset = f->output_data.x->fontset; | 1082 | fontset = FRAME_FONTSET (f); |
| 1023 | if (fontset > 0) | 1083 | if (fontset > 0) |
| 1024 | line_height = FRAME_FONTSET_DATA (f)->fontset_table[fontset]->height; | 1084 | line_height = FRAME_FONTSET_DATA (f)->fontset_table[fontset]->height; |
| 1025 | else | 1085 | else |
| 1026 | line_height = FONT_HEIGHT (f->output_data.x->font); | 1086 | line_height = FONT_HEIGHT (FRAME_FONT (f)); |
| 1027 | 1087 | ||
| 1028 | changed_p = line_height != f->output_data.x->line_height; | 1088 | changed_p = line_height != FRAME_LINE_HEIGHT (f); |
| 1029 | f->output_data.x->line_height = line_height; | 1089 | FRAME_LINE_HEIGHT (f) = line_height; |
| 1030 | return changed_p; | 1090 | return changed_p; |
| 1031 | } | 1091 | } |
| 1032 | 1092 | ||
| 1033 | #endif /* HAVE_X_WINDOWS */ | 1093 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 1034 | 1094 | ||
| 1035 | 1095 | ||
| 1036 | /*********************************************************************** | 1096 | /*********************************************************************** |
| 1037 | Fonts | 1097 | Fonts |
| 1038 | ***********************************************************************/ | 1098 | ***********************************************************************/ |
| 1039 | 1099 | ||
| 1040 | #ifdef HAVE_X_WINDOWS | 1100 | #ifdef HAVE_WINDOW_SYSTEM |
| 1041 | 1101 | ||
| 1042 | /* Load font or fontset of face FACE which is used on frame F. | 1102 | /* Load font or fontset of face FACE which is used on frame F. |
| 1043 | FONTSET is the fontset FACE should use or -1, if FACE doesn't use a | 1103 | FONTSET is the fontset FACE should use or -1, if FACE doesn't use a |
| @@ -1102,7 +1162,7 @@ load_face_font_or_fontset (f, face, font_name, fontset) | |||
| 1102 | build_string (font_name), Qnil); | 1162 | build_string (font_name), Qnil); |
| 1103 | } | 1163 | } |
| 1104 | 1164 | ||
| 1105 | #endif /* HAVE_X_WINDOWS */ | 1165 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 1106 | 1166 | ||
| 1107 | 1167 | ||
| 1108 | 1168 | ||
| @@ -1187,9 +1247,6 @@ defined_color (f, color_name, color_def, alloc) | |||
| 1187 | #endif | 1247 | #endif |
| 1188 | #ifdef WINDOWSNT | 1248 | #ifdef WINDOWSNT |
| 1189 | else if (FRAME_W32_P (f)) | 1249 | else if (FRAME_W32_P (f)) |
| 1190 | /* FIXME: w32_defined_color doesn't exist! w32fns.c defines | ||
| 1191 | defined_color which needs to be renamed, and the declaration | ||
| 1192 | of color_def therein should be changed. */ | ||
| 1193 | return w32_defined_color (f, color_name, color_def, alloc); | 1250 | return w32_defined_color (f, color_name, color_def, alloc); |
| 1194 | #endif | 1251 | #endif |
| 1195 | #ifdef macintosh | 1252 | #ifdef macintosh |
| @@ -1228,16 +1285,15 @@ tty_color_name (f, idx) | |||
| 1228 | return msdos_stdcolor_name (idx); | 1285 | return msdos_stdcolor_name (idx); |
| 1229 | #endif | 1286 | #endif |
| 1230 | 1287 | ||
| 1231 | #ifdef WINDOWSNT | ||
| 1232 | /* FIXME: When/if w32 supports colors in non-window mode, there should | ||
| 1233 | be a call here to a w32-specific function that returns the color | ||
| 1234 | by index using the default color mapping on a Windows console. */ | ||
| 1235 | #endif | ||
| 1236 | |||
| 1237 | if (idx == FACE_TTY_DEFAULT_FG_COLOR) | 1288 | if (idx == FACE_TTY_DEFAULT_FG_COLOR) |
| 1238 | return build_string (unspecified_fg); | 1289 | return build_string (unspecified_fg); |
| 1239 | if (idx == FACE_TTY_DEFAULT_BG_COLOR) | 1290 | if (idx == FACE_TTY_DEFAULT_BG_COLOR) |
| 1240 | return build_string (unspecified_bg); | 1291 | return build_string (unspecified_bg); |
| 1292 | |||
| 1293 | #ifdef WINDOWSNT | ||
| 1294 | return vga_stdcolor_name (idx); | ||
| 1295 | #endif | ||
| 1296 | |||
| 1241 | return Qunspecified; | 1297 | return Qunspecified; |
| 1242 | } | 1298 | } |
| 1243 | 1299 | ||
| @@ -1403,7 +1459,7 @@ load_color (f, face, name, target_index) | |||
| 1403 | return color.pixel; | 1459 | return color.pixel; |
| 1404 | } | 1460 | } |
| 1405 | 1461 | ||
| 1406 | #ifdef HAVE_X_WINDOWS | 1462 | #ifdef HAVE_WINDOW_SYSTEM |
| 1407 | 1463 | ||
| 1408 | /* Load colors for face FACE which is used on frame F. Colors are | 1464 | /* Load colors for face FACE which is used on frame F. Colors are |
| 1409 | specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX | 1465 | specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX |
| @@ -1454,9 +1510,11 @@ unload_color (f, pixel) | |||
| 1454 | struct frame *f; | 1510 | struct frame *f; |
| 1455 | unsigned long pixel; | 1511 | unsigned long pixel; |
| 1456 | { | 1512 | { |
| 1513 | #ifdef HAVE_X_WINDOWS | ||
| 1457 | BLOCK_INPUT; | 1514 | BLOCK_INPUT; |
| 1458 | x_free_colors (f, &pixel, 1); | 1515 | x_free_colors (f, &pixel, 1); |
| 1459 | UNBLOCK_INPUT; | 1516 | UNBLOCK_INPUT; |
| 1517 | #endif | ||
| 1460 | } | 1518 | } |
| 1461 | 1519 | ||
| 1462 | 1520 | ||
| @@ -1467,6 +1525,7 @@ free_face_colors (f, face) | |||
| 1467 | struct frame *f; | 1525 | struct frame *f; |
| 1468 | struct face *face; | 1526 | struct face *face; |
| 1469 | { | 1527 | { |
| 1528 | #ifdef HAVE_X_WINDOWS | ||
| 1470 | int class = FRAME_X_DISPLAY_INFO (f)->visual->class; | 1529 | int class = FRAME_X_DISPLAY_INFO (f)->visual->class; |
| 1471 | 1530 | ||
| 1472 | /* If display has an immutable color map, freeing colors is not | 1531 | /* If display has an immutable color map, freeing colors is not |
| @@ -1519,8 +1578,9 @@ free_face_colors (f, face) | |||
| 1519 | 1578 | ||
| 1520 | UNBLOCK_INPUT; | 1579 | UNBLOCK_INPUT; |
| 1521 | } | 1580 | } |
| 1522 | } | ||
| 1523 | #endif /* HAVE_X_WINDOWS */ | 1581 | #endif /* HAVE_X_WINDOWS */ |
| 1582 | } | ||
| 1583 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 1524 | 1584 | ||
| 1525 | 1585 | ||
| 1526 | 1586 | ||
| @@ -1909,7 +1969,7 @@ face_numeric_swidth (width) | |||
| 1909 | } | 1969 | } |
| 1910 | 1970 | ||
| 1911 | 1971 | ||
| 1912 | #ifdef HAVE_X_WINDOWS | 1972 | #ifdef HAVE_WINDOW_SYSTEM |
| 1913 | 1973 | ||
| 1914 | /* Return non-zero if FONT is the name of a fixed-pitch font. */ | 1974 | /* Return non-zero if FONT is the name of a fixed-pitch font. */ |
| 1915 | 1975 | ||
| @@ -2103,14 +2163,48 @@ x_face_list_fonts (f, pattern, fonts, nfonts, try_alternatives_p, | |||
| 2103 | int nfonts, try_alternatives_p; | 2163 | int nfonts, try_alternatives_p; |
| 2104 | int scalable_fonts_p; | 2164 | int scalable_fonts_p; |
| 2105 | { | 2165 | { |
| 2106 | Display *dpy = f ? FRAME_X_DISPLAY (f) : x_display_list->display; | ||
| 2107 | int n, i, j; | 2166 | int n, i, j; |
| 2108 | char **names; | 2167 | char **names; |
| 2168 | #ifdef HAVE_X_WINDOWS | ||
| 2169 | Display *dpy = f ? FRAME_X_DISPLAY (f) : x_display_list->display; | ||
| 2109 | 2170 | ||
| 2110 | /* Get the list of fonts matching PATTERN from the X server. */ | 2171 | /* Get the list of fonts matching PATTERN from the X server. */ |
| 2111 | BLOCK_INPUT; | 2172 | BLOCK_INPUT; |
| 2112 | names = XListFonts (dpy, pattern, nfonts, &n); | 2173 | names = XListFonts (dpy, pattern, nfonts, &n); |
| 2113 | UNBLOCK_INPUT; | 2174 | UNBLOCK_INPUT; |
| 2175 | #endif | ||
| 2176 | #ifdef WINDOWSNT | ||
| 2177 | /* NTEMACS_TODO : currently this uses w32_list_fonts, but it may be | ||
| 2178 | better to do it the other way around. */ | ||
| 2179 | Lisp_Object lfonts; | ||
| 2180 | Lisp_Object lpattern, tem; | ||
| 2181 | |||
| 2182 | n = 0; | ||
| 2183 | names = NULL; | ||
| 2184 | |||
| 2185 | lpattern = build_string (pattern); | ||
| 2186 | |||
| 2187 | /* Get the list of fonts matching PATTERN. */ | ||
| 2188 | BLOCK_INPUT; | ||
| 2189 | lfonts = w32_list_fonts (f, lpattern, 0, nfonts); | ||
| 2190 | UNBLOCK_INPUT; | ||
| 2191 | |||
| 2192 | /* Count fonts returned */ | ||
| 2193 | for (tem = lfonts; CONSP (tem); tem = XCDR (tem)) | ||
| 2194 | n++; | ||
| 2195 | |||
| 2196 | /* Allocate array. */ | ||
| 2197 | if (n) | ||
| 2198 | names = (char **) xmalloc (n * sizeof (char *)); | ||
| 2199 | |||
| 2200 | /* Extract font names into char * array. */ | ||
| 2201 | tem = lfonts; | ||
| 2202 | for (i = 0; i < n; i++) | ||
| 2203 | { | ||
| 2204 | names[i] = XSTRING (XCAR (tem))->data; | ||
| 2205 | tem = XCDR (tem); | ||
| 2206 | } | ||
| 2207 | #endif | ||
| 2114 | 2208 | ||
| 2115 | if (names) | 2209 | if (names) |
| 2116 | { | 2210 | { |
| @@ -2143,10 +2237,12 @@ x_face_list_fonts (f, pattern, fonts, nfonts, try_alternatives_p, | |||
| 2143 | 2237 | ||
| 2144 | n = j; | 2238 | n = j; |
| 2145 | 2239 | ||
| 2240 | #ifdef HAVE_X_WINDOWS | ||
| 2146 | /* Free font names. */ | 2241 | /* Free font names. */ |
| 2147 | BLOCK_INPUT; | 2242 | BLOCK_INPUT; |
| 2148 | XFreeFontNames (names); | 2243 | XFreeFontNames (names); |
| 2149 | UNBLOCK_INPUT; | 2244 | UNBLOCK_INPUT; |
| 2245 | #endif | ||
| 2150 | } | 2246 | } |
| 2151 | 2247 | ||
| 2152 | 2248 | ||
| @@ -2522,7 +2618,7 @@ the WIDTH times as wide as FACE on FRAME.") | |||
| 2522 | /* We can't simply call check_x_frame because this function may be | 2618 | /* We can't simply call check_x_frame because this function may be |
| 2523 | called before any frame is created. */ | 2619 | called before any frame is created. */ |
| 2524 | f = frame_or_selected_frame (frame, 2); | 2620 | f = frame_or_selected_frame (frame, 2); |
| 2525 | if (!FRAME_X_P (f)) | 2621 | if (!FRAME_WINDOW_P (f)) |
| 2526 | { | 2622 | { |
| 2527 | /* Perhaps we have not yet created any frame. */ | 2623 | /* Perhaps we have not yet created any frame. */ |
| 2528 | f = NULL; | 2624 | f = NULL; |
| @@ -2541,9 +2637,9 @@ the WIDTH times as wide as FACE on FRAME.") | |||
| 2541 | struct face *face = FACE_FROM_ID (f, face_id); | 2637 | struct face *face = FACE_FROM_ID (f, face_id); |
| 2542 | 2638 | ||
| 2543 | if (face->font) | 2639 | if (face->font) |
| 2544 | size = face->font->max_bounds.width; | 2640 | size = FONT_WIDTH (face->font); |
| 2545 | else | 2641 | else |
| 2546 | size = FRAME_FONT (f)->max_bounds.width; | 2642 | size = FONT_WIDTH (FRAME_FONT (f)); |
| 2547 | 2643 | ||
| 2548 | if (!NILP (width)) | 2644 | if (!NILP (width)) |
| 2549 | size *= XINT (width); | 2645 | size *= XINT (width); |
| @@ -2561,7 +2657,7 @@ the WIDTH times as wide as FACE on FRAME.") | |||
| 2561 | } | 2657 | } |
| 2562 | } | 2658 | } |
| 2563 | 2659 | ||
| 2564 | #endif /* HAVE_X_WINDOWS */ | 2660 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 2565 | 2661 | ||
| 2566 | 2662 | ||
| 2567 | 2663 | ||
| @@ -2780,8 +2876,7 @@ lface_fully_specified_p (attrs) | |||
| 2780 | return i == LFACE_VECTOR_SIZE; | 2876 | return i == LFACE_VECTOR_SIZE; |
| 2781 | } | 2877 | } |
| 2782 | 2878 | ||
| 2783 | 2879 | #ifdef HAVE_WINDOW_SYSTEM | |
| 2784 | #ifdef HAVE_X_WINDOWS | ||
| 2785 | 2880 | ||
| 2786 | /* Set font-related attributes of Lisp face LFACE from XLFD font name | 2881 | /* Set font-related attributes of Lisp face LFACE from XLFD font name |
| 2787 | FONT_NAME. If FORCE_P is zero, set only unspecified attributes of | 2882 | FONT_NAME. If FORCE_P is zero, set only unspecified attributes of |
| @@ -2843,6 +2938,7 @@ set_lface_from_font_name (f, lface, font_name, force_p, may_fail_p) | |||
| 2843 | { | 2938 | { |
| 2844 | if (may_fail_p) | 2939 | if (may_fail_p) |
| 2845 | return 0; | 2940 | return 0; |
| 2941 | #ifdef HAVE_X_WINDOWS | ||
| 2846 | else if (first_font_matching (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1", | 2942 | else if (first_font_matching (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1", |
| 2847 | &font) | 2943 | &font) |
| 2848 | || first_font_matching (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1", | 2944 | || first_font_matching (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1", |
| @@ -2854,6 +2950,19 @@ set_lface_from_font_name (f, lface, font_name, force_p, may_fail_p) | |||
| 2854 | || first_font_matching (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1", | 2950 | || first_font_matching (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1", |
| 2855 | &font) | 2951 | &font) |
| 2856 | || first_font_matching (f, "fixed", &font)) | 2952 | || first_font_matching (f, "fixed", &font)) |
| 2953 | #endif | ||
| 2954 | #ifdef WINDOWSNT | ||
| 2955 | else if (first_font_matching (f, "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1", | ||
| 2956 | &font) | ||
| 2957 | || first_font_matching (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1", | ||
| 2958 | &font) | ||
| 2959 | || first_font_matching (f, "-*-FixedSys-normal-r-*-*-12-*-*-*-c-*-iso8859-1", | ||
| 2960 | &font) | ||
| 2961 | || first_font_matching (f, "-*-*-normal-r-*-*-*-*-*-*-c-*-iso8859-1", | ||
| 2962 | &font) | ||
| 2963 | || first_font_matching (f, "FixedSys", | ||
| 2964 | &font)) | ||
| 2965 | #endif | ||
| 2857 | free_font_name_p = 1; | 2966 | free_font_name_p = 1; |
| 2858 | else | 2967 | else |
| 2859 | abort (); | 2968 | abort (); |
| @@ -2894,8 +3003,7 @@ set_lface_from_font_name (f, lface, font_name, force_p, may_fail_p) | |||
| 2894 | 3003 | ||
| 2895 | return 1; | 3004 | return 1; |
| 2896 | } | 3005 | } |
| 2897 | 3006 | #endif /* HAVE_WINDOW_SYSTEM */ | |
| 2898 | #endif /* HAVE_X_WINDOWS */ | ||
| 2899 | 3007 | ||
| 2900 | 3008 | ||
| 2901 | /* Merge two Lisp face attribute vectors FROM and TO and store the | 3009 | /* Merge two Lisp face attribute vectors FROM and TO and store the |
| @@ -3505,7 +3613,7 @@ frame.") | |||
| 3505 | } | 3613 | } |
| 3506 | else if (EQ (attr, QCfont)) | 3614 | else if (EQ (attr, QCfont)) |
| 3507 | { | 3615 | { |
| 3508 | #ifdef HAVE_X_WINDOWS | 3616 | #ifdef HAVE_WINDOW_SYSTEM |
| 3509 | /* Set font-related attributes of the Lisp face from an | 3617 | /* Set font-related attributes of the Lisp face from an |
| 3510 | XLFD font name. */ | 3618 | XLFD font name. */ |
| 3511 | struct frame *f; | 3619 | struct frame *f; |
| @@ -3520,7 +3628,7 @@ frame.") | |||
| 3520 | signal_error ("Invalid font name", value); | 3628 | signal_error ("Invalid font name", value); |
| 3521 | 3629 | ||
| 3522 | font_related_attr_p = 1; | 3630 | font_related_attr_p = 1; |
| 3523 | #endif /* HAVE_X_WINDOWS */ | 3631 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3524 | } | 3632 | } |
| 3525 | else if (EQ (attr, QCbold)) | 3633 | else if (EQ (attr, QCbold)) |
| 3526 | { | 3634 | { |
| @@ -3550,7 +3658,7 @@ frame.") | |||
| 3550 | ++windows_or_buffers_changed; | 3658 | ++windows_or_buffers_changed; |
| 3551 | } | 3659 | } |
| 3552 | 3660 | ||
| 3553 | #ifdef HAVE_X_WINDOWS | 3661 | #ifdef HAVE_WINDOW_SYSTEM |
| 3554 | 3662 | ||
| 3555 | if (!EQ (frame, Qt) | 3663 | if (!EQ (frame, Qt) |
| 3556 | && !UNSPECIFIEDP (value) | 3664 | && !UNSPECIFIEDP (value) |
| @@ -3572,6 +3680,7 @@ frame.") | |||
| 3572 | else if (EQ (attr, QCbackground)) | 3680 | else if (EQ (attr, QCbackground)) |
| 3573 | param = Qbackground_color; | 3681 | param = Qbackground_color; |
| 3574 | } | 3682 | } |
| 3683 | #ifndef WINDOWSNT | ||
| 3575 | else if (EQ (face, Qscroll_bar)) | 3684 | else if (EQ (face, Qscroll_bar)) |
| 3576 | { | 3685 | { |
| 3577 | /* Changing the colors of `scroll-bar' sets frame parameters | 3686 | /* Changing the colors of `scroll-bar' sets frame parameters |
| @@ -3581,6 +3690,7 @@ frame.") | |||
| 3581 | else if (EQ (attr, QCbackground)) | 3690 | else if (EQ (attr, QCbackground)) |
| 3582 | param = Qscroll_bar_background; | 3691 | param = Qscroll_bar_background; |
| 3583 | } | 3692 | } |
| 3693 | #endif | ||
| 3584 | else if (EQ (face, Qborder)) | 3694 | else if (EQ (face, Qborder)) |
| 3585 | { | 3695 | { |
| 3586 | /* Changing background color of `border' sets frame parameter | 3696 | /* Changing background color of `border' sets frame parameter |
| @@ -3607,13 +3717,13 @@ frame.") | |||
| 3607 | Fmodify_frame_parameters (frame, Fcons (Fcons (param, value), Qnil)); | 3717 | Fmodify_frame_parameters (frame, Fcons (Fcons (param, value), Qnil)); |
| 3608 | } | 3718 | } |
| 3609 | 3719 | ||
| 3610 | #endif /* HAVE_X_WINDOWS */ | 3720 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3611 | 3721 | ||
| 3612 | return face; | 3722 | return face; |
| 3613 | } | 3723 | } |
| 3614 | 3724 | ||
| 3615 | 3725 | ||
| 3616 | #ifdef HAVE_X_WINDOWS | 3726 | #ifdef HAVE_WINDOW_SYSTEM |
| 3617 | 3727 | ||
| 3618 | /* Set the `font' frame parameter of FRAME according to `default' face | 3728 | /* Set the `font' frame parameter of FRAME according to `default' face |
| 3619 | attributes LFACE. */ | 3729 | attributes LFACE. */ |
| @@ -3735,7 +3845,8 @@ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource, | |||
| 3735 | (resource, class, frame) | 3845 | (resource, class, frame) |
| 3736 | Lisp_Object resource, class, frame; | 3846 | Lisp_Object resource, class, frame; |
| 3737 | { | 3847 | { |
| 3738 | Lisp_Object value; | 3848 | Lisp_Object value = Qnil; |
| 3849 | #ifndef WINDOWSNT | ||
| 3739 | CHECK_STRING (resource, 0); | 3850 | CHECK_STRING (resource, 0); |
| 3740 | CHECK_STRING (class, 1); | 3851 | CHECK_STRING (class, 1); |
| 3741 | CHECK_LIVE_FRAME (frame, 2); | 3852 | CHECK_LIVE_FRAME (frame, 2); |
| @@ -3743,6 +3854,7 @@ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource, | |||
| 3743 | value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)), | 3854 | value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)), |
| 3744 | resource, class, Qnil, Qnil); | 3855 | resource, class, Qnil, Qnil); |
| 3745 | UNBLOCK_INPUT; | 3856 | UNBLOCK_INPUT; |
| 3857 | #endif | ||
| 3746 | return value; | 3858 | return value; |
| 3747 | } | 3859 | } |
| 3748 | 3860 | ||
| @@ -3818,8 +3930,10 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", | |||
| 3818 | return Finternal_set_lisp_face_attribute (face, attr, value, frame); | 3930 | return Finternal_set_lisp_face_attribute (face, attr, value, frame); |
| 3819 | } | 3931 | } |
| 3820 | 3932 | ||
| 3933 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3821 | 3934 | ||
| 3822 | 3935 | ||
| 3936 | #ifdef HAVE_X_WINDOWS | ||
| 3823 | /*********************************************************************** | 3937 | /*********************************************************************** |
| 3824 | Menu face | 3938 | Menu face |
| 3825 | ***********************************************************************/ | 3939 | ***********************************************************************/ |
| @@ -4412,8 +4526,8 @@ free_realized_face (f, face) | |||
| 4412 | { | 4526 | { |
| 4413 | if (face) | 4527 | if (face) |
| 4414 | { | 4528 | { |
| 4415 | #ifdef HAVE_X_WINDOWS | 4529 | #ifdef HAVE_WINDOW_SYSTEM |
| 4416 | if (FRAME_X_P (f)) | 4530 | if (FRAME_WINDOW_P (f)) |
| 4417 | { | 4531 | { |
| 4418 | if (face->gc) | 4532 | if (face->gc) |
| 4419 | { | 4533 | { |
| @@ -4424,7 +4538,7 @@ free_realized_face (f, face) | |||
| 4424 | free_face_colors (f, face); | 4538 | free_face_colors (f, face); |
| 4425 | x_destroy_bitmap (f, face->stipple); | 4539 | x_destroy_bitmap (f, face->stipple); |
| 4426 | } | 4540 | } |
| 4427 | #endif /* HAVE_X_WINDOWS */ | 4541 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 4428 | 4542 | ||
| 4429 | xfree (face); | 4543 | xfree (face); |
| 4430 | } | 4544 | } |
| @@ -4440,8 +4554,8 @@ prepare_face_for_display (f, face) | |||
| 4440 | struct frame *f; | 4554 | struct frame *f; |
| 4441 | struct face *face; | 4555 | struct face *face; |
| 4442 | { | 4556 | { |
| 4443 | #ifdef HAVE_X_WINDOWS | 4557 | #ifdef HAVE_WINDOW_SYSTEM |
| 4444 | xassert (FRAME_X_P (f)); | 4558 | xassert (FRAME_WINDOW_P (f)); |
| 4445 | 4559 | ||
| 4446 | if (face->gc == 0) | 4560 | if (face->gc == 0) |
| 4447 | { | 4561 | { |
| @@ -4450,27 +4564,34 @@ prepare_face_for_display (f, face) | |||
| 4450 | 4564 | ||
| 4451 | xgcv.foreground = face->foreground; | 4565 | xgcv.foreground = face->foreground; |
| 4452 | xgcv.background = face->background; | 4566 | xgcv.background = face->background; |
| 4567 | #ifdef HAVE_X_WINDOWS | ||
| 4453 | xgcv.graphics_exposures = False; | 4568 | xgcv.graphics_exposures = False; |
| 4454 | 4569 | #endif | |
| 4455 | /* The font of FACE may be null if we couldn't load it. */ | 4570 | /* The font of FACE may be null if we couldn't load it. */ |
| 4456 | if (face->font) | 4571 | if (face->font) |
| 4457 | { | 4572 | { |
| 4573 | #ifdef HAVE_X_WINDOWS | ||
| 4458 | xgcv.font = face->font->fid; | 4574 | xgcv.font = face->font->fid; |
| 4575 | #endif | ||
| 4576 | #ifdef WINDOWSNT | ||
| 4577 | xgcv.font = face->font; | ||
| 4578 | #endif | ||
| 4459 | mask |= GCFont; | 4579 | mask |= GCFont; |
| 4460 | } | 4580 | } |
| 4461 | 4581 | ||
| 4462 | BLOCK_INPUT; | 4582 | BLOCK_INPUT; |
| 4583 | #ifdef HAVE_X_WINDOWS | ||
| 4463 | if (face->stipple) | 4584 | if (face->stipple) |
| 4464 | { | 4585 | { |
| 4465 | xgcv.fill_style = FillOpaqueStippled; | 4586 | xgcv.fill_style = FillOpaqueStippled; |
| 4466 | xgcv.stipple = x_bitmap_pixmap (f, face->stipple); | 4587 | xgcv.stipple = x_bitmap_pixmap (f, face->stipple); |
| 4467 | mask |= GCFillStyle | GCStipple; | 4588 | mask |= GCFillStyle | GCStipple; |
| 4468 | } | 4589 | } |
| 4469 | 4590 | #endif | |
| 4470 | face->gc = x_create_gc (f, mask, &xgcv); | 4591 | face->gc = x_create_gc (f, mask, &xgcv); |
| 4471 | UNBLOCK_INPUT; | 4592 | UNBLOCK_INPUT; |
| 4472 | } | 4593 | } |
| 4473 | #endif | 4594 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 4474 | } | 4595 | } |
| 4475 | 4596 | ||
| 4476 | 4597 | ||
| @@ -4550,9 +4671,9 @@ static void | |||
| 4550 | clear_face_gcs (c) | 4671 | clear_face_gcs (c) |
| 4551 | struct face_cache *c; | 4672 | struct face_cache *c; |
| 4552 | { | 4673 | { |
| 4553 | if (c && FRAME_X_P (c->f)) | 4674 | if (c && FRAME_WINDOW_P (c->f)) |
| 4554 | { | 4675 | { |
| 4555 | #ifdef HAVE_X_WINDOWS | 4676 | #ifdef HAVE_WINDOW_SYSTEM |
| 4556 | int i; | 4677 | int i; |
| 4557 | for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i) | 4678 | for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i) |
| 4558 | { | 4679 | { |
| @@ -4563,7 +4684,7 @@ clear_face_gcs (c) | |||
| 4563 | face->gc = 0; | 4684 | face->gc = 0; |
| 4564 | } | 4685 | } |
| 4565 | } | 4686 | } |
| 4566 | #endif /* HAVE_X_WINDOWS */ | 4687 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 4567 | } | 4688 | } |
| 4568 | } | 4689 | } |
| 4569 | 4690 | ||
| @@ -4783,7 +4904,7 @@ lookup_face (f, attr, charset) | |||
| 4783 | 4904 | ||
| 4784 | #if GLYPH_DEBUG | 4905 | #if GLYPH_DEBUG |
| 4785 | xassert (face == FACE_FROM_ID (f, face->id)); | 4906 | xassert (face == FACE_FROM_ID (f, face->id)); |
| 4786 | if (FRAME_X_P (f)) | 4907 | if (FRAME_WINDOW_P (f)) |
| 4787 | xassert (charset < 0 || FACE_SUITABLE_FOR_CHARSET_P (face, charset)); | 4908 | xassert (charset < 0 || FACE_SUITABLE_FOR_CHARSET_P (face, charset)); |
| 4788 | #endif /* GLYPH_DEBUG */ | 4909 | #endif /* GLYPH_DEBUG */ |
| 4789 | 4910 | ||
| @@ -4843,7 +4964,7 @@ smaller_face (f, face_id, steps) | |||
| 4843 | struct frame *f; | 4964 | struct frame *f; |
| 4844 | int face_id, steps; | 4965 | int face_id, steps; |
| 4845 | { | 4966 | { |
| 4846 | #ifdef HAVE_X_WINDOWS | 4967 | #ifdef HAVE_WINDOW_SYSTEM |
| 4847 | struct face *face; | 4968 | struct face *face; |
| 4848 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | 4969 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
| 4849 | int pt, last_pt, last_height; | 4970 | int pt, last_pt, last_height; |
| @@ -4887,11 +5008,11 @@ smaller_face (f, face_id, steps) | |||
| 4887 | 5008 | ||
| 4888 | return new_face_id; | 5009 | return new_face_id; |
| 4889 | 5010 | ||
| 4890 | #else /* not HAVE_X_WINDOWS */ | 5011 | #else /* not HAVE_WINDOW_SYSTEM */ |
| 4891 | 5012 | ||
| 4892 | return face_id; | 5013 | return face_id; |
| 4893 | 5014 | ||
| 4894 | #endif /* not HAVE_X_WINDOWS */ | 5015 | #endif /* not HAVE_WINDOW_SYSTEM */ |
| 4895 | } | 5016 | } |
| 4896 | 5017 | ||
| 4897 | 5018 | ||
| @@ -4904,7 +5025,7 @@ face_with_height (f, face_id, height) | |||
| 4904 | int face_id; | 5025 | int face_id; |
| 4905 | int height; | 5026 | int height; |
| 4906 | { | 5027 | { |
| 4907 | #ifdef HAVE_X_WINDOWS | 5028 | #ifdef HAVE_WINDOW_SYSTEM |
| 4908 | struct face *face; | 5029 | struct face *face; |
| 4909 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | 5030 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
| 4910 | 5031 | ||
| @@ -4916,7 +5037,7 @@ face_with_height (f, face_id, height) | |||
| 4916 | bcopy (face->lface, attrs, sizeof attrs); | 5037 | bcopy (face->lface, attrs, sizeof attrs); |
| 4917 | attrs[LFACE_HEIGHT_INDEX] = make_number (height); | 5038 | attrs[LFACE_HEIGHT_INDEX] = make_number (height); |
| 4918 | face_id = lookup_face (f, attrs, CHARSET_ASCII); | 5039 | face_id = lookup_face (f, attrs, CHARSET_ASCII); |
| 4919 | #endif /* HAVE_X_WINDOWS */ | 5040 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 4920 | 5041 | ||
| 4921 | return face_id; | 5042 | return face_id; |
| 4922 | } | 5043 | } |
| @@ -5034,7 +5155,7 @@ be found. Value is ALIST.") | |||
| 5034 | } | 5155 | } |
| 5035 | 5156 | ||
| 5036 | 5157 | ||
| 5037 | #ifdef HAVE_X_WINDOWS | 5158 | #ifdef HAVE_WINDOW_SYSTEM |
| 5038 | 5159 | ||
| 5039 | /* Return the X registry and encoding of font name FONT_NAME on frame F. | 5160 | /* Return the X registry and encoding of font name FONT_NAME on frame F. |
| 5040 | Value is nil if not successful. */ | 5161 | Value is nil if not successful. */ |
| @@ -5077,7 +5198,14 @@ font_scalable_p (font) | |||
| 5077 | struct font_name *font; | 5198 | struct font_name *font; |
| 5078 | { | 5199 | { |
| 5079 | char *s = font->fields[XLFD_AVGWIDTH]; | 5200 | char *s = font->fields[XLFD_AVGWIDTH]; |
| 5080 | return *s == '0' && *(s + 1) == '\0'; | 5201 | return (*s == '0' && *(s + 1) == '\0') |
| 5202 | #ifdef WINDOWSNT | ||
| 5203 | /* Windows implementation of XLFD is slightly broken for backward | ||
| 5204 | compatibility with previous broken versions, so test for | ||
| 5205 | wildcards as well as 0. */ | ||
| 5206 | || *s == '*' | ||
| 5207 | #endif | ||
| 5208 | ; | ||
| 5081 | } | 5209 | } |
| 5082 | 5210 | ||
| 5083 | 5211 | ||
| @@ -5552,7 +5680,7 @@ choose_face_fontset_font (f, attrs, fontset, charset) | |||
| 5552 | return font_name; | 5680 | return font_name; |
| 5553 | } | 5681 | } |
| 5554 | 5682 | ||
| 5555 | #endif /* HAVE_X_WINDOWS */ | 5683 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 5556 | 5684 | ||
| 5557 | 5685 | ||
| 5558 | 5686 | ||
| @@ -5613,8 +5741,8 @@ realize_default_face (f) | |||
| 5613 | lface = Finternal_make_lisp_face (Qdefault, frame); | 5741 | lface = Finternal_make_lisp_face (Qdefault, frame); |
| 5614 | } | 5742 | } |
| 5615 | 5743 | ||
| 5616 | #ifdef HAVE_X_WINDOWS | 5744 | #ifdef HAVE_WINDOW_SYSTEM |
| 5617 | if (FRAME_X_P (f)) | 5745 | if (FRAME_WINDOW_P (f)) |
| 5618 | { | 5746 | { |
| 5619 | /* Set frame_font to the value of the `font' frame parameter. */ | 5747 | /* Set frame_font to the value of the `font' frame parameter. */ |
| 5620 | frame_font = Fassq (Qfont, f->param_alist); | 5748 | frame_font = Fassq (Qfont, f->param_alist); |
| @@ -5677,7 +5805,7 @@ realize_default_face (f) | |||
| 5677 | Vface_default_registry = build_string ("iso8859-1"); | 5805 | Vface_default_registry = build_string ("iso8859-1"); |
| 5678 | } | 5806 | } |
| 5679 | } | 5807 | } |
| 5680 | #endif /* HAVE_X_WINDOWS */ | 5808 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 5681 | 5809 | ||
| 5682 | if (!FRAME_WINDOW_P (f)) | 5810 | if (!FRAME_WINDOW_P (f)) |
| 5683 | { | 5811 | { |
| @@ -5711,7 +5839,7 @@ realize_default_face (f) | |||
| 5711 | 5839 | ||
| 5712 | if (CONSP (color) && STRINGP (XCDR (color))) | 5840 | if (CONSP (color) && STRINGP (XCDR (color))) |
| 5713 | LFACE_FOREGROUND (lface) = XCDR (color); | 5841 | LFACE_FOREGROUND (lface) = XCDR (color); |
| 5714 | else if (FRAME_X_P (f)) | 5842 | else if (FRAME_WINDOW_P (f)) |
| 5715 | return 0; | 5843 | return 0; |
| 5716 | else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) | 5844 | else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
| 5717 | LFACE_FOREGROUND (lface) = build_string (unspecified_fg); | 5845 | LFACE_FOREGROUND (lface) = build_string (unspecified_fg); |
| @@ -5726,7 +5854,7 @@ realize_default_face (f) | |||
| 5726 | Lisp_Object color = Fassq (Qbackground_color, f->param_alist); | 5854 | Lisp_Object color = Fassq (Qbackground_color, f->param_alist); |
| 5727 | if (CONSP (color) && STRINGP (XCDR (color))) | 5855 | if (CONSP (color) && STRINGP (XCDR (color))) |
| 5728 | LFACE_BACKGROUND (lface) = XCDR (color); | 5856 | LFACE_BACKGROUND (lface) = XCDR (color); |
| 5729 | else if (FRAME_X_P (f)) | 5857 | else if (FRAME_WINDOW_P (f)) |
| 5730 | return 0; | 5858 | return 0; |
| 5731 | else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) | 5859 | else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
| 5732 | LFACE_BACKGROUND (lface) = build_string (unspecified_bg); | 5860 | LFACE_BACKGROUND (lface) = build_string (unspecified_bg); |
| @@ -5824,7 +5952,7 @@ realize_face (c, attrs, charset) | |||
| 5824 | xassert (c != NULL); | 5952 | xassert (c != NULL); |
| 5825 | check_lface_attrs (attrs); | 5953 | check_lface_attrs (attrs); |
| 5826 | 5954 | ||
| 5827 | if (FRAME_X_P (c->f)) | 5955 | if (FRAME_WINDOW_P (c->f)) |
| 5828 | face = realize_x_face (c, attrs, charset); | 5956 | face = realize_x_face (c, attrs, charset); |
| 5829 | else if (FRAME_TERMCAP_P (c->f) || FRAME_MSDOS_P (c->f)) | 5957 | else if (FRAME_TERMCAP_P (c->f) || FRAME_MSDOS_P (c->f)) |
| 5830 | face = realize_tty_face (c, attrs, charset); | 5958 | face = realize_tty_face (c, attrs, charset); |
| @@ -5846,14 +5974,14 @@ realize_x_face (c, attrs, charset) | |||
| 5846 | Lisp_Object *attrs; | 5974 | Lisp_Object *attrs; |
| 5847 | int charset; | 5975 | int charset; |
| 5848 | { | 5976 | { |
| 5849 | #ifdef HAVE_X_WINDOWS | 5977 | #ifdef HAVE_WINDOW_SYSTEM |
| 5850 | struct face *face, *default_face; | 5978 | struct face *face, *default_face; |
| 5851 | struct frame *f; | 5979 | struct frame *f; |
| 5852 | Lisp_Object stipple, overline, strike_through, box; | 5980 | Lisp_Object stipple, overline, strike_through, box; |
| 5853 | Lisp_Object unibyte_registry; | 5981 | Lisp_Object unibyte_registry; |
| 5854 | struct gcpro gcpro1; | 5982 | struct gcpro gcpro1; |
| 5855 | 5983 | ||
| 5856 | xassert (FRAME_X_P (c->f)); | 5984 | xassert (FRAME_WINDOW_P (c->f)); |
| 5857 | 5985 | ||
| 5858 | /* If realizing a face for use in unibyte text, get the X registry | 5986 | /* If realizing a face for use in unibyte text, get the X registry |
| 5859 | and encoding to use from Vface_default_registry. */ | 5987 | and encoding to use from Vface_default_registry. */ |
| @@ -6059,7 +6187,7 @@ realize_x_face (c, attrs, charset) | |||
| 6059 | xassert (face->fontset < 0); | 6187 | xassert (face->fontset < 0); |
| 6060 | xassert (FACE_SUITABLE_FOR_CHARSET_P (face, charset)); | 6188 | xassert (FACE_SUITABLE_FOR_CHARSET_P (face, charset)); |
| 6061 | return face; | 6189 | return face; |
| 6062 | #endif /* HAVE_X_WINDOWS */ | 6190 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 6063 | } | 6191 | } |
| 6064 | 6192 | ||
| 6065 | 6193 | ||
| @@ -6126,28 +6254,34 @@ realize_tty_face (c, attrs, charset) | |||
| 6126 | face->foreground = load_color (c->f, face, | 6254 | face->foreground = load_color (c->f, face, |
| 6127 | attrs[LFACE_FOREGROUND_INDEX], | 6255 | attrs[LFACE_FOREGROUND_INDEX], |
| 6128 | LFACE_FOREGROUND_INDEX); | 6256 | LFACE_FOREGROUND_INDEX); |
| 6129 | #ifdef MSDOS | 6257 | |
| 6258 | #if defined (MSDOS) || defined (WINDOWSNT) | ||
| 6130 | /* If the foreground of the default face is the default color, | 6259 | /* If the foreground of the default face is the default color, |
| 6131 | use the foreground color defined by the frame. */ | 6260 | use the foreground color defined by the frame. */ |
| 6261 | #ifdef MSDOS | ||
| 6132 | if (FRAME_MSDOS_P (c->f)) | 6262 | if (FRAME_MSDOS_P (c->f)) |
| 6133 | { | 6263 | { |
| 6264 | #endif /* MSDOS */ | ||
| 6265 | |||
| 6134 | if (face->foreground == FACE_TTY_DEFAULT_FG_COLOR | 6266 | if (face->foreground == FACE_TTY_DEFAULT_FG_COLOR |
| 6135 | || face->foreground == FACE_TTY_DEFAULT_COLOR) | 6267 | || face->foreground == FACE_TTY_DEFAULT_COLOR) |
| 6136 | { | 6268 | { |
| 6137 | face->foreground = FRAME_FOREGROUND_PIXEL (f); | 6269 | face->foreground = FRAME_FOREGROUND_PIXEL (c->f); |
| 6138 | attrs[LFACE_FOREGROUND_INDEX] = | 6270 | attrs[LFACE_FOREGROUND_INDEX] = |
| 6139 | msdos_stdcolor_name (face->foreground); | 6271 | tty_color_name (c->f, face->foreground); |
| 6140 | face_colors_defaulted = 1; | 6272 | face_colors_defaulted = 1; |
| 6141 | } | 6273 | } |
| 6142 | else if (face->foreground == FACE_TTY_DEFAULT_BG_COLOR) | 6274 | else if (face->foreground == FACE_TTY_DEFAULT_BG_COLOR) |
| 6143 | { | 6275 | { |
| 6144 | face->foreground = FRAME_BACKGROUND_PIXEL (f); | 6276 | face->foreground = FRAME_BACKGROUND_PIXEL (c->f); |
| 6145 | attrs[LFACE_FOREGROUND_INDEX] = | 6277 | attrs[LFACE_FOREGROUND_INDEX] = |
| 6146 | msdos_stdcolor_name (face->foreground); | 6278 | tty_color_name (c->f, face->foreground); |
| 6147 | face_colors_defaulted = 1; | 6279 | face_colors_defaulted = 1; |
| 6148 | } | 6280 | } |
| 6281 | #ifdef MSDOS | ||
| 6149 | } | 6282 | } |
| 6150 | #endif | 6283 | #endif |
| 6284 | #endif /* MSDOS or WINDOWSNT */ | ||
| 6151 | } | 6285 | } |
| 6152 | 6286 | ||
| 6153 | color = attrs[LFACE_BACKGROUND_INDEX]; | 6287 | color = attrs[LFACE_BACKGROUND_INDEX]; |
| @@ -6166,28 +6300,33 @@ realize_tty_face (c, attrs, charset) | |||
| 6166 | face->background = load_color (c->f, face, | 6300 | face->background = load_color (c->f, face, |
| 6167 | attrs[LFACE_BACKGROUND_INDEX], | 6301 | attrs[LFACE_BACKGROUND_INDEX], |
| 6168 | LFACE_BACKGROUND_INDEX); | 6302 | LFACE_BACKGROUND_INDEX); |
| 6169 | #ifdef MSDOS | 6303 | #if defined (MSDOS) || defined (WINDOWSNT) |
| 6170 | /* If the background of the default face is the default color, | 6304 | /* If the background of the default face is the default color, |
| 6171 | use the background color defined by the frame. */ | 6305 | use the background color defined by the frame. */ |
| 6306 | #ifdef MSDOS | ||
| 6172 | if (FRAME_MSDOS_P (c->f)) | 6307 | if (FRAME_MSDOS_P (c->f)) |
| 6173 | { | 6308 | { |
| 6309 | #endif /* MSDOS */ | ||
| 6310 | |||
| 6174 | if (face->background == FACE_TTY_DEFAULT_BG_COLOR | 6311 | if (face->background == FACE_TTY_DEFAULT_BG_COLOR |
| 6175 | || face->background == FACE_TTY_DEFAULT_COLOR) | 6312 | || face->background == FACE_TTY_DEFAULT_COLOR) |
| 6176 | { | 6313 | { |
| 6177 | face->background = FRAME_BACKGROUND_PIXEL (f); | 6314 | face->background = FRAME_BACKGROUND_PIXEL (c->f); |
| 6178 | attrs[LFACE_BACKGROUND_INDEX] = | 6315 | attrs[LFACE_BACKGROUND_INDEX] = |
| 6179 | msdos_stdcolor_name (face->background); | 6316 | tty_color_name (c->f, face->background); |
| 6180 | face_colors_defaulted = 1; | 6317 | face_colors_defaulted = 1; |
| 6181 | } | 6318 | } |
| 6182 | else if (face->background == FACE_TTY_DEFAULT_FG_COLOR) | 6319 | else if (face->background == FACE_TTY_DEFAULT_FG_COLOR) |
| 6183 | { | 6320 | { |
| 6184 | face->background = FRAME_FOREGROUND_PIXEL (f); | 6321 | face->background = FRAME_FOREGROUND_PIXEL (c->f); |
| 6185 | attrs[LFACE_BACKGROUND_INDEX] = | 6322 | attrs[LFACE_BACKGROUND_INDEX] = |
| 6186 | msdos_stdcolor_name (face->background); | 6323 | tty_color_name (c->f, face->background); |
| 6187 | face_colors_defaulted = 1; | 6324 | face_colors_defaulted = 1; |
| 6188 | } | 6325 | } |
| 6326 | #ifdef MSDOS | ||
| 6189 | } | 6327 | } |
| 6190 | #endif | 6328 | #endif |
| 6329 | #endif /* MSDOS or WINDOWSNT */ | ||
| 6191 | } | 6330 | } |
| 6192 | 6331 | ||
| 6193 | /* Swap colors if face is inverse-video. If the colors are taken | 6332 | /* Swap colors if face is inverse-video. If the colors are taken |
| @@ -6702,7 +6841,7 @@ syms_of_xfaces () | |||
| 6702 | defsubr (&Sinternal_make_lisp_face); | 6841 | defsubr (&Sinternal_make_lisp_face); |
| 6703 | defsubr (&Sinternal_lisp_face_p); | 6842 | defsubr (&Sinternal_lisp_face_p); |
| 6704 | defsubr (&Sinternal_set_lisp_face_attribute); | 6843 | defsubr (&Sinternal_set_lisp_face_attribute); |
| 6705 | #ifdef HAVE_X_WINDOWS | 6844 | #ifdef HAVE_WINDOW_SYSTEM |
| 6706 | defsubr (&Sinternal_set_lisp_face_attribute_from_resource); | 6845 | defsubr (&Sinternal_set_lisp_face_attribute_from_resource); |
| 6707 | #endif | 6846 | #endif |
| 6708 | defsubr (&Scolor_gray_p); | 6847 | defsubr (&Scolor_gray_p); |
| @@ -6758,15 +6897,20 @@ A value of nil means don't allow any scalable fonts.\n\ | |||
| 6758 | A value of t means allow any scalable font.\n\ | 6897 | A value of t means allow any scalable font.\n\ |
| 6759 | Otherwise, value must be a list of regular expressions. A font may be\n\ | 6898 | Otherwise, value must be a list of regular expressions. A font may be\n\ |
| 6760 | scaled if its name matches a regular expression in the list."); | 6899 | scaled if its name matches a regular expression in the list."); |
| 6900 | #ifdef WINDOWSNT | ||
| 6901 | /* Windows uses mainly truetype fonts, so disallowing scalable fonts | ||
| 6902 | by default limits the fonts available severely. */ | ||
| 6903 | Vscalable_fonts_allowed = Qt; | ||
| 6904 | #else | ||
| 6761 | Vscalable_fonts_allowed = Qnil; | 6905 | Vscalable_fonts_allowed = Qnil; |
| 6762 | 6906 | #endif | |
| 6763 | #endif /* SCALABLE_FONTS */ | 6907 | #endif /* SCALABLE_FONTS */ |
| 6764 | 6908 | ||
| 6765 | #ifdef HAVE_X_WINDOWS | 6909 | #ifdef HAVE_WINDOW_SYSTEM |
| 6766 | defsubr (&Sbitmap_spec_p); | 6910 | defsubr (&Sbitmap_spec_p); |
| 6767 | defsubr (&Sx_list_fonts); | 6911 | defsubr (&Sx_list_fonts); |
| 6768 | defsubr (&Sinternal_face_x_get_resource); | 6912 | defsubr (&Sinternal_face_x_get_resource); |
| 6769 | defsubr (&Sx_family_fonts); | 6913 | defsubr (&Sx_family_fonts); |
| 6770 | defsubr (&Sx_font_family_list); | 6914 | defsubr (&Sx_font_family_list); |
| 6771 | #endif /* HAVE_X_WINDOWS */ | 6915 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 6772 | } | 6916 | } |