unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10397: [PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround
@ 2011-12-29 14:05 Daniel Colascione
  2011-12-29 16:13 ` Juanma Barranquero
  2011-12-30  1:04 ` Jason Rumney
  0 siblings, 2 replies; 22+ messages in thread
From: Daniel Colascione @ 2011-12-29 14:05 UTC (permalink / raw)
  To: 10397

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






^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-12-13  0:04 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-29 14:05 bug#10397: [PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround Daniel Colascione
2011-12-29 16:13 ` Juanma Barranquero
2011-12-29 16:23   ` Daniel Colascione
2011-12-29 16:27     ` Juanma Barranquero
2011-12-29 16:42       ` Daniel Colascione
2011-12-29 16:45         ` Juanma Barranquero
2011-12-29 22:59           ` Daniel Colascione
2011-12-29 23:10             ` Juanma Barranquero
2011-12-29 23:13               ` Daniel Colascione
2011-12-29 23:18                 ` Juanma Barranquero
2011-12-30  3:07             ` Juanma Barranquero
2011-12-30  3:18               ` Daniel Colascione
2011-12-30  8:51                 ` Eli Zaretskii
2011-12-30  9:00                 ` Eli Zaretskii
2011-12-30 12:24                   ` Juanma Barranquero
2012-08-07 17:13                     ` Eli Zaretskii
2012-08-07 17:33                       ` Daniel Colascione
2012-08-07 18:07                         ` Eli Zaretskii
2016-02-25  6:25                         ` Lars Ingebrigtsen
2016-12-13  0:04                           ` Glenn Morris
2011-12-30  1:04 ` Jason Rumney
2011-12-30  1:10   ` Daniel Colascione

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).