]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix fallout from switch to 32-bit visuals
authorPo Lu <luangruo@yahoo.com>
Fri, 11 Feb 2022 05:30:11 +0000 (13:30 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 11 Feb 2022 05:30:11 +0000 (13:30 +0800)
* src/xfns.c (x_decode_color): Make return type wide enough to
hold any pixel value.
* src/xterm.h (x_make_truecolor_pixel): Simplify.

src/xfns.c
src/xterm.h

index 58f5cb847bdf192fe04413a547296e11393141a0..7d91f32ad4a4aba8c0c830ddee1ecce57615ce7b 100644 (file)
@@ -687,7 +687,7 @@ x_defined_color (struct frame *f, const char *color_name,
    is a monochrome frame, return MONO_COLOR regardless of what ARG says.
    Signal an error if color can't be allocated.  */
 
-static int
+static unsigned long
 x_decode_color (struct frame *f, Lisp_Object color_name, int mono_color)
 {
   XColor cdef;
index afd6a1757c5fa8090bc7205d4482c99eb9cf126f..3a69c02879766d31dbe7669144b8e68b01ac5a81 100644 (file)
@@ -1307,7 +1307,7 @@ x_display_pixel_width (struct x_display_info *dpyinfo)
 INLINE unsigned long
 x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
 {
-  unsigned long pr, pg, pb, pa = 0;
+  unsigned long pr, pg, pb, pa = dpyinfo->alpha_mask;
 
   /* Scale down RGB values to the visual's bits per RGB, and shift
      them to the right position in the pixel color.  Note that the
@@ -1316,12 +1316,6 @@ x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
   pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
   pb = (b >> (16 - dpyinfo->blue_bits))  << dpyinfo->blue_offset;
 
-  if (dpyinfo->alpha_bits)
-    pa = (((unsigned long) 0xffff >> (16 - dpyinfo->alpha_bits))
-         << dpyinfo->alpha_offset);
-  else
-    pa = 0;
-
   /* Assemble the pixel color.  */
   return pr | pg | pb | pa;
 }