diff options
Diffstat (limited to 'src/msdos.c')
| -rw-r--r-- | src/msdos.c | 115 |
1 files changed, 69 insertions, 46 deletions
diff --git a/src/msdos.c b/src/msdos.c index ea604d29992..3e95978d58e 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -2092,33 +2092,27 @@ IT_set_frame_parameters (f, alist) | |||
| 2092 | = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); | 2092 | = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); |
| 2093 | /* Do we have to reverse the foreground and background colors? */ | 2093 | /* Do we have to reverse the foreground and background colors? */ |
| 2094 | int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt); | 2094 | int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt); |
| 2095 | int need_to_reverse, was_reverse = reverse; | ||
| 2096 | int redraw = 0, fg_set = 0, bg_set = 0; | 2095 | int redraw = 0, fg_set = 0, bg_set = 0; |
| 2097 | unsigned long orig_fg, orig_bg; | 2096 | unsigned long orig_fg, orig_bg; |
| 2098 | Lisp_Object frame_bg, frame_fg; | 2097 | Lisp_Object frame_bg, frame_fg; |
| 2099 | extern Lisp_Object Qdefault, QCforeground, QCbackground; | ||
| 2100 | struct tty_display_info *tty = FRAME_TTY (f); | 2098 | struct tty_display_info *tty = FRAME_TTY (f); |
| 2099 | extern Lisp_Object Qmenu_bar_lines; | ||
| 2100 | extern Lisp_Object Vmenu_bar_mode; | ||
| 2101 | int menu_bar_lines_defined = | ||
| 2102 | !NILP (Fassq (Qmenu_bar_lines, Vdefault_frame_alist)); | ||
| 2101 | 2103 | ||
| 2102 | /* If we are creating a new frame, begin with the original screen colors | 2104 | /* If we are creating a new frame, begin with the original screen colors |
| 2103 | used for the initial frame. */ | 2105 | used for the initial frame. */ |
| 2104 | if (EQ (alist, Vdefault_frame_alist) | 2106 | if (!f->default_face_done_p |
| 2105 | && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1) | 2107 | && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1) |
| 2106 | { | 2108 | { |
| 2107 | FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0]; | 2109 | FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0]; |
| 2108 | FRAME_BACKGROUND_PIXEL (f) = initial_screen_colors[1]; | 2110 | FRAME_BACKGROUND_PIXEL (f) = initial_screen_colors[1]; |
| 2109 | init_frame_faces (f); | 2111 | init_frame_faces (f); |
| 2112 | f->default_face_done_p = 1; | ||
| 2110 | } | 2113 | } |
| 2111 | orig_fg = FRAME_FOREGROUND_PIXEL (f); | 2114 | orig_fg = reverse ? FRAME_BACKGROUND_PIXEL (f) : FRAME_FOREGROUND_PIXEL (f); |
| 2112 | orig_bg = FRAME_BACKGROUND_PIXEL (f); | 2115 | orig_bg = reverse ? FRAME_FOREGROUND_PIXEL (f) : FRAME_BACKGROUND_PIXEL (f); |
| 2113 | frame_fg = Fcdr (Fassq (Qforeground_color, f->param_alist)); | ||
| 2114 | frame_bg = Fcdr (Fassq (Qbackground_color, f->param_alist)); | ||
| 2115 | /* frame_fg and frame_bg could be nil if, for example, | ||
| 2116 | f->param_alist is nil, e.g. if we are called from | ||
| 2117 | Fmake_terminal_frame. */ | ||
| 2118 | if (NILP (frame_fg)) | ||
| 2119 | frame_fg = build_string (unspecified_fg); | ||
| 2120 | if (NILP (frame_bg)) | ||
| 2121 | frame_bg = build_string (unspecified_bg); | ||
| 2122 | 2116 | ||
| 2123 | /* Extract parm names and values into those vectors. */ | 2117 | /* Extract parm names and values into those vectors. */ |
| 2124 | i = 0; | 2118 | i = 0; |
| @@ -2144,60 +2138,79 @@ IT_set_frame_parameters (f, alist) | |||
| 2144 | 2138 | ||
| 2145 | if (EQ (prop, Qreverse)) | 2139 | if (EQ (prop, Qreverse)) |
| 2146 | reverse = EQ (val, Qt); | 2140 | reverse = EQ (val, Qt); |
| 2141 | else if (!menu_bar_lines_defined && EQ (prop, Qmenu_bar_lines)) | ||
| 2142 | menu_bar_lines_defined = 1; | ||
| 2147 | } | 2143 | } |
| 2148 | 2144 | ||
| 2149 | need_to_reverse = reverse && !was_reverse; | 2145 | if (tty->termscript && reverse) |
| 2150 | if (tty->termscript && need_to_reverse) | ||
| 2151 | fprintf (tty->termscript, "<INVERSE-VIDEO>\n"); | 2146 | fprintf (tty->termscript, "<INVERSE-VIDEO>\n"); |
| 2152 | 2147 | ||
| 2153 | /* Now process the alist elements in reverse of specified order. */ | 2148 | /* Now process the alist elements in reverse of specified order. */ |
| 2154 | for (i--; i >= 0; i--) | 2149 | for (i--; i >= 0; i--) |
| 2155 | { | 2150 | { |
| 2156 | Lisp_Object prop, val, frame; | 2151 | Lisp_Object prop, val; |
| 2157 | 2152 | ||
| 2158 | prop = parms[i]; | 2153 | prop = parms[i]; |
| 2159 | val = values[i]; | 2154 | val = values[i]; |
| 2160 | 2155 | ||
| 2161 | if (EQ (prop, Qforeground_color)) | 2156 | if (EQ (prop, Qforeground_color)) |
| 2162 | { | 2157 | { |
| 2163 | unsigned long new_color = load_color (f, NULL, val, need_to_reverse | 2158 | unsigned long new_color = load_color (f, NULL, val, reverse |
| 2164 | ? LFACE_BACKGROUND_INDEX | 2159 | ? LFACE_BACKGROUND_INDEX |
| 2165 | : LFACE_FOREGROUND_INDEX); | 2160 | : LFACE_FOREGROUND_INDEX); |
| 2166 | if (new_color != FACE_TTY_DEFAULT_COLOR | 2161 | if (new_color != FACE_TTY_DEFAULT_COLOR |
| 2167 | && new_color != FACE_TTY_DEFAULT_FG_COLOR | 2162 | && new_color != FACE_TTY_DEFAULT_FG_COLOR |
| 2168 | && new_color != FACE_TTY_DEFAULT_BG_COLOR) | 2163 | && new_color != FACE_TTY_DEFAULT_BG_COLOR) |
| 2169 | { | 2164 | { |
| 2170 | FRAME_FOREGROUND_PIXEL (f) = new_color; | 2165 | if (!reverse) |
| 2171 | /* Make sure the foreground of the default face for this | 2166 | { |
| 2172 | frame is changed as well. */ | 2167 | FRAME_FOREGROUND_PIXEL (f) = new_color; |
| 2173 | XSETFRAME (frame, f); | 2168 | /* Make sure the foreground of the default face for |
| 2174 | Finternal_set_lisp_face_attribute (Qdefault, QCforeground, | 2169 | this frame is changed as well. */ |
| 2175 | val, frame); | 2170 | update_face_from_frame_parameter (f, Qforeground_color, val); |
| 2176 | fg_set = 1; | 2171 | fg_set = 1; |
| 2172 | if (tty->termscript) | ||
| 2173 | fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color); | ||
| 2174 | } | ||
| 2175 | else | ||
| 2176 | { | ||
| 2177 | FRAME_BACKGROUND_PIXEL (f) = new_color; | ||
| 2178 | update_face_from_frame_parameter (f, Qbackground_color, val); | ||
| 2179 | bg_set = 1; | ||
| 2180 | if (tty->termscript) | ||
| 2181 | fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color); | ||
| 2182 | } | ||
| 2177 | redraw = 1; | 2183 | redraw = 1; |
| 2178 | if (tty->termscript) | ||
| 2179 | fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color); | ||
| 2180 | } | 2184 | } |
| 2181 | } | 2185 | } |
| 2182 | else if (EQ (prop, Qbackground_color)) | 2186 | else if (EQ (prop, Qbackground_color)) |
| 2183 | { | 2187 | { |
| 2184 | unsigned long new_color = load_color (f, NULL, val, need_to_reverse | 2188 | unsigned long new_color = load_color (f, NULL, val, reverse |
| 2185 | ? LFACE_FOREGROUND_INDEX | 2189 | ? LFACE_FOREGROUND_INDEX |
| 2186 | : LFACE_BACKGROUND_INDEX); | 2190 | : LFACE_BACKGROUND_INDEX); |
| 2187 | if (new_color != FACE_TTY_DEFAULT_COLOR | 2191 | if (new_color != FACE_TTY_DEFAULT_COLOR |
| 2188 | && new_color != FACE_TTY_DEFAULT_FG_COLOR | 2192 | && new_color != FACE_TTY_DEFAULT_FG_COLOR |
| 2189 | && new_color != FACE_TTY_DEFAULT_BG_COLOR) | 2193 | && new_color != FACE_TTY_DEFAULT_BG_COLOR) |
| 2190 | { | 2194 | { |
| 2191 | FRAME_BACKGROUND_PIXEL (f) = new_color; | 2195 | if (!reverse) |
| 2192 | /* Make sure the background of the default face for this | 2196 | { |
| 2193 | frame is changed as well. */ | 2197 | FRAME_BACKGROUND_PIXEL (f) = new_color; |
| 2194 | XSETFRAME (frame, f); | 2198 | /* Make sure the background of the default face for |
| 2195 | Finternal_set_lisp_face_attribute (Qdefault, QCbackground, | 2199 | this frame is changed as well. */ |
| 2196 | val, frame); | 2200 | bg_set = 1; |
| 2197 | bg_set = 1; | 2201 | update_face_from_frame_parameter (f, Qbackground_color, val); |
| 2202 | if (tty->termscript) | ||
| 2203 | fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color); | ||
| 2204 | } | ||
| 2205 | else | ||
| 2206 | { | ||
| 2207 | FRAME_FOREGROUND_PIXEL (f) = new_color; | ||
| 2208 | fg_set = 1; | ||
| 2209 | update_face_from_frame_parameter (f, Qforeground_color, val); | ||
| 2210 | if (tty->termscript) | ||
| 2211 | fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color); | ||
| 2212 | } | ||
| 2198 | redraw = 1; | 2213 | redraw = 1; |
| 2199 | if (tty->termscript) | ||
| 2200 | fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color); | ||
| 2201 | } | 2214 | } |
| 2202 | } | 2215 | } |
| 2203 | else if (EQ (prop, Qtitle)) | 2216 | else if (EQ (prop, Qtitle)) |
| @@ -2226,26 +2239,36 @@ IT_set_frame_parameters (f, alist) | |||
| 2226 | store_frame_param (f, prop, val); | 2239 | store_frame_param (f, prop, val); |
| 2227 | } | 2240 | } |
| 2228 | 2241 | ||
| 2242 | /* If menu-bar-lines is neither in the frame parameters nor in | ||
| 2243 | default-frame-alist, set it according to menu-bar-mode. */ | ||
| 2244 | if (!menu_bar_lines_defined) | ||
| 2245 | { | ||
| 2246 | store_frame_param (f, Qmenu_bar_lines, | ||
| 2247 | NILP (Vmenu_bar_mode) | ||
| 2248 | ? make_number (0) : make_number (1)); | ||
| 2249 | if (tty->termscript) | ||
| 2250 | fprintf (tty->termscript, "<MENU BAR LINES DEFAULTED: %d\n", | ||
| 2251 | !NILP (Vmenu_bar_mode)); | ||
| 2252 | } | ||
| 2253 | |||
| 2229 | /* If they specified "reverse", but not the colors, we need to swap | 2254 | /* If they specified "reverse", but not the colors, we need to swap |
| 2230 | the current frame colors. */ | 2255 | the current frame colors. */ |
| 2231 | if (need_to_reverse) | 2256 | if (reverse) |
| 2232 | { | 2257 | { |
| 2233 | Lisp_Object frame; | 2258 | Lisp_Object frame; |
| 2234 | 2259 | ||
| 2235 | if (!fg_set) | 2260 | if (!fg_set) |
| 2236 | { | 2261 | { |
| 2237 | XSETFRAME (frame, f); | 2262 | FRAME_FOREGROUND_PIXEL (f) = orig_bg; |
| 2238 | Finternal_set_lisp_face_attribute (Qdefault, QCforeground, | 2263 | update_face_from_frame_parameter (f, Qforeground_color, |
| 2239 | tty_color_name (f, orig_bg), | 2264 | tty_color_name (f, orig_bg)); |
| 2240 | frame); | ||
| 2241 | redraw = 1; | 2265 | redraw = 1; |
| 2242 | } | 2266 | } |
| 2243 | if (!bg_set) | 2267 | if (!bg_set) |
| 2244 | { | 2268 | { |
| 2245 | XSETFRAME (frame, f); | 2269 | FRAME_BACKGROUND_PIXEL (f) = orig_fg; |
| 2246 | Finternal_set_lisp_face_attribute (Qdefault, QCbackground, | 2270 | update_face_from_frame_parameter (f, Qbackground_color, |
| 2247 | tty_color_name (f, orig_fg), | 2271 | tty_color_name (f, orig_fg)); |
| 2248 | frame); | ||
| 2249 | redraw = 1; | 2272 | redraw = 1; |
| 2250 | } | 2273 | } |
| 2251 | } | 2274 | } |