]> git.eshelyaron.com Git - emacs.git/commitdiff
Disable nearest-color allocation on DirectColor visuals
authorPo Lu <luangruo@yahoo.com>
Fri, 11 Feb 2022 01:26:45 +0000 (09:26 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 11 Feb 2022 01:26:45 +0000 (09:26 +0800)
* src/xterm.c (x_alloc_nearest_color_1): Disable such allocation
on DirectColor.  The method we use can't possibly work there.

src/xterm.c

index 095ed316cfa16fbde7b4110ce83f3127790c084b..66666229cd95376b017b2b22310843110e1bdfa0 100644 (file)
@@ -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