From: Po Lu Date: Fri, 11 Feb 2022 01:26:45 +0000 (+0800) Subject: Disable nearest-color allocation on DirectColor visuals X-Git-Tag: emacs-29.0.90~2380 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2469e036035f8f5baa78e1557c61df019d8fd572;p=emacs.git Disable nearest-color allocation on DirectColor visuals * src/xterm.c (x_alloc_nearest_color_1): Disable such allocation on DirectColor. The method we use can't possibly work there. --- diff --git a/src/xterm.c b/src/xterm.c index 095ed316cfa..66666229cd9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3193,9 +3193,15 @@ x_parse_color (struct frame *f, const char *color_name, static bool x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color) { + struct x_display_info *dpyinfo = x_display_info_for_display (dpy); bool rc; + eassume (dpyinfo); rc = XAllocColor (dpy, cmap, color) != 0; + + if (dpyinfo->visual->class == DirectColor) + return rc; + if (rc == 0) { /* If we got to this point, the colormap is full, so we're going