From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#10397: [PATCH] Under Remote Desktop, NUMCOLORS is unreliable; workaround Date: Thu, 29 Dec 2011 08:23:50 -0800 Message-ID: <4EFC9416.6090005@dancol.org> References: <69c9ec930ef1d48655624d437aa66d0fce275d3e.1325166766.git.dancol@dancol.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig6EF818CAE123F88A897ABCF1" X-Trace: dough.gmane.org 1325175870 30091 80.91.229.12 (29 Dec 2011 16:24:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 29 Dec 2011 16:24:30 +0000 (UTC) Cc: 10397@debbugs.gnu.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 29 17:24:22 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 1RgImB-0005Zd-0Z for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Dec 2011 17:24:19 +0100 Original-Received: from localhost ([::1]:34578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgImA-0008My-HT for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Dec 2011 11:24:18 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:50538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgIm4-0008MP-Ca for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2011 11:24:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RgIm3-00007P-AY for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2011 11:24:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgIm3-00007J-5K for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2011 11:24:11 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RgIon-0005VM-Mj for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2011 11:27:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Dec 2011 16:27:01 +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.132517601221145 (code B ref 10397); Thu, 29 Dec 2011 16:27:01 +0000 Original-Received: (at 10397) by debbugs.gnu.org; 29 Dec 2011 16:26:52 +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 1RgIoe-0005Uz-5G for submit@debbugs.gnu.org; Thu, 29 Dec 2011 11:26:52 -0500 Original-Received: from dancol.org ([96.126.100.184]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RgIob-0005Us-Qp for 10397@debbugs.gnu.org; Thu, 29 Dec 2011 11:26:50 -0500 Original-Received: from c-24-18-179-193.hsd1.wa.comcast.net ([24.18.179.193] helo=[192.168.1.2]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1RgIlq-0007zK-K5; Thu, 29 Dec 2011 08:23:58 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: X-Enigmail-Version: 1.3.4 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 29 Dec 2011 11:27:01 -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:55274 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6EF818CAE123F88A897ABCF1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/29/11 8:13 AM, Juanma Barranquero wrote: > On Thu, Dec 29, 2011 at 15:05, Daniel Colascione wr= ote: >=20 >> The workaround >> seems harmless: on non-palettized displays, calculating the number of >> display colors based on display bitness should produce good results. >=20 > Even so, why fix what is not broken? Why can't you just do >=20 > =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; > + } Why? What's the point of adding the extra complexity? Setting cap to -1 leads to this line 1 << min (dpyinfo->n_planes * dpyinfo->n_cbits, 24); which produces a reasonable result for direct color displays. Why keep using NUMCOLORS, which we know to be broken? > /* We force 24+ bit depths to 24-bit, both to prevent an overflow >=20 >> + // GetDeviceCaps (NUMCOLORS) is buggy under remote desktop and so= metimes >> + // returns the number of system reserved colors (20) instead of >> + // the actual number of available colors. >=20 > Please, don't use "C++ / modern C" style comments; use /* */ instead. >=20 That block slipped through. --------------enig6EF818CAE123F88A897ABCF1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAk78lBwACgkQ17c2LVA10Vv9QQCfY8xo8g026phR1lOSTzlpI+sE AmQAnRXyoCKYwAkeUdijyVii3DE8I2Z6 =hEBS -----END PGP SIGNATURE----- --------------enig6EF818CAE123F88A897ABCF1--