From 212aa7748bab6621453136d1d5df1ef76f5c3194 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 8 Mar 2022 15:19:37 +0800 Subject: [PATCH] Fix more uses of opaque Visual structure * src/image.c (x_kill_gs_process): * src/xfaces.c (x_free_colors): (x_free_dpy_colors): * src/xfns.c (Fxw_display_color_p): (Fx_display_grayscale_p): (Fx_display_visual_class): * src/xterm.c (x_copy_color): * src/xterm.h (x_mutable_colormap): Stop using private fields of Visual. --- src/image.c | 2 +- src/xfaces.c | 4 ++-- src/xfns.c | 6 +++--- src/xterm.c | 2 +- src/xterm.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/image.c b/src/image.c index e2ba744e0a3..c412dc90296 100644 --- a/src/image.c +++ b/src/image.c @@ -11160,7 +11160,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) /* On displays with a mutable colormap, figure out the colors allocated for the image by looking at the pixels of an XImage for img->pixmap. */ - if (x_mutable_colormap (FRAME_X_VISUAL (f))) + if (x_mutable_colormap (FRAME_X_VISUAL_INFO (f))) { XImage *ximg; diff --git a/src/xfaces.c b/src/xfaces.c index 1d2e2489de1..d7f1f4d96e5 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -475,7 +475,7 @@ x_free_colors (struct frame *f, unsigned long *pixels, int npixels) { /* If display has an immutable color map, freeing colors is not necessary and some servers don't allow it. So don't do it. */ - if (x_mutable_colormap (FRAME_X_VISUAL (f))) + if (x_mutable_colormap (FRAME_X_VISUAL_INFO (f))) { #ifdef DEBUG_X_COLORS unregister_colors (pixels, npixels); @@ -500,7 +500,7 @@ x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, /* If display has an immutable color map, freeing colors is not necessary and some servers don't allow it. So don't do it. */ - if (x_mutable_colormap (dpyinfo->visual)) + if (x_mutable_colormap (&dpyinfo->visual_info)) { #ifdef DEBUG_X_COLORS unregister_colors (pixels, npixels); diff --git a/src/xfns.c b/src/xfns.c index 9a445b26820..c71f2b025f4 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5028,7 +5028,7 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, if (dpyinfo->n_planes <= 2) return Qnil; - switch (dpyinfo->visual->class) + switch (dpyinfo->visual_info.class) { case StaticColor: case PseudoColor: @@ -5055,7 +5055,7 @@ If omitted or nil, that stands for the selected frame's display. */) if (dpyinfo->n_planes <= 1) return Qnil; - switch (dpyinfo->visual->class) + switch (dpyinfo->visual_info.class) { case StaticColor: case PseudoColor: @@ -5335,7 +5335,7 @@ If omitted or nil, that stands for the selected frame's display. struct x_display_info *dpyinfo = check_x_display_info (terminal); Lisp_Object result; - switch (dpyinfo->visual->class) + switch (dpyinfo->visual_info.class) { case StaticGray: result = intern ("static-gray"); diff --git a/src/xterm.c b/src/xterm.c index 52df2e9f046..fdecca3bcdb 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -4010,7 +4010,7 @@ x_copy_color (struct frame *f, unsigned long pixel) necessary and some servers don't allow it. Since we won't free a color once we've allocated it, we don't need to re-allocate it to maintain the server's reference count. */ - if (!x_mutable_colormap (FRAME_X_VISUAL (f))) + if (!x_mutable_colormap (FRAME_X_VISUAL_INFO (f))) return pixel; color.pixel = pixel; diff --git a/src/xterm.h b/src/xterm.h index 88949b30391..4875eabafe6 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1381,7 +1381,7 @@ x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b) also allows us to make other optimizations relating to server-side reference counts. */ INLINE bool -x_mutable_colormap (Visual *visual) +x_mutable_colormap (XVisualInfo *visual) { int class = visual->class; return (class != StaticColor && class != StaticGray && class != TrueColor); -- 2.39.2