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
View this message in rfc822 format
> Date: Thu, 29 Dec 2011 19:18:13 -0800
> From: Daniel Colascione <dancol <at> dancol.org>
> Cc: 10397 <at> debbugs.gnu.org
>
> > NUMCOLORS
> > Number of entries in the device's color table, if the device has a
> > color depth of no more than 8 bits per pixel. For devices with greater
> > color depths, 1 is returned.
> >
> > (It says "1", but it's a typo for "-1".)
>
> Good catch. What about this (untested) code?
>
> hdc = GetDC (dpyinfo->root_window);
> if (dpyinfo->has_palette)
> cap = GetDeviceCaps (hdc, SIZEPALETTE);
> else if (dpyinfo->n_cbits <= 8)
> /* According to the MSDN, GetDeviceCaps (NUMCOLORS) is valid only
> for devices with at most eight bits per pixel. It's supposed
> to return -1 for other displays, but because it actually
> returns other, incorrect values under some conditions (e.g.,
> remote desktop), only use it when we know it's valid. */
> cap = GetDeviceCaps (hdc, NUMCOLORS);
> else
> cap = -1;
Looks good to me. I think this could go into 24.1, unless Jason
(or someone else) objects.
As I wrote elsewhere, past 24.1, we could explore the possibility of
not calling GetDeviceCaps here at all (assuming that using the number
of planes and bits per plane does the job even when the latter is 8 or
less).
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.