Mercurial > emacs
changeset 34998:5091928844df
(Fx_display_color_cells): Determine correct value, when
system doesn't tell us directly.
(Fx_display_visual_class): Implement properly.
author | Andrew Innes <andrewi@gnu.org> |
---|---|
date | Tue, 02 Jan 2001 22:44:52 +0000 |
parents | 1fff4c29a492 |
children | 549bbda5364a |
files | src/w32fns.c |
diffstat | 1 files changed, 15 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/w32fns.c Tue Jan 02 22:41:07 2001 +0000 +++ b/src/w32fns.c Tue Jan 02 22:44:52 2001 +0000 @@ -7215,6 +7215,9 @@ cap = GetDeviceCaps (hdc,SIZEPALETTE); else cap = GetDeviceCaps (hdc,NUMCOLORS); + + if (cap < 0) + cap = 1 << (dpyinfo->n_planes * dpyinfo->n_cbits); ReleaseDC (dpyinfo->root_window, hdc); @@ -7342,22 +7345,18 @@ Lisp_Object display; { struct w32_display_info *dpyinfo = check_x_display_info (display); - -#if 0 - switch (dpyinfo->visual->class) - { - case StaticGray: return (intern ("static-gray")); - case GrayScale: return (intern ("gray-scale")); - case StaticColor: return (intern ("static-color")); - case PseudoColor: return (intern ("pseudo-color")); - case TrueColor: return (intern ("true-color")); - case DirectColor: return (intern ("direct-color")); - default: - error ("Display has an unknown visual class"); - } -#endif - - error ("Display has an unknown visual class"); + Lisp_Object result = Qnil; + + if (dpyinfo->has_palette) + result = intern ("pseudo-color"); + else if (dpyinfo->n_planes * dpyinfo->n_cbits == 1) + result = intern ("static-grey"); + else if (dpyinfo->n_planes * dpyinfo->n_cbits == 4) + result = intern ("static-color"); + else if (dpyinfo->n_planes * dpyinfo->n_cbits > 8) + result = intern ("true-color"); + + return result; } DEFUN ("x-display-save-under", Fx_display_save_under,