diff options
| author | Eli Zaretskii | 1999-12-06 16:54:09 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 1999-12-06 16:54:09 +0000 |
| commit | 2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f (patch) | |
| tree | fa1366f693555a3ec65273f478ed95babf1bd0a9 /src/xfns.c | |
| parent | f6737cde3e786b0e8acea4b613aa42cf49fa204c (diff) | |
| download | emacs-2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f.tar.gz emacs-2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f.zip | |
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.
Diffstat (limited to 'src/xfns.c')
| -rw-r--r-- | src/xfns.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/src/xfns.c b/src/xfns.c index 813b39a162e..59fa8e0b536 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -350,7 +350,7 @@ x_window_to_frame (dpyinfo, wdesc) | |||
| 350 | if (!GC_FRAMEP (frame)) | 350 | if (!GC_FRAMEP (frame)) |
| 351 | continue; | 351 | continue; |
| 352 | f = XFRAME (frame); | 352 | f = XFRAME (frame); |
| 353 | if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) | 353 | if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
| 354 | continue; | 354 | continue; |
| 355 | #ifdef USE_X_TOOLKIT | 355 | #ifdef USE_X_TOOLKIT |
| 356 | if ((f->output_data.x->edit_widget | 356 | if ((f->output_data.x->edit_widget |
| @@ -388,7 +388,7 @@ x_any_window_to_frame (dpyinfo, wdesc) | |||
| 388 | if (!GC_FRAMEP (frame)) | 388 | if (!GC_FRAMEP (frame)) |
| 389 | continue; | 389 | continue; |
| 390 | f = XFRAME (frame); | 390 | f = XFRAME (frame); |
| 391 | if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) | 391 | if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
| 392 | continue; | 392 | continue; |
| 393 | x = f->output_data.x; | 393 | x = f->output_data.x; |
| 394 | /* This frame matches if the window is any of its widgets. */ | 394 | /* This frame matches if the window is any of its widgets. */ |
| @@ -426,7 +426,7 @@ x_non_menubar_window_to_frame (dpyinfo, wdesc) | |||
| 426 | if (!GC_FRAMEP (frame)) | 426 | if (!GC_FRAMEP (frame)) |
| 427 | continue; | 427 | continue; |
| 428 | f = XFRAME (frame); | 428 | f = XFRAME (frame); |
| 429 | if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) | 429 | if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
| 430 | continue; | 430 | continue; |
| 431 | x = f->output_data.x; | 431 | x = f->output_data.x; |
| 432 | /* This frame matches if the window is any of its widgets. */ | 432 | /* This frame matches if the window is any of its widgets. */ |
| @@ -461,7 +461,7 @@ x_menubar_window_to_frame (dpyinfo, wdesc) | |||
| 461 | if (!GC_FRAMEP (frame)) | 461 | if (!GC_FRAMEP (frame)) |
| 462 | continue; | 462 | continue; |
| 463 | f = XFRAME (frame); | 463 | f = XFRAME (frame); |
| 464 | if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) | 464 | if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
| 465 | continue; | 465 | continue; |
| 466 | x = f->output_data.x; | 466 | x = f->output_data.x; |
| 467 | /* Match if the window is this frame's menubar. */ | 467 | /* Match if the window is this frame's menubar. */ |
| @@ -490,7 +490,7 @@ x_top_window_to_frame (dpyinfo, wdesc) | |||
| 490 | if (!GC_FRAMEP (frame)) | 490 | if (!GC_FRAMEP (frame)) |
| 491 | continue; | 491 | continue; |
| 492 | f = XFRAME (frame); | 492 | f = XFRAME (frame); |
| 493 | if (f->output_data.nothing == 1 || FRAME_X_DISPLAY_INFO (f) != dpyinfo) | 493 | if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
| 494 | continue; | 494 | continue; |
| 495 | x = f->output_data.x; | 495 | x = f->output_data.x; |
| 496 | 496 | ||
| @@ -1230,7 +1230,7 @@ gamma_correct (f, color) | |||
| 1230 | If ALLOC is nonzero, allocate a new colormap cell. */ | 1230 | If ALLOC is nonzero, allocate a new colormap cell. */ |
| 1231 | 1231 | ||
| 1232 | int | 1232 | int |
| 1233 | defined_color (f, color, color_def, alloc) | 1233 | x_defined_color (f, color, color_def, alloc) |
| 1234 | FRAME_PTR f; | 1234 | FRAME_PTR f; |
| 1235 | char *color; | 1235 | char *color; |
| 1236 | XColor *color_def; | 1236 | XColor *color_def; |
| @@ -1341,9 +1341,9 @@ x_decode_color (f, arg, def) | |||
| 1341 | if (FRAME_X_DISPLAY_INFO (f)->n_planes == 1) | 1341 | if (FRAME_X_DISPLAY_INFO (f)->n_planes == 1) |
| 1342 | return def; | 1342 | return def; |
| 1343 | 1343 | ||
| 1344 | /* defined_color is responsible for coping with failures | 1344 | /* x_defined_color is responsible for coping with failures |
| 1345 | by looking for a near-miss. */ | 1345 | by looking for a near-miss. */ |
| 1346 | if (defined_color (f, XSTRING (arg)->data, &cdef, 1)) | 1346 | if (x_defined_color (f, XSTRING (arg)->data, &cdef, 1)) |
| 1347 | return cdef.pixel; | 1347 | return cdef.pixel; |
| 1348 | 1348 | ||
| 1349 | Fsignal (Qerror, Fcons (build_string ("undefined color"), | 1349 | Fsignal (Qerror, Fcons (build_string ("undefined color"), |
| @@ -3908,9 +3908,8 @@ x_get_focus_frame (frame) | |||
| 3908 | } | 3908 | } |
| 3909 | 3909 | ||
| 3910 | 3910 | ||
| 3911 | DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, | 3911 | DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, |
| 3912 | "Return non-nil if color COLOR is supported on frame FRAME.\n\ | 3912 | "Internal function called by `color-defined-p', which see.") |
| 3913 | If FRAME is omitted or nil, use the selected frame.") | ||
| 3914 | (color, frame) | 3913 | (color, frame) |
| 3915 | Lisp_Object color, frame; | 3914 | Lisp_Object color, frame; |
| 3916 | { | 3915 | { |
| @@ -3919,18 +3918,14 @@ If FRAME is omitted or nil, use the selected frame.") | |||
| 3919 | 3918 | ||
| 3920 | CHECK_STRING (color, 1); | 3919 | CHECK_STRING (color, 1); |
| 3921 | 3920 | ||
| 3922 | if (defined_color (f, XSTRING (color)->data, &foo, 0)) | 3921 | if (x_defined_color (f, XSTRING (color)->data, &foo, 0)) |
| 3923 | return Qt; | 3922 | return Qt; |
| 3924 | else | 3923 | else |
| 3925 | return Qnil; | 3924 | return Qnil; |
| 3926 | } | 3925 | } |
| 3927 | 3926 | ||
| 3928 | DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0, | 3927 | DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, |
| 3929 | "Return a description of the color named COLOR on frame FRAME.\n\ | 3928 | "Internal function called by `color-values', which see.") |
| 3930 | The value is a list of integer RGB values--(RED GREEN BLUE).\n\ | ||
| 3931 | These values appear to range from 0 to 65280 or 65535, depending\n\ | ||
| 3932 | on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\ | ||
| 3933 | If FRAME is omitted or nil, use the selected frame.") | ||
| 3934 | (color, frame) | 3929 | (color, frame) |
| 3935 | Lisp_Object color, frame; | 3930 | Lisp_Object color, frame; |
| 3936 | { | 3931 | { |
| @@ -3939,7 +3934,7 @@ If FRAME is omitted or nil, use the selected frame.") | |||
| 3939 | 3934 | ||
| 3940 | CHECK_STRING (color, 1); | 3935 | CHECK_STRING (color, 1); |
| 3941 | 3936 | ||
| 3942 | if (defined_color (f, XSTRING (color)->data, &foo, 0)) | 3937 | if (x_defined_color (f, XSTRING (color)->data, &foo, 0)) |
| 3943 | { | 3938 | { |
| 3944 | Lisp_Object rgb[3]; | 3939 | Lisp_Object rgb[3]; |
| 3945 | 3940 | ||
| @@ -3952,11 +3947,8 @@ If FRAME is omitted or nil, use the selected frame.") | |||
| 3952 | return Qnil; | 3947 | return Qnil; |
| 3953 | } | 3948 | } |
| 3954 | 3949 | ||
| 3955 | DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0, | 3950 | DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, |
| 3956 | "Return t if the X display supports color.\n\ | 3951 | "Internal function called by `display-color-p', which see.") |
| 3957 | The optional argument DISPLAY specifies which display to ask about.\n\ | ||
| 3958 | DISPLAY should be either a frame or a display name (a string).\n\ | ||
| 3959 | If omitted or nil, that stands for the selected frame's display.") | ||
| 3960 | (display) | 3952 | (display) |
| 3961 | Lisp_Object display; | 3953 | Lisp_Object display; |
| 3962 | { | 3954 | { |
| @@ -5878,7 +5870,7 @@ x_alloc_image_color (f, img, color_name, dflt) | |||
| 5878 | 5870 | ||
| 5879 | xassert (STRINGP (color_name)); | 5871 | xassert (STRINGP (color_name)); |
| 5880 | 5872 | ||
| 5881 | if (defined_color (f, XSTRING (color_name)->data, &color, 1)) | 5873 | if (x_defined_color (f, XSTRING (color_name)->data, &color, 1)) |
| 5882 | { | 5874 | { |
| 5883 | /* This isn't called frequently so we get away with simply | 5875 | /* This isn't called frequently so we get away with simply |
| 5884 | reallocating the color vector to the needed size, here. */ | 5876 | reallocating the color vector to the needed size, here. */ |
| @@ -10333,10 +10325,10 @@ Each element of the list is a symbol for a supported image type."); | |||
| 10333 | defsubr (&Sx_contour_region); | 10325 | defsubr (&Sx_contour_region); |
| 10334 | defsubr (&Sx_uncontour_region); | 10326 | defsubr (&Sx_uncontour_region); |
| 10335 | #endif | 10327 | #endif |
| 10336 | defsubr (&Sx_display_color_p); | 10328 | defsubr (&Sxw_display_color_p); |
| 10337 | defsubr (&Sx_display_grayscale_p); | 10329 | defsubr (&Sx_display_grayscale_p); |
| 10338 | defsubr (&Sx_color_defined_p); | 10330 | defsubr (&Sxw_color_defined_p); |
| 10339 | defsubr (&Sx_color_values); | 10331 | defsubr (&Sxw_color_values); |
| 10340 | defsubr (&Sx_server_max_request_size); | 10332 | defsubr (&Sx_server_max_request_size); |
| 10341 | defsubr (&Sx_server_vendor); | 10333 | defsubr (&Sx_server_vendor); |
| 10342 | defsubr (&Sx_server_version); | 10334 | defsubr (&Sx_server_version); |