aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/dispextern.h2
-rw-r--r--src/frame.c37
-rw-r--r--src/term.c56
-rw-r--r--src/termchar.h1
-rw-r--r--src/xdisp.c1
6 files changed, 45 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e1ef9ffb52a..68e50dd376f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12008-04-09 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * xdisp.c (redisplay_internal): Reset tty's color_mode when switching
4 to another frame.
5 * frame.c (do_switch_frame): Refine the top_frame/async_visible code.
6 Don't call set_tty_color_mode.
7 (store_frame_param): Reset previous_frame rather than call
8 set_tty_color_mode.
9 * term.c (set_tty_color_mode): Rewrite.
10 * dispextern.h (set_tty_color_mode): New type.
11 * termchar.h (struct tty_display_info): Add `previous_color_mode'.
12
12008-04-08 Stefan Monnier <monnier@iro.umontreal.ca> 132008-04-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 14
3 * keymap.c (access_keymap): Remove the value 2 for t_ok which was used 15 * keymap.c (access_keymap): Remove the value 2 for t_ok which was used
diff --git a/src/dispextern.h b/src/dispextern.h
index 8e8d8561984..88373c7dddc 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3057,7 +3057,7 @@ extern void calculate_costs P_ ((struct frame *));
3057extern void produce_glyphs P_ ((struct it *)); 3057extern void produce_glyphs P_ ((struct it *));
3058extern void produce_special_glyphs P_ ((struct it *, enum display_element_type)); 3058extern void produce_special_glyphs P_ ((struct it *, enum display_element_type));
3059extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long)); 3059extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
3060extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); 3060extern void set_tty_color_mode (struct tty_display_info *, struct frame *);
3061extern struct terminal *get_tty_terminal P_ ((Lisp_Object, int)); 3061extern struct terminal *get_tty_terminal P_ ((Lisp_Object, int));
3062extern struct terminal *get_named_tty P_ ((char *)); 3062extern struct terminal *get_named_tty P_ ((char *));
3063EXFUN (Ftty_type, 1); 3063EXFUN (Ftty_type, 1);
diff --git a/src/frame.c b/src/frame.c
index 81b91924d2f..188e1d18717 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -869,11 +869,11 @@ do_switch_frame (frame, track, for_deletion)
869 if (!for_deletion && FRAME_HAS_MINIBUF_P (sf)) 869 if (!for_deletion && FRAME_HAS_MINIBUF_P (sf))
870 resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1); 870 resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1);
871 871
872 if (FRAME_TERMCAP_P (XFRAME (selected_frame)) 872 if (FRAME_TERMCAP_P (XFRAME (frame)))
873 && FRAME_TERMCAP_P (XFRAME (frame))
874 && FRAME_TTY (XFRAME (selected_frame)) == FRAME_TTY (XFRAME (frame)))
875 { 873 {
876 XFRAME (selected_frame)->async_visible = 2; /* obscured */ 874 if (FRAMEP (FRAME_TTY (XFRAME (frame))->top_frame))
875 /* Mark previously displayed frame as now obscured. */
876 XFRAME (FRAME_TTY (XFRAME (frame))->top_frame)->async_visible = 2;
877 XFRAME (frame)->async_visible = 1; 877 XFRAME (frame)->async_visible = 1;
878 FRAME_TTY (XFRAME (frame))->top_frame = frame; 878 FRAME_TTY (XFRAME (frame))->top_frame = frame;
879 } 879 }
@@ -884,23 +884,6 @@ do_switch_frame (frame, track, for_deletion)
884 884
885 Fselect_window (XFRAME (frame)->selected_window, Qnil); 885 Fselect_window (XFRAME (frame)->selected_window, Qnil);
886 886
887#ifndef WINDOWSNT
888 /* Make sure to switch the tty color mode to that of the newly
889 selected frame. */
890 sf = SELECTED_FRAME ();
891 if (FRAME_TERMCAP_P (sf))
892 {
893 Lisp_Object color_mode_spec, color_mode;
894
895 color_mode_spec = assq_no_quit (Qtty_color_mode, sf->param_alist);
896 if (CONSP (color_mode_spec))
897 color_mode = XCDR (color_mode_spec);
898 else
899 color_mode = make_number (0);
900 set_tty_color_mode (sf, color_mode);
901 }
902#endif /* !WINDOWSNT */
903
904 /* We want to make sure that the next event generates a frame-switch 887 /* We want to make sure that the next event generates a frame-switch
905 event to the appropriate frame. This seems kludgy to me, but 888 event to the appropriate frame. This seems kludgy to me, but
906 before you take it out, make sure that evaluating something like 889 before you take it out, make sure that evaluating something like
@@ -2302,11 +2285,13 @@ store_frame_param (f, prop, val)
2302 } 2285 }
2303 2286
2304#ifndef WINDOWSNT 2287#ifndef WINDOWSNT
2305 /* The tty color mode needs to be set before the frame's parameter 2288 /* The tty color needed to be set before the frame's parameter
2306 alist is updated with the new value, because set_tty_color_mode 2289 alist was updated with the new value. This is not true any more,
2307 wants to look at the old mode. */ 2290 but we still do this test early on. */
2308 if (FRAME_TERMCAP_P (f) && EQ (prop, Qtty_color_mode)) 2291 if (FRAME_TERMCAP_P (f) && EQ (prop, Qtty_color_mode)
2309 set_tty_color_mode (f, val); 2292 && f == FRAME_TTY (f)->previous_frame)
2293 /* Force redisplay of this tty. */
2294 FRAME_TTY (f)->previous_frame = NULL;
2310#endif 2295#endif
2311 2296
2312 /* Update the frame parameter alist. */ 2297 /* Update the frame parameter alist. */
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
2163void 2163void
2164set_tty_color_mode (f, val) 2164set_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
diff --git a/src/termchar.h b/src/termchar.h
index 390b6490b63..735758ac910 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -70,6 +70,7 @@ struct tty_display_info
70 70
71 /* The previous frame we displayed on this tty. */ 71 /* The previous frame we displayed on this tty. */
72 struct frame *previous_frame; 72 struct frame *previous_frame;
73 int previous_color_mode;
73 74
74 /* Strings, numbers and flags taken from the termcap entry. */ 75 /* Strings, numbers and flags taken from the termcap entry. */
75 76
diff --git a/src/xdisp.c b/src/xdisp.c
index d311cc646b7..8b6ed37df91 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11188,6 +11188,7 @@ redisplay_internal (preserve_echo_area)
11188 the whole thing. */ 11188 the whole thing. */
11189 windows_or_buffers_changed++; 11189 windows_or_buffers_changed++;
11190 SET_FRAME_GARBAGED (sf); 11190 SET_FRAME_GARBAGED (sf);
11191 set_tty_color_mode (FRAME_TTY (sf), sf);
11191 FRAME_TTY (sf)->previous_frame = sf; 11192 FRAME_TTY (sf)->previous_frame = sf;
11192 } 11193 }
11193 11194