Commit 2d764c78 authored by Eli Zaretskii's avatar Eli Zaretskii

Changes for automatic remapping of X colors on terminal frames:

	* xfaces.c (XColor) [!HAVE_X_WINDOWS]: Provide a typedef for non-X
	frames.
	(Vface_tty_color_alist): Remove.
	(tty_defined_color): New function.
	(defined_color): Rewrite to support any type of frame.
	(tty_color_name): New function.
	(face_color_supported_p, Fface_color_gray_p,
	Fface_color_supported_p): Support non-X frames.
	(load_color): Enclose the color name in quotes, in the log
	messages.  Remove DOS-specific version of load_color.
	(realize_tty_face): Take the supported colors from
	tty-color-alist.  Support translation of X colors to the closest
	tty color, for both MSDOS and tty frames.
	[MSDOS]: Don't invert face colors if they were taken from the
	frame colors.
	(Fface_register_tty_color, Fface_clear_tty_colors): Remove.

	* frame.h (struct x_output) [!MSDOS, !WINDOWSNT, !HAVE_X_WINDOWS]:
	Define a mostly empty surrogate.
	(tty_display): Declare.

	* frame.c (make_terminal_frame) [!macintosh]: Don't use
	tty_display.
	(Fframe_parameters): Don't invert colors of non-FRAME_WINDOW_P
	frames when the frame's param_alist includes 'reverse.
	(tty_display): Define.
	(make_terminal_frame) [!MSDOS]: Assign &tty_display to the
	output_data.x member.
	(Fframe_parameters): Return foreground and background color names
	on tty frames as well, in addition to MSDOS frames.

	* msdos.h (DisplayWidth, DisplayHeight): Changes for Lisp_Object
	selected_frame.
	(struct x_output): Remove unused members; document who uses each
	member.
	(FRAME_PARAM_FACES, FRAME_N_PARAM_FACES, FRAME_DEFAULT_PARAM_FACE,
	FRAME_MODE_LINE_PARAM_FACE, FRAME_COMPUTED_FACES,
	FRAME_N_COMPUTED_FACES, FRAME_SIZE_COMPUTED_FACES,
	FRAME_DEFAULT_FACE, FRAME_MODE_LINE_FACE, unload_color): Remove
	unused macro definintions.

	* msdos.c (IT_set_frame_parameters): Don't call
	recompute_basic_faces, the next redisplay will, anyway.
	(x_current_display): Remove unused variable.
	Many functions: changes for Lisp_object selected_frame.
	(IT_set_face): If the tty_reverse_p flag is set for the face,
	reverse the foreground and background colors.
	(Fmsdos_remember_default_colors): New function.
	(syms_of_msdos): Defsubr it.
	(IT_set_frame_parameters): Use initial_screen_colors[] when
	creating a new frame.  If the frame parameters include 'reverse,
	swap the foreground and background colors.
	(internal_terminal_init): Initialize initial_screen_colors to -1.
	(syms_of_msdos): Add DEFVAR_BOOL for x-stretch-cursor, to shut up
	cus-start.el.

	* Makefile.in (lisp, shortlisp): Add lisp/term/tty-colors.elc.

	* xfns.c (x_defined_color): Rename from defined_color.  All
	callers changed.
	(Fxw_color_defined_p): Renamed from Fx_color_defined_p;
	all callers changed.
	(Fxw_color_values): Renamed from Fx_color_values; all callers
	changed.
	(Fxw_display_color_p): Renamed from Fx_display_color_p; all
	callers changed.
	(x_window_to_frame, x_any_window_to_frame,
	x_non_menubar_window_to_frame, x_menubar_window_to_frame,
	x_top_window_to_frame): Use !FRAME_X_P instead of
	f->output_data.nothing.
	* xterm.h (x_defined_color): Rename from defined_color.

	* w32fns.c (x_window_to_frame): Use FRAME_W32_P instead of
	f->output_data.nothing.
	(Fxw_color_defined_p): Renamed from Fx_color_defined_p;
	all callers changed.
	(Fxw_color_values): Renamed from Fx_color_values; all callers
	changed.
	(Fxw_display_color_p): Renamed from Fx_display_color_p; all
	callers changed.

	* dispextern.h (tty_color_name): Add prototype.

	* xmenu.c (menubar_id_to_frame): Use FRAME_WINDOW_P instead of
	f->output_data.nothing.
	* w32menu.c (menubar_id_to_frame): Likewise.
	* w32term.h (w32_output): Declare.

	* dosfns.c (Qmsdos_color_translate): Remove.
	(msdos_stdcolor_name): Now returns a Lisp_Object.
	* dosfns.h (Qmsdos_color_translate): Remove.

	* s/msdos.h (INTERNAL_TERMINAL): Add entries for color support.
parent f6737cde
No preview for this file type
...@@ -733,6 +733,7 @@ lisp= \ ...@@ -733,6 +733,7 @@ lisp= \
${lispsource}simple.elc \ ${lispsource}simple.elc \
${lispsource}startup.elc \ ${lispsource}startup.elc \
${lispsource}subr.elc \ ${lispsource}subr.elc \
${lispsource}term/tty-colors.elc \
${lispsource}textmodes/fill.elc \ ${lispsource}textmodes/fill.elc \
${lispsource}textmodes/page.elc \ ${lispsource}textmodes/page.elc \
${lispsource}textmodes/paragraphs.elc \ ${lispsource}textmodes/paragraphs.elc \
...@@ -798,6 +799,7 @@ shortlisp= \ ...@@ -798,6 +799,7 @@ shortlisp= \
../lisp/simple.elc \ ../lisp/simple.elc \
../lisp/startup.elc \ ../lisp/startup.elc \
../lisp/subr.elc \ ../lisp/subr.elc \
../lisp/term/tty-colors.elc \
../lisp/textmodes/fill.elc \ ../lisp/textmodes/fill.elc \
../lisp/textmodes/page.elc \ ../lisp/textmodes/page.elc \
../lisp/textmodes/paragraphs.elc \ ../lisp/textmodes/paragraphs.elc \
......
...@@ -5915,7 +5915,15 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\ ...@@ -5915,7 +5915,15 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\
&& (strcmp (terminal_type, "internal") != 0 || inhibit_window_system) && (strcmp (terminal_type, "internal") != 0 || inhibit_window_system)
#endif #endif
&& NILP (Vwindow_system)) && NILP (Vwindow_system))
call0 (intern ("tty-set-up-initial-frame-faces")); {
/* For the initial frame, we don't have any way of knowing what
are the foreground and background colors of the terminal. */
struct frame *sf = SELECTED_FRAME();
FRAME_FOREGROUND_PIXEL (sf) = -1;
FRAME_BACKGROUND_PIXEL (sf) = -1;
call0 (intern ("tty-set-up-initial-frame-faces"));
}
} }
......
...@@ -173,11 +173,6 @@ Report whether a mouse is present.") ...@@ -173,11 +173,6 @@ Report whether a mouse is present.")
else else
return Qnil; return Qnil;
} }
/* Function to translate colour names to integers. See lisp/term/pc-win.el
for its definition. */
Lisp_Object Qmsdos_color_translate;
#endif #endif
...@@ -418,8 +413,8 @@ static char *vga_colors[16] = { ...@@ -418,8 +413,8 @@ static char *vga_colors[16] = {
that this only performs case-insensitive comparison against the that this only performs case-insensitive comparison against the
standard names. For anything more sophisticated, like matching standard names. For anything more sophisticated, like matching
"gray" with "grey" or translating X color names into their MSDOS "gray" with "grey" or translating X color names into their MSDOS
equivalents, call the Lisp function Qmsdos_color_translate (defined equivalents, call the Lisp function Qtty_color_desc (defined
on lisp/term/pc-win.el). */ on lisp/term/tty-colors.el). */
int int
msdos_stdcolor_idx (const char *name) msdos_stdcolor_idx (const char *name)
{ {
...@@ -433,12 +428,14 @@ msdos_stdcolor_idx (const char *name) ...@@ -433,12 +428,14 @@ msdos_stdcolor_idx (const char *name)
} }
/* Given a color index, return its standard name. */ /* Given a color index, return its standard name. */
char * Lisp_Object
msdos_stdcolor_name (int idx) msdos_stdcolor_name (int idx)
{ {
extern Lisp_Object Qunspecified;
if (idx < 0 || idx >= sizeof (vga_colors) / sizeof (vga_colors[0])) if (idx < 0 || idx >= sizeof (vga_colors) / sizeof (vga_colors[0]))
return ""; /* meaning the default */ return Qunspecified; /* meaning the default */
return vga_colors[idx]; return build_string (vga_colors[idx]);
} }
/* Support for features that are available when we run in a DOS box /* Support for features that are available when we run in a DOS box
...@@ -533,8 +530,6 @@ syms_of_dosfns () ...@@ -533,8 +530,6 @@ syms_of_dosfns ()
defsubr (&Smsdos_mouse_disable); defsubr (&Smsdos_mouse_disable);
#ifndef HAVE_X_WINDOWS #ifndef HAVE_X_WINDOWS
defsubr (&Smsdos_mouse_p); defsubr (&Smsdos_mouse_p);
Qmsdos_color_translate = intern ("msdos-color-translate");
staticpro (&Qmsdos_color_translate);
#endif #endif
DEFVAR_INT ("dos-country-code", &dos_country_code, DEFVAR_INT ("dos-country-code", &dos_country_code,
......
...@@ -36,8 +36,7 @@ extern Lisp_Object Vdos_version; ...@@ -36,8 +36,7 @@ extern Lisp_Object Vdos_version;
extern Lisp_Object Vdos_windows_version; extern Lisp_Object Vdos_windows_version;
#ifndef HAVE_X_WINDOWS #ifndef HAVE_X_WINDOWS
extern Lisp_Object Vdos_display_scancodes; extern Lisp_Object Vdos_display_scancodes;
extern Lisp_Object Qmsdos_color_translate;
extern int msdos_stdcolor_idx P_ ((const char *)); extern int msdos_stdcolor_idx P_ ((const char *));
extern char *msdos_stdcolor_name P_ ((int)); extern Lisp_Object msdos_stdcolor_name P_ ((int));
#endif #endif
...@@ -222,6 +222,8 @@ set_menu_bar_lines (f, value, oldval) ...@@ -222,6 +222,8 @@ set_menu_bar_lines (f, value, oldval)
Lisp_Object Vemacs_iconified; Lisp_Object Vemacs_iconified;
Lisp_Object Vframe_list; Lisp_Object Vframe_list;
struct x_output tty_display;
extern Lisp_Object Vminibuffer_list; extern Lisp_Object Vminibuffer_list;
extern Lisp_Object get_minibuffer (); extern Lisp_Object get_minibuffer ();
extern Lisp_Object Fhandle_switch_frame (); extern Lisp_Object Fhandle_switch_frame ();
...@@ -232,6 +234,8 @@ DEFUN ("framep", Fframep, Sframep, 1, 1, 0, ...@@ -232,6 +234,8 @@ DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
"Return non-nil if OBJECT is a frame.\n\ "Return non-nil if OBJECT is a frame.\n\
Value is t for a termcap frame (a character-only terminal),\n\ Value is t for a termcap frame (a character-only terminal),\n\
`x' for an Emacs frame that is really an X window,\n\ `x' for an Emacs frame that is really an X window,\n\
`w32' for an Emacs frame that is a window on MS-Windows display,\n\
`mac' for an Emacs frame on a Macintosh display,\n\
`pc' for a direct-write MS-DOS frame.\n\ `pc' for a direct-write MS-DOS frame.\n\
See also `frame-live-p'.") See also `frame-live-p'.")
(object) (object)
...@@ -545,9 +549,13 @@ make_terminal_frame () ...@@ -545,9 +549,13 @@ make_terminal_frame ()
f->async_visible = 1; /* Don't let visible be cleared later. */ f->async_visible = 1; /* Don't let visible be cleared later. */
#ifdef MSDOS #ifdef MSDOS
f->output_data.x = &the_only_x_display; f->output_data.x = &the_only_x_display;
f->output_method = output_msdos_raw; if (!inhibit_window_system
#endif /* MSDOS */ && (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame))
|| XFRAME (selected_frame)->output_method == output_msdos_raw))
f->output_method = output_msdos_raw;
else
f->output_method = output_termcap;
#else
#ifdef macintosh #ifdef macintosh
f->output_data.mac = NewMacWindow(f); f->output_data.mac = NewMacWindow(f);
f->output_data.mac->background_pixel = 0xffffff; f->output_data.mac->background_pixel = 0xffffff;
...@@ -559,16 +567,15 @@ make_terminal_frame () ...@@ -559,16 +567,15 @@ make_terminal_frame ()
f->auto_raise = 1; f->auto_raise = 1;
f->auto_lower = 1; f->auto_lower = 1;
init_frame_faces (f); init_frame_faces (f);
#endif /* macintosh */ #else /* !macintosh */
f->output_data.x = &tty_display;
#endif /* !macintosh */
#endif /* MSDOS */
#ifndef MSDOS
#ifndef macintosh #ifndef macintosh
f->output_data.nothing = 1; /* Nonzero means frame isn't deleted. */
#endif
#endif
if (!noninteractive) if (!noninteractive)
init_frame_faces (f); init_frame_faces (f);
#endif
return f; return f;
} }
...@@ -587,7 +594,8 @@ Note that changing the size of one terminal frame automatically affects all.") ...@@ -587,7 +594,8 @@ Note that changing the size of one terminal frame automatically affects all.")
struct frame *sf = SELECTED_FRAME (); struct frame *sf = SELECTED_FRAME ();
#ifdef MSDOS #ifdef MSDOS
if (sf->output_method != output_msdos_raw) if (sf->output_method != output_msdos_raw
&& sf->output_method != output_termcap)
abort (); abort ();
#else /* not MSDOS */ #else /* not MSDOS */
...@@ -1994,23 +2002,20 @@ If FRAME is omitted, return information on the currently selected frame.") ...@@ -1994,23 +2002,20 @@ If FRAME is omitted, return information on the currently selected frame.")
return Qnil; return Qnil;
alist = Fcopy_alist (f->param_alist); alist = Fcopy_alist (f->param_alist);
#ifdef MSDOS if (!FRAME_WINDOW_P (f))
if (FRAME_MSDOS_P (f))
{ {
int fg = FRAME_FOREGROUND_PIXEL (f); int fg = FRAME_FOREGROUND_PIXEL (f);
int bg = FRAME_BACKGROUND_PIXEL (f); int bg = FRAME_BACKGROUND_PIXEL (f);
Lisp_Object qreverse = intern ("reverse");
int rv =
!NILP (Fassq (qreverse, alist))
|| !NILP (Fassq (qreverse, Vdefault_frame_alist));
store_in_alist (&alist, intern ("foreground-color"), store_in_alist (&alist, intern ("foreground-color"),
build_string (msdos_stdcolor_name (rv ? bg : fg))); tty_color_name (f, fg));
store_in_alist (&alist, intern ("background-color"), store_in_alist (&alist, intern ("background-color"),
build_string (msdos_stdcolor_name (rv ? fg : bg))); tty_color_name (f, bg));
store_in_alist (&alist, intern ("font"),
build_string (FRAME_MSDOS_P (f)
? "ms-dos"
: FRAME_W32_P (f) ? "w32term" : "tty"));
} }
store_in_alist (&alist, intern ("font"), build_string ("ms-dos"));
#endif
store_in_alist (&alist, Qname, f->name); store_in_alist (&alist, Qname, f->name);
height = (FRAME_NEW_HEIGHT (f) ? FRAME_NEW_HEIGHT (f) : FRAME_HEIGHT (f)); height = (FRAME_NEW_HEIGHT (f) ? FRAME_NEW_HEIGHT (f) : FRAME_HEIGHT (f));
store_in_alist (&alist, Qheight, make_number (height)); store_in_alist (&alist, Qheight, make_number (height));
......
...@@ -55,6 +55,25 @@ enum vertical_scroll_bar_type ...@@ -55,6 +55,25 @@ enum vertical_scroll_bar_type
vertical_scroll_bar_right vertical_scroll_bar_right
}; };
#if !defined(MSDOS) && !defined(WINDOWSNT) && !defined(macintosh)
#if !defined(HAVE_X_WINDOWS)
/* A (mostly empty) x_output structure definition for building Emacs
on Unix and GNU/Linux without X support. */
struct x_output
{
PIX_TYPE background_pixel;
PIX_TYPE foreground_pixel;
};
#endif /* ! HAVE_X_WINDOWS */
/* A structure describing a termcap frame display. */
extern struct x_output tty_display;
#endif /* ! MSDOS && ! WINDOWSNT && ! macintosh */
struct frame struct frame
{ {
EMACS_INT size; EMACS_INT size;
......
This diff is collapsed.
...@@ -58,33 +58,18 @@ typedef int XRectangle; ...@@ -58,33 +58,18 @@ typedef int XRectangle;
/* This is a cut-down version of the one in xterm.h, which see. */ /* This is a cut-down version of the one in xterm.h, which see. */
struct x_output struct x_output
{ {
int left_pos; int left_pos; /* used in xmenu_show (xmenu.c) */
int top_pos; int top_pos; /* ditto */
int line_height; int line_height; /* used in x-popup-menu (xmenu.c) */
PIX_TYPE background_pixel; PIX_TYPE background_pixel; /* used in xfaces.c and lots of other places */
PIX_TYPE foreground_pixel; PIX_TYPE foreground_pixel; /* ditto */
XFontStruct *font; XFontStruct *font; /* used in x-popup-menu (xmenu.c) */
Window busy_window; Window busy_window; /* currently unused (but maybe some day) */
unsigned busy_p : 1; unsigned busy_p : 1; /* ditto */
struct face **param_faces;
int n_param_faces;
struct face **computed_faces;
int n_computed_faces;
int size_computed_faces;
}; };
extern struct x_output the_only_x_display; extern struct x_output the_only_x_display;
extern Display *x_current_display;
#define FRAME_PARAM_FACES(f) (the_only_x_display.param_faces)
#define FRAME_N_PARAM_FACES(f) (the_only_x_display.n_param_faces)
#define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
#define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])
#define FRAME_COMPUTED_FACES(f) (the_only_x_display.computed_faces)
#define FRAME_N_COMPUTED_FACES(f) (the_only_x_display.n_computed_faces)
#define FRAME_SIZE_COMPUTED_FACES(f) (the_only_x_display.size_computed_faces)
#define FRAME_DEFAULT_FACE(f) (the_only_x_display.computed_faces[0])
#define FRAME_MODE_LINE_FACE(f) (the_only_x_display.computed_faces[1])
#define FRAME_X_DISPLAY(f) ((Display *) 0) #define FRAME_X_DISPLAY(f) ((Display *) 0)
#define FRAME_FOREGROUND_PIXEL(f) (the_only_x_display.foreground_pixel) #define FRAME_FOREGROUND_PIXEL(f) (the_only_x_display.foreground_pixel)
#define FRAME_BACKGROUND_PIXEL(f) (the_only_x_display.background_pixel) #define FRAME_BACKGROUND_PIXEL(f) (the_only_x_display.background_pixel)
...@@ -95,10 +80,6 @@ extern Display *x_current_display; ...@@ -95,10 +80,6 @@ extern Display *x_current_display;
/* Forward declarations for prototypes. */ /* Forward declarations for prototypes. */
struct frame; struct frame;
struct window; struct window;
#if 0
extern int face_name_id_number P_ ((struct frame *, Lisp_Object)); /* !!! */
extern int compute_glyph_face P_ ((struct frame *, int, int)); /* !!! */
#endif
/* From xterm.c; emulated on msdos.c */ /* From xterm.c; emulated on msdos.c */
...@@ -116,12 +97,11 @@ extern int x_pixel_width P_ ((struct frame *)); ...@@ -116,12 +97,11 @@ extern int x_pixel_width P_ ((struct frame *));
extern int x_pixel_height P_ ((struct frame *)); extern int x_pixel_height P_ ((struct frame *));
#define XFreeGC (void) #define XFreeGC (void)
#define unload_color(p1,p2)
#define x_destroy_bitmap(p1,p2) #define x_destroy_bitmap(p1,p2)
#define load_pixmap(p1,p2,p3,p4) (0) #define load_pixmap(p1,p2,p3,p4) (0)
#define XGetGeometry(p1,p2,p3,p4,p5,p6,p7,p8,p9) #define XGetGeometry(p1,p2,p3,p4,p5,p6,p7,p8,p9)
#define DisplayWidth(p1,p2) (selected_frame->width) #define DisplayWidth(p1,p2) (SELECTED_FRAME()->width)
#define DisplayHeight(p1,p2) (selected_frame->height) #define DisplayHeight(p1,p2) (SELECTED_FRAME()->height)
#define XMenuSetAEQ (void) #define XMenuSetAEQ (void)
#define XMenuSetFreeze (void) #define XMenuSetFreeze (void)
#define XMenuRecompute (void) #define XMenuRecompute (void)
......
...@@ -347,8 +347,7 @@ x_window_to_frame (dpyinfo, wdesc) ...@@ -347,8 +347,7 @@ x_window_to_frame (dpyinfo, wdesc)
if (!GC_FRAMEP (frame)) if (!GC_FRAMEP (frame))
continue; continue;
f = XFRAME (frame); f = XFRAME (frame);
if (f->output_data.nothing == 1 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
|| FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
continue; continue;
if (FRAME_W32_WINDOW (f) == wdesc) if (FRAME_W32_WINDOW (f) == wdesc)
return f; return f;
...@@ -6449,9 +6448,8 @@ Lisp_Object w32_find_bdf_fonts_in_dir( Lisp_Object directory ) ...@@ -6449,9 +6448,8 @@ Lisp_Object w32_find_bdf_fonts_in_dir( Lisp_Object directory )
} }
DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
"Return non-nil if color COLOR is supported on frame FRAME.\n\ "Internal function called by `color-defined-p', which see.")
If FRAME is omitted or nil, use the selected frame.")
(color, frame) (color, frame)
Lisp_Object color, frame; Lisp_Object color, frame;
{ {
...@@ -6466,12 +6464,8 @@ If FRAME is omitted or nil, use the selected frame.") ...@@ -6466,12 +6464,8 @@ If FRAME is omitted or nil, use the selected frame.")
return Qnil; return Qnil;
} }
DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0, DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
"Return a description of the color named COLOR on frame FRAME.\n\ "Internal function called by `color-values', which see.")
The value is a list of integer RGB values--(RED GREEN BLUE).\n\
These values appear to range from 0 to 65280 or 65535, depending\n\
on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\
If FRAME is omitted or nil, use the selected frame.")
(color, frame) (color, frame)
Lisp_Object color, frame; Lisp_Object color, frame;
{ {
...@@ -6493,7 +6487,7 @@ If FRAME is omitted or nil, use the selected frame.") ...@@ -6493,7 +6487,7 @@ If FRAME is omitted or nil, use the selected frame.")
return Qnil; return Qnil;
} }
DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0, DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
"Return t if the X display supports color.\n\ "Return t if the X display supports color.\n\
The optional argument DISPLAY specifies which display to ask about.\n\ The optional argument DISPLAY specifies which display to ask about.\n\
DISPLAY should be either a frame or a display name (a string).\n\ DISPLAY should be either a frame or a display name (a string).\n\
...@@ -7595,10 +7589,10 @@ only be necessary if the default setting causes problems."); ...@@ -7595,10 +7589,10 @@ only be necessary if the default setting causes problems.");
defsubr (&Sx_get_resource); defsubr (&Sx_get_resource);
defsubr (&Sx_list_fonts); defsubr (&Sx_list_fonts);
defsubr (&Sx_display_color_p); defsubr (&Sxw_display_color_p);
defsubr (&Sx_display_grayscale_p); defsubr (&Sx_display_grayscale_p);
defsubr (&Sx_color_defined_p); defsubr (&Sxw_color_defined_p);
defsubr (&Sx_color_values); defsubr (&Sxw_color_values);
defsubr (&Sx_server_max_request_size); defsubr (&Sx_server_max_request_size);
defsubr (&Sx_server_vendor); defsubr (&Sx_server_vendor);
defsubr (&Sx_server_version); defsubr (&Sx_server_version);
......
...@@ -219,7 +219,7 @@ menubar_id_to_frame (HMENU menu) ...@@ -219,7 +219,7 @@ menubar_id_to_frame (HMENU menu)
if (!GC_FRAMEP (frame)) if (!GC_FRAMEP (frame))
continue; continue;
f = XFRAME (frame); f = XFRAME (frame);
if (f->output_data.nothing == 1) if (!FRAME_W32_P (f))
continue; continue;
if (f->output_data.w32->menubar_widget == menu) if (f->output_data.w32->menubar_widget == menu)
return f; return f;
......
...@@ -343,6 +343,9 @@ struct w32_output ...@@ -343,6 +343,9 @@ struct w32_output
volatile char pending_menu_activation; volatile char pending_menu_activation;
}; };
/* A (mostly empty) structure describing a w32 terminal frame display. */
extern struct w32_output w32term_display;
/* Get at the computed faces of an X window frame. */ /* Get at the computed faces of an X window frame. */
#define FRAME_PARAM_FACES(f) ((f)->output_data.w32->param_faces) #define FRAME_PARAM_FACES(f) ((f)->output_data.w32->param_faces)
#define FRAME_N_PARAM_FACES(f) ((f)->output_data.w32->n_param_faces) #define FRAME_N_PARAM_FACES(f) ((f)->output_data.w32->n_param_faces)
......
This diff is collapsed.
...@@ -350,7 +350,7 @@ x_window_to_frame (dpyinfo, wdesc) ...@@ -350,7 +350,7 @@ x_window_to_frame (dpyinfo, wdesc)
if (!GC_FRAMEP (frame)) if (!GC_FRAMEP (frame))
continue; continue;
f = XFRAME (frame); f = XFRAME (frame);
if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue; continue;
#ifdef USE_X_TOOLKIT #ifdef USE_X_TOOLKIT
if ((f->output_data.x->edit_widget if ((f->output_data.x->edit_widget
...@@ -388,7 +388,7 @@ x_any_window_to_frame (dpyinfo, wdesc) ...@@ -388,7 +388,7 @@ x_any_window_to_frame (dpyinfo, wdesc)
if (!GC_FRAMEP (frame)) if (!GC_FRAMEP (frame))
continue; continue;
f = XFRAME (frame); f = XFRAME (frame);
if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue; continue;
x = f->output_data.x; x = f->output_data.x;
/* This frame matches if the window is any of its widgets. */ /* This frame matches if the window is any of its widgets. */
...@@ -426,7 +426,7 @@ x_non_menubar_window_to_frame (dpyinfo, wdesc) ...@@ -426,7 +426,7 @@ x_non_menubar_window_to_frame (dpyinfo, wdesc)
if (!GC_FRAMEP (frame)) if (!GC_FRAMEP (frame))
continue; continue;
f = XFRAME (frame); f = XFRAME (frame);
if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue; continue;
x = f->output_data.x; x = f->output_data.x;
/* This frame matches if the window is any of its widgets. */ /* This frame matches if the window is any of its widgets. */
...@@ -461,7 +461,7 @@ x_menubar_window_to_frame (dpyinfo, wdesc) ...@@ -461,7 +461,7 @@ x_menubar_window_to_frame (dpyinfo, wdesc)
if (!GC_FRAMEP (frame)) if (!GC_FRAMEP (frame))
continue; continue;
f = XFRAME (frame); f = XFRAME (frame);
if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue; continue;
x = f->output_data.x; x = f->output_data.x;
/* Match if the window is this frame's menubar. */ /* Match if the window is this frame's menubar. */
...@@ -490,7 +490,7 @@ x_top_window_to_frame (dpyinfo, wdesc) ...@@ -490,7 +490,7 @@ x_top_window_to_frame (dpyinfo, wdesc)
if (!GC_FRAMEP (frame)) if (!GC_FRAMEP (frame))
continue; continue;
f = XFRAME (frame); f = XFRAME (frame);
if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue; continue;
x = f->output_data.x; x = f->output_data.x;
...@@ -1230,7 +1230,7 @@ gamma_correct (f, color) ...@@ -1230,7 +1230,7 @@ gamma_correct (f, color)
If ALLOC is nonzero, allocate a new colormap cell. */ If ALLOC is nonzero, allocate a new colormap cell. */
int int
defined_color (f, color, color_def, alloc) x_defined_color (f, color, color_def, alloc)
FRAME_PTR f; FRAME_PTR f;
char *color; char *color;
XColor *color_def; XColor *color_def;
...@@ -1341,9 +1341,9 @@ x_decode_color (f, arg, def) ...@@ -1341,9 +1341,9 @@ x_decode_color (f, arg, def)
if (FRAME_X_DISPLAY_INFO (f)->n_planes == 1) if (FRAME_X_DISPLAY_INFO (f)->n_planes == 1)
return def; return def;
/* defined_color is responsible for coping with failures /* x_defined_color is responsible for coping with failures
by looking for a near-miss. */ by looking for a near-miss. */
if (defined_color (f, XSTRING (arg)->data, &cdef, 1)) if (x_defined_color (f, XSTRING (arg)->data, &cdef, 1))
return cdef.pixel; return cdef.pixel;
Fsignal (Qerror, Fcons (build_string ("undefined color"), Fsignal (Qerror, Fcons (build_string ("undefined color"),
...@@ -3908,9 +3908,8 @@ x_get_focus_frame (frame) ...@@ -3908,9 +3908,8 @@ x_get_focus_frame (frame)
} }
DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
"Return non-nil if color COLOR is supported on frame FRAME.\n\ "Internal function called by `color-defined-p', which see.")
If FRAME is omitted or nil, use the selected frame.")
(color, frame) (color, frame)
Lisp_Object color, frame; Lisp_Object color, frame;
{ {
...@@ -3919,18 +3918,14 @@ If FRAME is omitted or nil, use the selected frame.") ...@@ -3919,18 +3918,14 @@ If FRAME is omitted or nil, use the selected frame.")
CHECK_STRING (color, 1); CHECK_STRING (color, 1);
if (defined_color (f, XSTRING (color)->data, &foo, 0)) if (x_defined_color (f, XSTRING (color)->data, &foo, 0))
return Qt; return Qt;
else else
return Qnil; return Qnil;
} }
DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0, DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
"Return a description of the color named COLOR on frame FRAME.\n\ "Internal function called by `color-values', which see.")
The value is a list of integer RGB values--(RED GREEN BLUE).\n\
These values appear to range from 0 to 65280 or 65535, depending\n\
on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\
If FRAME is omitted or nil, use the selected frame.")
(color, frame) (color, frame)
Lisp_Object color, frame; Lisp_Object color, frame;
{ {
...@@ -3939,7 +3934,7 @@ If FRAME is omitted or nil, use the selected frame.") ...@@ -3939,7 +3934,7 @@ If FRAME is omitted or nil, use the selected frame.")
CHECK_STRING (color, 1); CHECK_STRING (color, 1);
if (defined_color (f, XSTRING (color)->data, &foo, 0)) if (x_defined_color (f, XSTRING (color)->data, &foo, 0))
{ {
Lisp_Object rgb[3]; Lisp_Object rgb[3];
...@@ -3952,11 +3947,8 @@ If FRAME is omitted or nil, use the selected frame.") ...@@ -3952,11 +3947,8 @@ If FRAME is omitted or nil, use the selected frame.")
return Qnil; return Qnil;
} }
DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0, DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
"Return t if the X display supports color.\n\ "Internal function called by `display-color-p', which see.")
The optional argument DISPLAY specifies which display to ask about.\n\
DISPLAY should be either a frame or a display name (a string).\n\
If omitted or nil, that stands for the selected frame's display.")
(display) (display)
Lisp_Object display; Lisp_Object display;
{ {
...@@ -5878,7 +5870,7 @@ x_alloc_image_color (f, img, color_name, dflt) ...@@ -5878,7 +5870,7 @@ x_alloc_image_color (f, img, color_name, dflt)
xassert (STRINGP (color_name));