From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: x-display-pixel-width/height inconsistency Date: Wed, 08 May 2013 20:41:39 +0300 Message-ID: <83vc6tcqss.fsf@gnu.org> References: <514A5DE1.10009@gmx.de> <831ub767wf.fsf@gnu.org> <83mwtu4p7c.fsf@gnu.org> <83vc8h313t.fsf@gnu.org> <5073D6B8-95E4-4012-AA74-106F428379DC@swipnet.se> <8BD4B041-5A3F-4D7C-AFD3-E997E194AA9D@swipnet.se> <02B98FCD-71DB-47EC-B58B-41A2539FF61A@swipnet.se> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1368034916 611 80.91.229.3 (8 May 2013 17:41:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 May 2013 17:41:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 08 19:41:54 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 1Ua8NF-0004ZZ-EO for ged-emacs-devel@m.gmane.org; Wed, 08 May 2013 19:41:53 +0200 Original-Received: from localhost ([::1]:41384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua8NF-0005du-3P for ged-emacs-devel@m.gmane.org; Wed, 08 May 2013 13:41:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua8NA-0005dj-6L for emacs-devel@gnu.org; Wed, 08 May 2013 13:41:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ua8N7-0005s8-RP for emacs-devel@gnu.org; Wed, 08 May 2013 13:41:48 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:40760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua8N7-0005rR-Jv for emacs-devel@gnu.org; Wed, 08 May 2013 13:41:45 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MMH00A00QFXRB00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Wed, 08 May 2013 20:41:43 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MMH00ACAQHIHS70@a-mtaout21.012.net.il>; Wed, 08 May 2013 20:41:43 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.169 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:159434 Archived-At: > Date: Wed, 08 May 2013 19:46:51 +0900 > From: YAMAMOTO Mitsuharu > > I also tried implementing a W32 version of multi-monitor support, but > I can't test it (I didn't even compile, actually). Please test it. You need more changes to get this to compile, see the patches below that should be applied on top of what you sent. After that, the code seems to work on my single-monitor system. (I don't have access to any multi-monitor machines.) Thanks. P.S. Is it possible to use something more elegant to pass a parameter to w32_monitor_enum? The way you did it, by casting a Lisp_Object to a LPARAM, will not work when the width of a Lisp_Object is different from the width of a pointer. And even when it does work, it feels kludgey. P.P.S. Would you mind to also add the necessary documentation changes, like NEWS and additions to the ELisp manual? TIA. --- src/w32fns.c~0 2013-05-08 20:19:43.313375000 +0300 +++ src/w32fns.c 2013-05-08 20:31:52.704000000 +0300 @@ -4909,7 +4909,8 @@ w32_display_monitor_attributes_list (voi && monitor_from_window_fn)) return Qnil; - if (!enum_display_monitors_fn (NULL, NULL, w32_monitor_enum, &monitor_list) + if (!enum_display_monitors_fn (NULL, NULL, w32_monitor_enum, + (LPARAM)&monitor_list) || NILP (monitor_list)) return Qnil; @@ -4929,8 +4930,7 @@ w32_display_monitor_attributes_list (voi { struct frame *f = XFRAME (frame); - if (FRAME_W32_P (f) && FRAME_W32_DISPLAY_INFO (f) == dpyinfo - && !EQ (frame, tip_frame)) + if (FRAME_W32_P (f) && !EQ (frame, tip_frame)) { HMONITOR monitor = monitor_from_window_fn (FRAME_W32_WINDOW (f), @@ -4994,29 +4994,29 @@ w32_display_monitor_attributes_list (voi static Lisp_Object w32_display_monitor_attributes_list_fallback (void) { - Lisp_Object geometry, workarea, frames, attributes = Qnil; + Lisp_Object geometry, workarea, frames, rest, frame, attributes = Qnil; HDC hdc; double mm_per_pixel; int pixel_width, pixel_height, width_mm, height_mm; RECT workarea_rect; + struct w32_display_info *dpyinfo; + struct frame *f = XFRAME (frame); /* Fallback: treat (possibly) multiple physical monitors as if they formed a single monitor as a whole. This should provide a consistent result at least on single monitor environments. */ - attributes = Fcons (Fcons (Qname, build_string ("combined screen"), - attributes)); + attributes = Fcons (Fcons (Qname, build_string ("combined screen")), + attributes); frames = Qnil; FOR_EACH_FRAME (rest, frame) { - struct frame *f = XFRAME (frame); - - if (FRAME_W32_P (f) && FRAME_W32_DISPLAY_INFO (f) == dpyinfo - && !EQ (frame, tip_frame)) + if (FRAME_W32_P (f) && !EQ (frame, tip_frame)) frames = Fcons (frame, frames); } attributes = Fcons (Fcons (Qframes, frames), attributes); + dpyinfo = FRAME_W32_DISPLAY_INFO (f); pixel_width = x_display_pixel_width (dpyinfo); pixel_height = x_display_pixel_height (dpyinfo);