diff options
| author | Eli Zaretskii | 2000-01-02 14:07:32 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2000-01-02 14:07:32 +0000 |
| commit | a61c12d547c5262d9441e664d56108f7d08e41a6 (patch) | |
| tree | b4b160f353a9973be86464a781262202dbd7224f /src | |
| parent | 981e4297b4866c0eca7653d3919cebc07f7a5f6f (diff) | |
| download | emacs-a61c12d547c5262d9441e664d56108f7d08e41a6.tar.gz emacs-a61c12d547c5262d9441e664d56108f7d08e41a6.zip | |
(tty_defined_color): Pass frame to tty-color-desc. The
list of colors renamed to tty-defined-color-alist.
(tty_color_name): Pass the frame to tty-color-by-index.
(realize_tty_face): tty-color-alist is now a function which
accepts the frame as argument.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index dfe8f2e4293..4960de74ff3 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -1088,8 +1088,11 @@ tty_defined_color (f, color_name, color_def, alloc) | |||
| 1088 | 1088 | ||
| 1089 | if (*color_name && !NILP (Ffboundp (Qtty_color_desc))) | 1089 | if (*color_name && !NILP (Ffboundp (Qtty_color_desc))) |
| 1090 | { | 1090 | { |
| 1091 | Lisp_Object frame; | ||
| 1092 | |||
| 1093 | XSETFRAME (frame, f); | ||
| 1091 | status = 0; | 1094 | status = 0; |
| 1092 | color_desc = call1 (Qtty_color_desc, build_string (color_name)); | 1095 | color_desc = call2 (Qtty_color_desc, build_string (color_name), frame); |
| 1093 | if (CONSP (color_desc) && CONSP (XCDR (color_desc))) | 1096 | if (CONSP (color_desc) && CONSP (XCDR (color_desc))) |
| 1094 | { | 1097 | { |
| 1095 | color_idx = XINT (XCAR (XCDR (color_desc))); | 1098 | color_idx = XINT (XCAR (XCDR (color_desc))); |
| @@ -1101,9 +1104,9 @@ tty_defined_color (f, color_name, color_def, alloc) | |||
| 1101 | } | 1104 | } |
| 1102 | status = 1; | 1105 | status = 1; |
| 1103 | } | 1106 | } |
| 1104 | else if (NILP (Fsymbol_value (intern ("tty-color-alist")))) | 1107 | else if (NILP (Fsymbol_value (intern ("tty-defined-color-alist")))) |
| 1105 | /* We were called early during startup, and the colors are not | 1108 | /* We were called early during startup, and the colors are not |
| 1106 | yet set up in tty-color-alist. Don't return a failure | 1109 | yet set up in tty-defined-color-alist. Don't return a failure |
| 1107 | indication, since this produces the annoying "Unable to | 1110 | indication, since this produces the annoying "Unable to |
| 1108 | load color" messages in the *Messages* buffer. */ | 1111 | load color" messages in the *Messages* buffer. */ |
| 1109 | status = 1; | 1112 | status = 1; |
| @@ -1169,7 +1172,11 @@ tty_color_name (f, idx) | |||
| 1169 | 1172 | ||
| 1170 | if (idx >= 0 && !NILP (Ffboundp (Qtty_color_by_index))) | 1173 | if (idx >= 0 && !NILP (Ffboundp (Qtty_color_by_index))) |
| 1171 | { | 1174 | { |
| 1172 | Lisp_Object coldesc = call1 (Qtty_color_by_index, make_number (idx)); | 1175 | Lisp_Object frame; |
| 1176 | Lisp_Object coldesc; | ||
| 1177 | |||
| 1178 | XSETFRAME (frame, f); | ||
| 1179 | coldesc = call2 (Qtty_color_by_index, make_number (idx), frame); | ||
| 1173 | 1180 | ||
| 1174 | if (!NILP (coldesc)) | 1181 | if (!NILP (coldesc)) |
| 1175 | return XCAR (coldesc); | 1182 | return XCAR (coldesc); |
| @@ -6063,7 +6070,10 @@ realize_tty_face (c, attrs, charset) | |||
| 6063 | struct face *face; | 6070 | struct face *face; |
| 6064 | int weight, slant; | 6071 | int weight, slant; |
| 6065 | Lisp_Object color; | 6072 | Lisp_Object color; |
| 6066 | Lisp_Object tty_color_alist = Fsymbol_value (intern ("tty-color-alist")); | 6073 | Lisp_Object tty_defined_color_alist = |
| 6074 | Fsymbol_value (intern ("tty-defined-color-alist")); | ||
| 6075 | Lisp_Object tty_color_alist = intern ("tty-color-alist"); | ||
| 6076 | Lisp_Object frame; | ||
| 6067 | int face_colors_defaulted = 0; | 6077 | int face_colors_defaulted = 0; |
| 6068 | 6078 | ||
| 6069 | /* Frame must be a termcap frame. */ | 6079 | /* Frame must be a termcap frame. */ |
| @@ -6092,13 +6102,14 @@ realize_tty_face (c, attrs, charset) | |||
| 6092 | face->foreground = FACE_TTY_DEFAULT_FG_COLOR; | 6102 | face->foreground = FACE_TTY_DEFAULT_FG_COLOR; |
| 6093 | face->background = FACE_TTY_DEFAULT_BG_COLOR; | 6103 | face->background = FACE_TTY_DEFAULT_BG_COLOR; |
| 6094 | 6104 | ||
| 6105 | XSETFRAME (frame, c->f); | ||
| 6095 | color = attrs[LFACE_FOREGROUND_INDEX]; | 6106 | color = attrs[LFACE_FOREGROUND_INDEX]; |
| 6096 | if (STRINGP (color) | 6107 | if (STRINGP (color) |
| 6097 | && XSTRING (color)->size | 6108 | && XSTRING (color)->size |
| 6098 | && !NILP (tty_color_alist) | 6109 | && !NILP (tty_defined_color_alist) |
| 6099 | && (color = Fassoc (color, tty_color_alist), | 6110 | && (color = Fassoc (color, call1 (tty_color_alist, frame)), |
| 6100 | CONSP (color))) | 6111 | CONSP (color))) |
| 6101 | /* Associations in tty-color-alist are of the form | 6112 | /* Associations in tty-defined-color-alist are of the form |
| 6102 | (NAME INDEX R G B). We need the INDEX part. */ | 6113 | (NAME INDEX R G B). We need the INDEX part. */ |
| 6103 | face->foreground = XINT (XCAR (XCDR (color))); | 6114 | face->foreground = XINT (XCAR (XCDR (color))); |
| 6104 | 6115 | ||
| @@ -6135,10 +6146,10 @@ realize_tty_face (c, attrs, charset) | |||
| 6135 | color = attrs[LFACE_BACKGROUND_INDEX]; | 6146 | color = attrs[LFACE_BACKGROUND_INDEX]; |
| 6136 | if (STRINGP (color) | 6147 | if (STRINGP (color) |
| 6137 | && XSTRING (color)->size | 6148 | && XSTRING (color)->size |
| 6138 | && !NILP (tty_color_alist) | 6149 | && !NILP (tty_defined_color_alist) |
| 6139 | && (color = Fassoc (color, tty_color_alist), | 6150 | && (color = Fassoc (color, call1 (tty_color_alist, frame)), |
| 6140 | CONSP (color))) | 6151 | CONSP (color))) |
| 6141 | /* Associations in tty-color-alist are of the form | 6152 | /* Associations in tty-defined-color-alist are of the form |
| 6142 | (NAME INDEX R G B). We need the INDEX part. */ | 6153 | (NAME INDEX R G B). We need the INDEX part. */ |
| 6143 | face->background = XINT (XCAR (XCDR (color))); | 6154 | face->background = XINT (XCAR (XCDR (color))); |
| 6144 | 6155 | ||