From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: x-display-pixel-width/height inconsistency Date: Thu, 21 Mar 2013 08:28:33 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <87vc8nyoat.fsf@yandex.ru> <8738vrq67p.fsf@yandex.ru> <87vc8metkw.fsf@yandex.ru> <8738vqyxnt.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1363822123 6522 80.91.229.3 (20 Mar 2013 23:28:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Mar 2013 23:28:43 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 21 00:29:09 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UISRP-0002Fp-3L for ged-emacs-devel@m.gmane.org; Thu, 21 Mar 2013 00:29:07 +0100 Original-Received: from localhost ([::1]:57637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UISR1-0003gw-Ri for ged-emacs-devel@m.gmane.org; Wed, 20 Mar 2013 19:28:43 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UISQy-0003go-IO for emacs-devel@gnu.org; Wed, 20 Mar 2013 19:28:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UISQw-0005HR-Fb for emacs-devel@gnu.org; Wed, 20 Mar 2013 19:28:40 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:52451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UISQv-0005H5-VM for emacs-devel@gnu.org; Wed, 20 Mar 2013 19:28:38 -0400 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id AABB1C055D; Thu, 21 Mar 2013 08:28:33 +0900 (JST) In-Reply-To: <8738vqyxnt.fsf@yandex.ru> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 133.82.132.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158008 Archived-At: >>>>> On Wed, 20 Mar 2013 18:05:10 +0400, Dmitry Gutov said: >> What happens if you replace `CreateDC ("DISPLAY", NULL, NULL, >> NULL)' in the patch with `CreateDC (TEXT ("DISPLAY"), NULL, NULL, >> NULL)' ? > That doesn't seem to change anything, either. Hmm, what about the following one? And could someone who is familiar with the W32 (or NS) port help us make these functions consistent with the X11 version? Otherwise elisp programs that use these common functions (unconsciously) relying on platform-specific behavior will not work as intended on other platforms. (Actually, some users have sent me "bug reports" that the behavior of display-pixel-width/height on the Mac port is "wrong" for the reason that they do not return the same values as the NS port, whereas those in the Mac port behave consistently with those in X11.) YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp === modified file 'src/w32fns.c' --- src/w32fns.c 2013-03-20 11:29:37 +0000 +++ src/w32fns.c 2013-03-20 23:19:20 +0000 @@ -4733,11 +4733,11 @@ HDC hdc; int cap; - hdc = GetDC (dpyinfo->root_window); + hdc = GUI_FN (CreateDC) (GUISTR ("DISPLAY"), NULL, NULL, NULL); cap = GetDeviceCaps (hdc, VERTSIZE); - ReleaseDC (dpyinfo->root_window, hdc); + DeleteDC (hdc); return make_number (cap); } @@ -4754,11 +4754,11 @@ HDC hdc; int cap; - hdc = GetDC (dpyinfo->root_window); + hdc = GUI_FN (CreateDC) (GUISTR ("DISPLAY"), NULL, NULL, NULL); cap = GetDeviceCaps (hdc, HORZSIZE); - ReleaseDC (dpyinfo->root_window, hdc); + DeleteDC (hdc); return make_number (cap); } === modified file 'src/w32term.c' --- src/w32term.c 2013-03-15 10:07:29 +0000 +++ src/w32term.c 2013-03-20 23:10:16 +0000 @@ -515,18 +515,18 @@ int x_display_pixel_height (struct w32_display_info *dpyinfo) { - HDC dc = GetDC (NULL); + HDC dc = GUI_FN (CreateDC) (GUISTR ("DISPLAY"), NULL, NULL, NULL); int pixels = GetDeviceCaps (dc, VERTRES); - ReleaseDC (NULL, dc); + DeleteDC (dc); return pixels; } int x_display_pixel_width (struct w32_display_info *dpyinfo) { - HDC dc = GetDC (NULL); + HDC dc = GUI_FN (CreateDC) (GUISTR ("DISPLAY"), NULL, NULL, NULL); int pixels = GetDeviceCaps (dc, HORZRES); - ReleaseDC (NULL, dc); + DeleteDC (dc); return pixels; }