GNU bug report logs - #10397
[PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround

Previous Next

Package: emacs;

Reported by: Daniel Colascione <dancol <at> dancol.org>

Date: Thu, 29 Dec 2011 14:10:02 UTC

Severity: normal

Tags: patch

Fixed in version 24.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Glenn Morris <rgm <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#10397: closed ([PATCH] Under Remote Desktop, NUMCOLORS is
 unreliable; workaround)
Date: Tue, 13 Dec 2016 00:05:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 12 Dec 2016 19:04:42 -0500
with message-id <rreg1cofs5.fsf <at> fencepost.gnu.org>
and subject line Re: bug#10397: [PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround
has caused the debbugs.gnu.org bug report #10397,
regarding [PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
10397: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10397
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Daniel Colascione <dancol <at> dancol.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround
Date: Thu, 29 Dec 2011 06:05:53 -0800
Under remote desktop, Windows returns the wrong number of colors from
GetDeviceCaps (hdc, NUMCOLORS).  I hit this bug myself, and MSDN
comments seem to indicate that others hit it as well.  The workaround
seems harmless: on non-palettized displays, calculating the number of
display colors based on display bitness should produce good results.
---
 src/w32fns.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/w32fns.c b/src/w32fns.c
index 822e353..4b94f16 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4510,7 +4510,10 @@ If omitted or nil, that stands for the selected frame's display.  */)
   if (dpyinfo->has_palette)
     cap = GetDeviceCaps (hdc, SIZEPALETTE);
   else
-    cap = GetDeviceCaps (hdc, NUMCOLORS);
+    // GetDeviceCaps (NUMCOLORS) is buggy under remote desktop and sometimes
+    // returns the number of system reserved colors (20) instead of
+    // the actual number of available colors.
+    cap = -1;
 
   /* We force 24+ bit depths to 24-bit, both to prevent an overflow
      and because probably is more meaningful on Windows anyway */
-- 
1.7.5.1



[Message part 3 (message/rfc822, inline)]
From: Glenn Morris <rgm <at> gnu.org>
To: 10397-done <at> debbugs.gnu.org
Subject: Re: bug#10397: [PATCH] Under Remote Desktop, NUMCOLORS is unreliable;
 workaround
Date: Mon, 12 Dec 2016 19:04:42 -0500
Version: 24.3

I see this was fixed in emacs-24.2-3079-g821812e.



This bug report was last modified 8 years and 240 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.