emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 39a2eb04f3: Return actual color cell count in x-display-color-cel


From: Po Lu
Subject: master 39a2eb04f3: Return actual color cell count in x-display-color-cells
Date: Tue, 8 Mar 2022 01:17:08 -0500 (EST)

branch: master
commit 39a2eb04f3f2e2b91192e3553e5366ca4d676370
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Return actual color cell count in x-display-color-cells
    
    * src/xfns.c (Fx_display_color_cells): Return the actual amount
    of color cells, or the amount of individual combinations of
    components.
---
 src/xfns.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index 3d1fa92609..9a445b2682 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5131,14 +5131,17 @@ If omitted or nil, that stands for the selected frame's 
display.
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
 
-  int nr_planes = DisplayPlanes (dpyinfo->display,
-                                 XScreenNumberOfScreen (dpyinfo->screen));
+  if (dpyinfo->visual_info.class != TrueColor
+      && dpyinfo->visual_info.class != DirectColor)
+    return make_fixnum (dpyinfo->visual_info.colormap_size);
 
-  /* Truncate nr_planes to 24 to avoid integer overflow.
-     Some displays says 32, but only 24 bits are actually significant.
+  int nr_planes = dpyinfo->n_planes;
+
+  /* Truncate nr_planes to 24 to avoid integer overflow.  Some
+     displays says 32, but only 24 bits are actually significant.
      There are only very few and rare video cards that have more than
-     24 significant bits.  Also 24 bits is more than 16 million colors,
-     it "should be enough for everyone".  */
+     24 significant bits.  Also 24 bits is more than 16 million
+     colors, it "should be enough for everyone".  */
   if (nr_planes > 24) nr_planes = 24;
 
   return make_fixnum (1 << nr_planes);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]