]> git.eshelyaron.com Git - emacs.git/commitdiff
(defined_color): When we find a "near" color in the map,
authorKarl Heuer <kwzh@gnu.org>
Wed, 21 Feb 1996 21:10:28 +0000 (21:10 +0000)
committerKarl Heuer <kwzh@gnu.org>
Wed, 21 Feb 1996 21:10:28 +0000 (21:10 +0000)
make sure it is really available as a read-only color.

src/xfns.c

index fbb2c05aff648635c106ffa1c82435718484ab99..bade5b56765f5f5e7302e67e12f60e81fd8dbd1c 100644 (file)
@@ -1111,8 +1111,16 @@ defined_color (f, color, color_def, alloc)
                              * ((color_def->blue >> 8) - (cells[x].blue >> 8))));
              if (trial_delta < nearest_delta) 
                {
-                 nearest = x;
-                 nearest_delta = trial_delta;
+                 XColor temp;
+                 temp.red = cells[x].red;
+                 temp.green = cells[x].green;
+                 temp.blue = cells[x].blue;
+                 status = XAllocColor (display, screen_colormap, &temp);
+                 if (status)
+                   {
+                     nearest = x;
+                     nearest_delta = trial_delta;
+                   }
                }
            }
          color_def->red = cells[nearest].red;