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: Wed, 20 Mar 2013 09:20:21 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <87vc8nyoat.fsf@yandex.ru> <8738vrq67p.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 1363738838 26761 80.91.229.3 (20 Mar 2013 00:20:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Mar 2013 00:20:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 20 01:21:04 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 1UI6m7-0005gy-33 for ged-emacs-devel@m.gmane.org; Wed, 20 Mar 2013 01:21:03 +0100 Original-Received: from localhost ([::1]:34136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI6lj-0001fm-NK for ged-emacs-devel@m.gmane.org; Tue, 19 Mar 2013 20:20:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI6lb-0001ff-JA for emacs-devel@gnu.org; Tue, 19 Mar 2013 20:20:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UI6lW-0001sO-2H for emacs-devel@gnu.org; Tue, 19 Mar 2013 20:20:31 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:53120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI6lV-0001rw-G3 for emacs-devel@gnu.org; Tue, 19 Mar 2013 20:20:25 -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 BAB8FC055D; Wed, 20 Mar 2013 09:20:21 +0900 (JST) In-Reply-To: <8738vrq67p.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:157971 Archived-At: >>>>> On Wed, 20 Mar 2013 04:12:58 +0400, Dmitry Gutov said: >> Thanks for checking. Does the following patch give dimensions of >> all physical monitors as in X11? Do display-mm-height/width return >> meaningful values? > Sorry, can't apply the patch, `bzr patch' says > bzr: ERROR: Error invoking patch: Invalid argument > If you resend it in unified format, I can try to apply it manually. You can convert the format from context diff to unified diff using C-c C-u in diff-mode. Anyway, I resend the patch. > Without the patch, display-mm-height/width return some values, same > on both monitors, but I can't tell how they relate to x-display-* > functions. Please also try display-mm-height/width after applying the patch. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp === modified file 'src/w32fns.c' --- src/w32fns.c 2013-03-10 22:55:25 +0000 +++ src/w32fns.c 2013-03-19 23:47:14 +0000 @@ -4732,15 +4732,10 @@ If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - struct w32_display_info *dpyinfo = check_x_display_info (display); - HDC hdc; - int cap; - - hdc = GetDC (dpyinfo->root_window); + HDC hdc = CreateDC ("DISPLAY", NULL, NULL, NULL); + int cap = GetDeviceCaps (hdc, VERTSIZE); - cap = GetDeviceCaps (hdc, VERTSIZE); - - ReleaseDC (dpyinfo->root_window, hdc); + DeleteDC (hdc); return make_number (cap); } @@ -4752,16 +4747,10 @@ If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - struct w32_display_info *dpyinfo = check_x_display_info (display); - - HDC hdc; - int cap; - - hdc = GetDC (dpyinfo->root_window); - - cap = GetDeviceCaps (hdc, HORZSIZE); + HDC hdc = CreateDC ("DISPLAY", NULL, NULL, NULL); + int 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-19 23:47:25 +0000 @@ -515,18 +515,18 @@ int x_display_pixel_height (struct w32_display_info *dpyinfo) { - HDC dc = GetDC (NULL); + HDC dc = CreateDC ("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 = CreateDC ("DISPLAY", NULL, NULL, NULL); int pixels = GetDeviceCaps (dc, HORZRES); - ReleaseDC (NULL, dc); + DeleteDC (dc); return pixels; }