summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog17
-rw-r--r--src/msdos.c115
-rw-r--r--src/xfaces.c64
3 files changed, 119 insertions, 77 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 68e3d7aae4e..63bd31f5c83 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,22 @@
2010-07-03 Eli Zaretskii <eliz@gnu.org>
+ * msdos.c (IT_set_frame_parameters): Fix setting of colors in
+ frames other than the initial one. Fix reversal of colors when
+ `reverse' is specified in the frame parameters. Call
+ update_face_from_frame_parameter instead of
+ internal-set-lisp-face-attribute. Initialize screen colors from
+ initial_screen_colors[] when f->default_face_done_p is zero,
+ instead of depending on being called with default-frame-alist as
+ the alist argument.
+
+ * xfaces.c (update_face_from_frame_parameter): Move out of
+ HAVE_WINDOW_SYSTEM portion. Condition window-system only parts
+ with HAVE_WINDOW_SYSTEM.
+
+ * msdos.c (IT_set_frame_parameters): Set menu-bar-lines according
+ to menu-bar-mode, if not set in the frame parameters or in
+ default-frame-alist.
+
* w32console.c (sys_tputs): Adjust argument list to prototype in
term.c.
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)
= (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
/* Do we have to reverse the foreground and background colors? */
int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt);
- int need_to_reverse, was_reverse = reverse;
int redraw = 0, fg_set = 0, bg_set = 0;
unsigned long orig_fg, orig_bg;
Lisp_Object frame_bg, frame_fg;
- extern Lisp_Object Qdefault, QCforeground, QCbackground;
struct tty_display_info *tty = FRAME_TTY (f);
+ extern Lisp_Object Qmenu_bar_lines;
+ extern Lisp_Object Vmenu_bar_mode;
+ int menu_bar_lines_defined =
+ !NILP (Fassq (Qmenu_bar_lines, Vdefault_frame_alist));
/* If we are creating a new frame, begin with the original screen colors
used for the initial frame. */
- if (EQ (alist, Vdefault_frame_alist)
+ if (!f->default_face_done_p
&& initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1)
{
FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0];
FRAME_BACKGROUND_PIXEL (f) = initial_screen_colors[1];
init_frame_faces (f);
+ f->default_face_done_p = 1;
}
- orig_fg = FRAME_FOREGROUND_PIXEL (f);
- orig_bg = FRAME_BACKGROUND_PIXEL (f);
- frame_fg = Fcdr (Fassq (Qforeground_color, f->param_alist));
- frame_bg = Fcdr (Fassq (Qbackground_color, f->param_alist));
- /* frame_fg and frame_bg could be nil if, for example,
- f->param_alist is nil, e.g. if we are called from
- Fmake_terminal_frame. */
- if (NILP (frame_fg))
- frame_fg = build_string (unspecified_fg);
- if (NILP (frame_bg))
- frame_bg = build_string (unspecified_bg);
+ orig_fg = reverse ? FRAME_BACKGROUND_PIXEL (f) : FRAME_FOREGROUND_PIXEL (f);
+ orig_bg = reverse ? FRAME_FOREGROUND_PIXEL (f) : FRAME_BACKGROUND_PIXEL (f);
/* Extract parm names and values into those vectors. */
i = 0;
@@ -2144,60 +2138,79 @@ IT_set_frame_parameters (f, alist)
if (EQ (prop, Qreverse))
reverse = EQ (val, Qt);
+ else if (!menu_bar_lines_defined && EQ (prop, Qmenu_bar_lines))
+ menu_bar_lines_defined = 1;
}
- need_to_reverse = reverse && !was_reverse;
- if (tty->termscript && need_to_reverse)
+ if (tty->termscript && reverse)
fprintf (tty->termscript, "<INVERSE-VIDEO>\n");
/* Now process the alist elements in reverse of specified order. */
for (i--; i >= 0; i--)
{
- Lisp_Object prop, val, frame;
+ Lisp_Object prop, val;
prop = parms[i];
val = values[i];
if (EQ (prop, Qforeground_color))
{
- unsigned long new_color = load_color (f, NULL, val, need_to_reverse
+ unsigned long new_color = load_color (f, NULL, val, reverse
? LFACE_BACKGROUND_INDEX
: LFACE_FOREGROUND_INDEX);
if (new_color != FACE_TTY_DEFAULT_COLOR
&& new_color != FACE_TTY_DEFAULT_FG_COLOR
&& new_color != FACE_TTY_DEFAULT_BG_COLOR)
{
- FRAME_FOREGROUND_PIXEL (f) = new_color;
- /* Make sure the foreground of the default face for this
- frame is changed as well. */
- XSETFRAME (frame, f);
- Finternal_set_lisp_face_attribute (Qdefault, QCforeground,
- val, frame);
- fg_set = 1;
+ if (!reverse)
+ {
+ FRAME_FOREGROUND_PIXEL (f) = new_color;
+ /* Make sure the foreground of the default face for
+ this frame is changed as well. */
+ update_face_from_frame_parameter (f, Qforeground_color, val);
+ fg_set = 1;
+ if (tty->termscript)
+ fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color);
+ }
+ else
+ {
+ FRAME_BACKGROUND_PIXEL (f) = new_color;
+ update_face_from_frame_parameter (f, Qbackground_color, val);
+ bg_set = 1;
+ if (tty->termscript)
+ fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color);
+ }
redraw = 1;
- if (tty->termscript)
- fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color);
}
}
else if (EQ (prop, Qbackground_color))
{
- unsigned long new_color = load_color (f, NULL, val, need_to_reverse
+ unsigned long new_color = load_color (f, NULL, val, reverse
? LFACE_FOREGROUND_INDEX
: LFACE_BACKGROUND_INDEX);
if (new_color != FACE_TTY_DEFAULT_COLOR
&& new_color != FACE_TTY_DEFAULT_FG_COLOR
&& new_color != FACE_TTY_DEFAULT_BG_COLOR)
{
- FRAME_BACKGROUND_PIXEL (f) = new_color;
- /* Make sure the background of the default face for this
- frame is changed as well. */
- XSETFRAME (frame, f);
- Finternal_set_lisp_face_attribute (Qdefault, QCbackground,
- val, frame);
- bg_set = 1;
+ if (!reverse)
+ {
+ FRAME_BACKGROUND_PIXEL (f) = new_color;
+ /* Make sure the background of the default face for
+ this frame is changed as well. */
+ bg_set = 1;
+ update_face_from_frame_parameter (f, Qbackground_color, val);
+ if (tty->termscript)
+ fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color);
+ }
+ else
+ {
+ FRAME_FOREGROUND_PIXEL (f) = new_color;
+ fg_set = 1;
+ update_face_from_frame_parameter (f, Qforeground_color, val);
+ if (tty->termscript)
+ fprintf (tty->termscript, "<FGCOLOR %lu>\n", new_color);
+ }
redraw = 1;
- if (tty->termscript)
- fprintf (tty->termscript, "<BGCOLOR %lu>\n", new_color);
}
}
else if (EQ (prop, Qtitle))
@@ -2226,26 +2239,36 @@ IT_set_frame_parameters (f, alist)
store_frame_param (f, prop, val);
}
+ /* If menu-bar-lines is neither in the frame parameters nor in
+ default-frame-alist, set it according to menu-bar-mode. */
+ if (!menu_bar_lines_defined)
+ {
+ store_frame_param (f, Qmenu_bar_lines,
+ NILP (Vmenu_bar_mode)
+ ? make_number (0) : make_number (1));
+ if (tty->termscript)
+ fprintf (tty->termscript, "<MENU BAR LINES DEFAULTED: %d\n",
+ !NILP (Vmenu_bar_mode));
+ }
+
/* If they specified "reverse", but not the colors, we need to swap
the current frame colors. */
- if (need_to_reverse)
+ if (reverse)
{
Lisp_Object frame;
if (!fg_set)
{
- XSETFRAME (frame, f);
- Finternal_set_lisp_face_attribute (Qdefault, QCforeground,
- tty_color_name (f, orig_bg),
- frame);
+ FRAME_FOREGROUND_PIXEL (f) = orig_bg;
+ update_face_from_frame_parameter (f, Qforeground_color,
+ tty_color_name (f, orig_bg));
redraw = 1;
}
if (!bg_set)
{
- XSETFRAME (frame, f);
- Finternal_set_lisp_face_attribute (Qdefault, QCbackground,
- tty_color_name (f, orig_fg),
- frame);
+ FRAME_BACKGROUND_PIXEL (f) = orig_fg;
+ update_face_from_frame_parameter (f, Qbackground_color,
+ tty_color_name (f, orig_fg));
redraw = 1;
}
}
diff --git a/src/xfaces.c b/src/xfaces.c
index 714b07c0800..79eb20febc0 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3490,37 +3490,6 @@ FRAME 0 means change the face on all frames, and change the default
}
-#ifdef HAVE_WINDOW_SYSTEM
-
-/* Set the `font' frame parameter of FRAME determined from the
- font-object set in `default' face attributes LFACE. */
-
-static void
-set_font_frame_param (frame, lface)
- Lisp_Object frame, lface;
-{
- struct frame *f = XFRAME (frame);
- Lisp_Object font;
-
- if (FRAME_WINDOW_P (f)
- /* Don't do anything if the font is `unspecified'. This can
- happen during frame creation. */
- && (font = LFACE_FONT (lface),
- ! UNSPECIFIEDP (font)))
- {
- if (FONT_SPEC_P (font))
- {
- font = font_load_for_lface (f, XVECTOR (lface)->contents, font);
- if (NILP (font))
- return;
- LFACE_FONT (lface) = font;
- }
- f->default_face_done_p = 0;
- Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font), Qnil));
- }
-}
-
-
/* Update the corresponding face when frame parameter PARAM on frame F
has been assigned the value NEW_VALUE. */
@@ -3562,6 +3531,7 @@ update_face_from_frame_parameter (f, param, new_value)
? new_value : Qunspecified);
realize_basic_faces (f);
}
+#ifdef HAVE_WINDOW_SYSTEM
else if (EQ (param, Qborder_color))
{
face = Qborder;
@@ -3583,6 +3553,7 @@ update_face_from_frame_parameter (f, param, new_value)
LFACE_BACKGROUND (lface) = (STRINGP (new_value)
? new_value : Qunspecified);
}
+#endif
/* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces
@@ -3598,6 +3569,37 @@ update_face_from_frame_parameter (f, param, new_value)
}
+#ifdef HAVE_WINDOW_SYSTEM
+
+/* Set the `font' frame parameter of FRAME determined from the
+ font-object set in `default' face attributes LFACE. */
+
+static void
+set_font_frame_param (frame, lface)
+ Lisp_Object frame, lface;
+{
+ struct frame *f = XFRAME (frame);
+ Lisp_Object font;
+
+ if (FRAME_WINDOW_P (f)
+ /* Don't do anything if the font is `unspecified'. This can
+ happen during frame creation. */
+ && (font = LFACE_FONT (lface),
+ ! UNSPECIFIEDP (font)))
+ {
+ if (FONT_SPEC_P (font))
+ {
+ font = font_load_for_lface (f, XVECTOR (lface)->contents, font);
+ if (NILP (font))
+ return;
+ LFACE_FONT (lface) = font;
+ }
+ f->default_face_done_p = 0;
+ Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font), Qnil));
+ }
+}
+
+
/* Get the value of X resource RESOURCE, class CLASS for the display
of frame FRAME. This is here because ordinary `x-get-resource'
doesn't take a frame argument. */