From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ralf Angeli Newsgroups: gmane.emacs.devel Subject: display-mm-width return value off on Windows Date: Thu, 06 Jul 2006 19:50:26 +0200 Organization: nil Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1152208304 27637 80.91.229.2 (6 Jul 2006 17:51:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 Jul 2006 17:51:44 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 06 19:51:42 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FyY0b-0007hI-VD for ged-emacs-devel@m.gmane.org; Thu, 06 Jul 2006 19:51:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FyY0b-0000mH-78 for ged-emacs-devel@m.gmane.org; Thu, 06 Jul 2006 13:51:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FyY0M-0000ls-Cf for emacs-devel@gnu.org; Thu, 06 Jul 2006 13:51:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FyY0L-0000lg-LI for emacs-devel@gnu.org; Thu, 06 Jul 2006 13:51:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FyY0L-0000la-GP for emacs-devel@gnu.org; Thu, 06 Jul 2006 13:51:09 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FyY0Z-0005Cb-V4 for emacs-devel@gnu.org; Thu, 06 Jul 2006 13:51:24 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FyY04-0007YC-AL for emacs-devel@gnu.org; Thu, 06 Jul 2006 19:50:52 +0200 Original-Received: from p54a504d1.dip0.t-ipconnect.de ([84.165.4.209]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 Jul 2006 19:50:52 +0200 Original-Received: from angeli by p54a504d1.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 Jul 2006 19:50:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 86 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: p54a504d1.dip0.t-ipconnect.de Cancel-Lock: sha1:G2yWHKsyv0UFlXwY8hDjkyAsYjY= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:56648 Archived-At: --=-=-= On Windows the return values of `display-mm-width' and `display-mm-height' don't really reflect the screen width and height in millimeters. I attached a patch which yields more realistic results. In my case: display-mm-* display-mm-* Real size without patch with patch Width 285mm 370 279 Height 215mm 277 203 For a preview-latex user who originally reported the problem: display-mm-* display-mm-* Real size without patch with patch Width 330mm 320 305 Height 207mm 240 203 The original report described that images generated by preview-latex (which uses `display-mm-{width,height}' for that matter) are distorted horizontally (see bug report at ). In my case these images were too small compared to the font size (see bug report with screenshot at ). With the patch applied both of these problems get better. -- Ralf --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Index: w32fns.c =================================================================== RCS file: /sources/emacs/emacs/src/w32fns.c,v retrieving revision 1.271 diff -c -r1.271 w32fns.c --- w32fns.c 30 Jun 2006 13:40:21 -0000 1.271 +++ w32fns.c 6 Jul 2006 17:47:53 -0000 @@ -6502,15 +6502,16 @@ { struct w32_display_info *dpyinfo = check_x_display_info (display); HDC hdc; - int cap; + int height; hdc = GetDC (dpyinfo->root_window); - cap = GetDeviceCaps (hdc, VERTSIZE); + height = round (GetDeviceCaps (hdc, VERTRES) + / GetDeviceCaps (hdc, LOGPIXELSY) * 25.4); ReleaseDC (dpyinfo->root_window, hdc); - return make_number (cap); + return make_number (height); } DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, @@ -6524,15 +6525,16 @@ struct w32_display_info *dpyinfo = check_x_display_info (display); HDC hdc; - int cap; + int width; hdc = GetDC (dpyinfo->root_window); - cap = GetDeviceCaps (hdc, HORZSIZE); + width = round (GetDeviceCaps (hdc, HORZRES) + / GetDeviceCaps (hdc, LOGPIXELSX) * 25.4); ReleaseDC (dpyinfo->root_window, hdc); - return make_number (cap); + return make_number (width); } DEFUN ("x-display-backing-store", Fx_display_backing_store, --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--