GNU bug report logs -
#10397
[PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround
Previous Next
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
Message #8 received at 10397 <at> debbugs.gnu.org (full text, mbox):
On Thu, Dec 29, 2011 at 15:05, Daniel Colascione <dancol <at> dancol.org> wrote:
> The workaround
> seems harmless: on non-palettized displays, calculating the number of
> display colors based on display bitness should produce good results.
Even so, why fix what is not broken? Why can't you just do
=== modified file 'src/w32fns.c'
--- src/w32fns.c 2011-12-04 08:02:42 +0000
+++ src/w32fns.c 2011-12-29 16:10:33 +0000
@@ -4511,5 +4511,12 @@
cap = GetDeviceCaps (hdc, SIZEPALETTE);
else
- cap = GetDeviceCaps (hdc, NUMCOLORS);
+ {
+ 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. */
+ if (cap == 20)
+ cap = -1;
+ }
/* We force 24+ bit depths to 24-bit, both to prevent an overflow
> + // 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.
Please, don't use "C++ / modern C" style comments; use /* */ instead.
Juanma
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.