diff options
| author | Stefan Monnier | 2008-04-09 03:25:14 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-09 03:25:14 +0000 |
| commit | 9b2cd403209d7fa25b310b29a2f0a570865fbbb3 (patch) | |
| tree | 3b63c80a0539168cbe49aaffcce1a1ef0ca9469a /src/term.c | |
| parent | 84cb7b4562d2075284f15bcc832d156d0cf0d71a (diff) | |
| download | emacs-9b2cd403209d7fa25b310b29a2f0a570865fbbb3.tar.gz emacs-9b2cd403209d7fa25b310b29a2f0a570865fbbb3.zip | |
* xdisp.c (redisplay_internal): Reset tty's color_mode when switching
to another frame.
* frame.c (do_switch_frame): Refine the top_frame/async_visible code.
Don't call set_tty_color_mode.
(store_frame_param): Reset previous_frame rather than call
set_tty_color_mode.
* term.c (set_tty_color_mode): Rewrite.
* dispextern.h (set_tty_color_mode): New type.
* termchar.h (struct tty_display_info): Add `previous_color_mode'.
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/src/term.c b/src/term.c index 272e8d33326..f76d0a5e5b1 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2161,56 +2161,38 @@ tty_setup_colors (struct tty_display_info *tty, int mode) | |||
| 2161 | } | 2161 | } |
| 2162 | 2162 | ||
| 2163 | void | 2163 | void |
| 2164 | set_tty_color_mode (f, val) | 2164 | set_tty_color_mode (tty, f) |
| 2165 | struct tty_display_info *tty; | ||
| 2165 | struct frame *f; | 2166 | struct frame *f; |
| 2166 | Lisp_Object val; | ||
| 2167 | { | 2167 | { |
| 2168 | Lisp_Object color_mode_spec, current_mode_spec; | 2168 | Lisp_Object tem, val, color_mode_spec; |
| 2169 | Lisp_Object color_mode, current_mode; | 2169 | Lisp_Object color_mode; |
| 2170 | int mode, old_mode; | 2170 | int mode; |
| 2171 | extern Lisp_Object Qtty_color_mode; | 2171 | extern Lisp_Object Qtty_color_mode; |
| 2172 | Lisp_Object tty_color_mode_alist; | 2172 | Lisp_Object tty_color_mode_alist |
| 2173 | = Fintern_soft (build_string ("tty-color-mode-alist"), Qnil); | ||
| 2173 | 2174 | ||
| 2174 | tty_color_mode_alist = Fintern_soft (build_string ("tty-color-mode-alist"), | 2175 | tem = assq_no_quit (Qtty_color_mode, XFRAME (val)->param_alist); |
| 2175 | Qnil); | 2176 | val = CONSP (tem) ? XCDR (tem) : Qnil; |
| 2176 | 2177 | ||
| 2177 | if (INTEGERP (val)) | 2178 | if (INTEGERP (val)) |
| 2178 | color_mode = val; | 2179 | color_mode = val; |
| 2179 | else | 2180 | else |
| 2180 | { | 2181 | { |
| 2181 | if (NILP (tty_color_mode_alist)) | 2182 | tem = (NILP (tty_color_mode_alist) ? Qnil |
| 2182 | color_mode_spec = Qnil; | 2183 | : Fassq (val, XSYMBOL (tty_color_mode_alist)->value)); |
| 2183 | else | 2184 | color_mode = CONSP (tem) ? XCDR (tem) : Qnil; |
| 2184 | color_mode_spec = Fassq (val, XSYMBOL (tty_color_mode_alist)->value); | ||
| 2185 | |||
| 2186 | if (CONSP (color_mode_spec)) | ||
| 2187 | color_mode = XCDR (color_mode_spec); | ||
| 2188 | else | ||
| 2189 | color_mode = Qnil; | ||
| 2190 | } | 2185 | } |
| 2191 | 2186 | ||
| 2192 | current_mode_spec = assq_no_quit (Qtty_color_mode, f->param_alist); | 2187 | mode = INTEGERP (color_mode) ? XINT (color_mode) : 0; |
| 2193 | |||
| 2194 | if (CONSP (current_mode_spec)) | ||
| 2195 | current_mode = XCDR (current_mode_spec); | ||
| 2196 | else | ||
| 2197 | current_mode = Qnil; | ||
| 2198 | if (INTEGERP (color_mode)) | ||
| 2199 | mode = XINT (color_mode); | ||
| 2200 | else | ||
| 2201 | mode = 0; /* meaning default */ | ||
| 2202 | if (INTEGERP (current_mode)) | ||
| 2203 | old_mode = XINT (current_mode); | ||
| 2204 | else | ||
| 2205 | old_mode = 0; | ||
| 2206 | 2188 | ||
| 2207 | if (mode != old_mode) | 2189 | if (mode != tty->previous_color_mode) |
| 2208 | { | 2190 | { |
| 2209 | tty_setup_colors (FRAME_TTY (f), mode); | 2191 | Lisp_Object funsym = intern ("tty-set-up-initial-frame-faces"); |
| 2210 | /* This recomputes all the faces given the new color | 2192 | tty->previous_color_mode = mode; |
| 2211 | definitions. */ | 2193 | tty_setup_colors (tty , mode); |
| 2212 | call0 (intern ("tty-set-up-initial-frame-faces")); | 2194 | /* This recomputes all the faces given the new color definitions. */ |
| 2213 | redraw_frame (f); | 2195 | safe_call (1, &funsym); |
| 2214 | } | 2196 | } |
| 2215 | } | 2197 | } |
| 2216 | 2198 | ||