From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.bugs Subject: bug#21173: 25.0.50; New frames positioned off screen with multiple monitors Date: Tue, 27 Oct 2015 21:53:23 +0000 Message-ID: <86h9lcou5o.fsf@gmail.com> References: <874mkjadqx.fsf@gmail.com> <55BCA4B1.8030103@gmx.at> <55BCEAA5.9020406@gmx.at> <55BF0E7D.1070007@gmx.at> <86k2s0v97i.fsf@gmail.com> <56137EDB.1020801@gmx.at> <56288487.9020202@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1445982926 20358 80.91.229.3 (27 Oct 2015 21:55:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 Oct 2015 21:55:26 +0000 (UTC) To: 21173@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 27 22:55:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ZrCD3-0004EW-Go for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Oct 2015 22:55:13 +0100 Original-Received: from localhost ([::1]:34572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrCD2-0000SU-TM for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Oct 2015 17:55:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrCCy-0000MS-4m for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2015 17:55:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrCCt-0000Zn-5l for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2015 17:55:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrCCt-0000Zj-2F for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2015 17:55:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZrCCs-0003Bs-P9 for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2015 17:55:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <874mkjadqx.fsf@gmail.com> Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Oct 2015 21:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21173 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.144598284212178 (code B ref -1); Tue, 27 Oct 2015 21:55:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Oct 2015 21:54:02 +0000 Original-Received: from localhost ([127.0.0.1]:40910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZrCBt-0003AI-DB for submit@debbugs.gnu.org; Tue, 27 Oct 2015 17:54:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46481) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZrCBr-0003AA-1p for submit@debbugs.gnu.org; Tue, 27 Oct 2015 17:53:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrCBp-0000D5-Ne for submit@debbugs.gnu.org; Tue, 27 Oct 2015 17:53:58 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrCBp-0000D0-LY for submit@debbugs.gnu.org; Tue, 27 Oct 2015 17:53:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrCBo-0000Gp-N5 for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2015 17:53:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrCBj-0000A0-OS for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2015 17:53:56 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:58114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrCBj-00008k-Gz for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2015 17:53:51 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZrCBf-00033a-68 for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2015 22:53:47 +0100 Original-Received: from 82-69-64-228.dsl.in-addr.zen.co.uk ([82.69.64.228]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Oct 2015 22:53:47 +0100 Original-Received: from andrewjmoreton by 82-69-64-228.dsl.in-addr.zen.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Oct 2015 22:53:47 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 98 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 82-69-64-228.dsl.in-addr.zen.co.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt) Cancel-Lock: sha1:qJiyROy03tkbyXfpWBOUMRt/RdI= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.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:108087 Archived-At: --=-=-= Content-Type: text/plain On Thu 22 Oct 2015, martin rudalics wrote: >> This patch fixes the problem for me under Windows. Many thanks to Andy >> Moreton! Since Andy reports that negative X offsets also happen under >> the X Window system, should this also be fixed in function >> x_calc_absolute_position in src/term.c? > > Thanks for testing, Francis. AFAICT nobody reported a similar problem > on X so far. So Andy please resend us your patch as attachment and > provide some suitable ChangeLog entry and I will install it (unless you > can already do that yourself). > > Thanks, martin Hopefully this reply includes a suiteably formatted patch. AndyM --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-frame-position-with-multiple-monitors-Bug-21173.patch Content-Description: multimon patch >From 7aa74f58b14061493dda5a23256eaf4e4af405c4 Mon Sep 17 00:00:00 2001 From: Andy Moreton Date: Tue, 27 Oct 2015 21:47:06 +0000 Subject: [PATCH] Fix frame position with multiple monitors (Bug#21173) * src/w32term.c (x_calc_absolute_position): Find display origin to allow for negative coordinates. --- src/w32term.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/w32term.c b/src/w32term.c index 831786726792..fb4135830708 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -5913,16 +5913,49 @@ x_calc_absolute_position (struct frame *f) top_bottom_borders_height = 32; } + /* With multiple monitors, we can legitimately get negative + coordinates (for monitors above or to the left of the primary + monitor). Find the display origin to ensure negative positions + are computed correctly (Bug#21173). */ + int display_left = 0; + int display_top = 0; + if (flags & (XNegative | YNegative)) + { + Lisp_Object list; + + list = Fw32_display_monitor_attributes_list (FRAME_X_DISPLAY (f)); + while (CONSP (list)) + { + Lisp_Object attributes = CAR(list); + Lisp_Object geometry; + Lisp_Object monitor_left, monitor_top; + + list = CDR(list); + + geometry = Fassoc (Qgeometry, attributes); + if (!NILP (geometry)) + { + monitor_left = Fnth (make_number (1), geometry); + monitor_top = Fnth (make_number (2), geometry); + + display_left = min (display_left, XINT (monitor_left)); + display_top = min (display_top, XINT (monitor_top)); + } + } + } + /* Treat negative positions as relative to the rightmost bottommost position that fits on the screen. */ if (flags & XNegative) f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) + + display_left - FRAME_PIXEL_WIDTH (f) + f->left_pos - (left_right_borders_width - 1)); if (flags & YNegative) f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) + + display_top - FRAME_PIXEL_HEIGHT (f) + f->top_pos - (top_bottom_borders_height - 1)); -- 2.5.3 --=-=-=--