From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#10397: [PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround Date: Thu, 29 Dec 2011 17:13:25 +0100 Message-ID: References: <69c9ec930ef1d48655624d437aa66d0fce275d3e.1325166766.git.dancol@dancol.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1325175264 25796 80.91.229.12 (29 Dec 2011 16:14:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 29 Dec 2011 16:14:24 +0000 (UTC) Cc: 10397@debbugs.gnu.org To: Daniel Colascione Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 29 17:14:20 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RgIcV-0005Zx-Em for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Dec 2011 17:14:19 +0100 Original-Received: from localhost ([::1]:48782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgIcU-0001F7-JO for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Dec 2011 11:14:18 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:39051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgIcS-0001Ed-4G for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2011 11:14:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RgIcN-0006q8-SQ for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2011 11:14:16 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgIcN-0006q4-Qq for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2011 11:14:11 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RgIf8-0005Gp-5h for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2011 11:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Dec 2011 16:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10397 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 10397-submit@debbugs.gnu.org id=B10397.132517542020248 (code B ref 10397); Thu, 29 Dec 2011 16:17:02 +0000 Original-Received: (at 10397) by debbugs.gnu.org; 29 Dec 2011 16:17:00 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RgIf6-0005GX-0q for submit@debbugs.gnu.org; Thu, 29 Dec 2011 11:17:00 -0500 Original-Received: from mail-pz0-f44.google.com ([209.85.210.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RgIf3-0005GP-N3 for 10397@debbugs.gnu.org; Thu, 29 Dec 2011 11:16:58 -0500 Original-Received: by dajz8 with SMTP id z8so9188076daj.3 for <10397@debbugs.gnu.org>; Thu, 29 Dec 2011 08:14:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=soMwXNjCaq7de3biBEWrshL5tCZeBgSBM5cIdzu1ctQ=; b=BfNGkr6oZ74jP4r7CGPD6lDK7fpeFOEXVvcD8Q5lZLA4jlZT+hT+5pl9hHYgxMbrwh ydMdqHwgQcaWcRVfgH0OlZqvc/WNE+kroSlPb6OEQ/txxf59cZ2GX/rxsbhn/aDgxZAu a5A3QvWAm8ziCplvBB8fiTVoYiuL8Y34ti1yk= Original-Received: by 10.68.73.165 with SMTP id m5mr85438173pbv.108.1325175246212; Thu, 29 Dec 2011 08:14:06 -0800 (PST) Original-Received: by 10.142.247.28 with HTTP; Thu, 29 Dec 2011 08:13:25 -0800 (PST) In-Reply-To: <69c9ec930ef1d48655624d437aa66d0fce275d3e.1325166766.git.dancol@dancol.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 29 Dec 2011 11:17:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55272 Archived-At: On Thu, Dec 29, 2011 at 15:05, Daniel Colascione 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 =3D=3D=3D 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 =3D GetDeviceCaps (hdc, SIZEPALETTE); else - cap =3D GetDeviceCaps (hdc, NUMCOLORS); + { + cap =3D 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 =3D=3D 20) + cap =3D -1; + } /* We force 24+ bit depths to 24-bit, both to prevent an overflow > + =C2=A0 =C2=A0// GetDeviceCaps (NUMCOLORS) is buggy under remote desktop= and sometimes > + =C2=A0 =C2=A0// returns the number of system reserved colors (20) inste= ad of > + =C2=A0 =C2=A0// the actual number of available colors. Please, don't use "C++ / modern C" style comments; use /* */ instead. =C2=A0 =C2=A0 Juanma