From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2017 15:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 26816@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.149416993324216 (code B ref -1); Sun, 07 May 2017 15:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 May 2017 15:12:13 +0000 Received: from localhost ([127.0.0.1]:60469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7Nr3-0006IW-L6 for submit@debbugs.gnu.org; Sun, 07 May 2017 11:12:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7Nr1-0006II-Fw for submit@debbugs.gnu.org; Sun, 07 May 2017 11:12:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7Nqv-0001kq-GX for submit@debbugs.gnu.org; Sun, 07 May 2017 11:12:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43156) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d7Nqv-0001km-DI for submit@debbugs.gnu.org; Sun, 07 May 2017 11:12:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7Nqu-0002wx-CN for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 11:12:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7Nqr-0001jz-6h for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 11:12:04 -0400 Received: from [195.159.176.226] (port=54301 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d7Nqq-0001jV-W1 for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 11:12:01 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1d7Nqi-0004HC-VR for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 17:11:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: "Charles A. Roelli" Date: Sun, 7 May 2017 17:11:52 +0200 Lines: 41 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 X-Mozilla-News-Host: news://news.gmane.org:119 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) As far as I know, mouse movement by Emacs has never worked in OS X. The following change to frame_set_mouse_pixel_position allows you to move the mouse from Lisp: diff --git a/src/nsterm.m b/src/nsterm.m index c22c5a7..e81b7ee 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2322,14 +2322,14 @@ so some key presses (TAB) are swallowed by the system. */ { NSTRACE ("frame_set_mouse_pixel_position"); ns_raise_frame (f); -#if 0 - /* FIXME: this does not work, and what about GNUstep? */ + /* FIXME: what about GNUstep? */ #ifdef NS_IMPL_COCOA [FRAME_NS_VIEW (f) lockFocus]; - PSsetmouse ((float)pix_x, (float)pix_y); + CGPoint mouse_pos = CGPointMake(f->left_pos + pix_x, + f->top_pos + pix_y); + CGWarpMouseCursorPosition (mouse_pos); [FRAME_NS_VIEW (f) unlockFocus]; #endif -#endif } static int (test with (set-mouse-position (selected-frame) 0 0)) Still some things to fix: With a portrait monitor to the left of the main monitor (the left monitor being in the negative x-coord. space), running the above test code on a single frame inside the left monitor leaves the mouse pointer about half a frame further down than the bottom-left corner of the frame. The pointer should end up in the top-left corner. Also, tested only in 10.6, but it should work in later versions. From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2017 16:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Charles A. Roelli" Cc: 26816@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.14941759087875 (code B ref 26816); Sun, 07 May 2017 16:52:02 +0000 Received: (at 26816) by debbugs.gnu.org; 7 May 2017 16:51:48 +0000 Received: from localhost ([127.0.0.1]:60548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7PPQ-00022x-J1 for submit@debbugs.gnu.org; Sun, 07 May 2017 12:51:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51297) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7PPO-00022h-2U for 26816@debbugs.gnu.org; Sun, 07 May 2017 12:51:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7PPF-0004VR-RU for 26816@debbugs.gnu.org; Sun, 07 May 2017 12:51:40 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7PPF-0004VN-Ne; Sun, 07 May 2017 12:51:37 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4200 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d7PPF-0003oN-22; Sun, 07 May 2017 12:51:37 -0400 Date: Sun, 07 May 2017 19:51:16 +0300 Message-Id: <83fuggehkr.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (charles@aurox.ch) References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: "Charles A. Roelli" > Date: Sun, 7 May 2017 17:11:52 +0200 > > As far as I know, mouse movement by Emacs has never worked in OS X. > > The following change to frame_set_mouse_pixel_position allows you to > move the mouse from Lisp: Thanks. Can you also add a test for this feature? I think this also warrants a NEWS entry. From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2017 18:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Charles A. Roelli" , 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149418047014838 (code B ref 26816); Sun, 07 May 2017 18:08:02 +0000 Received: (at 26816) by debbugs.gnu.org; 7 May 2017 18:07:50 +0000 Received: from localhost ([127.0.0.1]:60616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7Qb0-0003rG-Ms for submit@debbugs.gnu.org; Sun, 07 May 2017 14:07:50 -0400 Received: from mout.gmx.net ([212.227.15.18]:50622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7Qay-0003qy-MY for 26816@debbugs.gnu.org; Sun, 07 May 2017 14:07:49 -0400 Received: from [192.168.1.101] ([213.162.68.31]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MN0jA-1d9eaU3OJs-006eyI; Sun, 07 May 2017 20:07:34 +0200 Message-ID: <590F6261.4000006@gmx.at> Date: Sun, 07 May 2017 20:07:29 +0200 From: martin rudalics MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:8f/bB5vpFO1w68K4lu+jRovmCnWUUofLOGBQItf/YNNzw3Z91YR wetxLsQxBTSp3vaOkRCG2nq1duSyp/dH3+8N+HW579iQHxMKtmrhFl2LpUHDzZlylgDaEaA bUv1m+4raadXk4avgSlQFnYajLlX4hNIK193lT1QDsypRFRMdLrfPFCcIUAmtzWD8nrKY6N l5yzXjoj3vNWMmSys3BNw== X-UI-Out-Filterresults: notjunk:1;V01:K0:dnL3AGZht80=:/r+xjTtAYgyfhrzifDP+al 4NdKbtPIzvP7ielQLdqlecLFP2dZ47akI3r+nGfg9HjWVsxiVr/WAh+8HYmfwfSew48dq9bFV j/gBPC5vJyvX8ceDttzv44OEkKaTEVX1fFbtyTfNUmUCW8oOtrSzMoBSkTtZNsZE3OYRo6XFQ vn/bgOhTCSbku6XiOauDFSOII/O1lUfPlEuBPEP83R/UJ4lqU3OvZr2qu9KA4a95sU4SMCCJ+ 09PB0AD/e1mEp2mUfv9WH3pDbKekbMo8D82caA0BFjyK+CXiipyztLoWUCnxVc/sp6Qqs3xMx Qu+LlYdQVZYLbZyz8IS2bP3zr7z/Eq04acKJSBcEM2MstjZ3chq2geOe2a+rJ5KDsttBm40ds WunewYMHnQrpK2yvlZHffa2RfciujVDmie3SpwCx5srKx+JNhjaP7VSnk+IMWENMVjviQZ41U UxsKCGArckCG0Q30z0m9ChU3p/nQU+NyZ8mgpH1tzORF0LVZH/FVC1MSPgVXAQdXc0wmuU3t4 9hBqNBvmHHiE/Z79ZJXuvY1z4KIwBupVopPuyDuCv5NZMd4Eoagb2lY0eeQYRnEDOMgiN9Fd5 TwWx63wwFGeNfgHoYv63rYbh8hRZLTRkJPEtXuLEjU4zcDGZKTwXEk+xj4GJwLKFgK251Gi+L yZNVMYgB0crQn9ilxyMNojetzQUv4BbXxhkQEHft5EWCQq+/5dP3wzqv3WDqd/dAHr3uWn/Du JLmIoD9E9KVBYqA0oUDEZSBizI1dd15LlWUeu3FXBJglQ9U/U2bT42PGnq1e0v0Oyyi82yVyG rQ/0PsZ X-Spam-Score: -3.5 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.5 (---) > Still some things to fix: It would be nice to have =E2=80=98set-mouse-absolute-pixel-position=E2=80= =99 on NS too. Thanks, martin From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2017 20:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Charles A. Roelli" Cc: 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149418724514043 (code B ref 26816); Sun, 07 May 2017 20:01:02 +0000 Received: (at 26816) by debbugs.gnu.org; 7 May 2017 20:00:45 +0000 Received: from localhost ([127.0.0.1]:60783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7SMH-0003eQ-4p for submit@debbugs.gnu.org; Sun, 07 May 2017 16:00:45 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:35127) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7SMF-0003eC-Q2 for 26816@debbugs.gnu.org; Sun, 07 May 2017 16:00:44 -0400 Received: by mail-wr0-f179.google.com with SMTP id z52so29169152wrc.2 for <26816@debbugs.gnu.org>; Sun, 07 May 2017 13:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=z/9Ixycx/LYlQd6UMbHXpUggd8IbMp2Hl/AT93Yb1qk=; b=YMQIi4myb/SdqFGiSOCFPSx7g7pHm6J2e+/1slRew6pyrOySj/FOjjZdbGNVNAhSg4 ZFEQn8dYyD9n3ZQ01uhFqrIYkCLJTaDxCWBDDx/AdFzd09XMHRbJi+tn+JxnY5GGJEcl 6bkTxD/vqW89nRUdVIS1U5C08UPyKxG1Kl8YNn8hSsJYQ/dluy1cA/9oTq9I2JWFU9Jt M7Z2UBT8QByV00uYqFkP6Eb8IWSrDIXZQR1d9lNVciy4HXNSneL4oDSc/aEi7XDbwTth LJXn0MHj5nqS9jqHB0wwU2kmNEYeJ+9nHTCxwQqUQ+01h2gtvv5KQtxSDO4YCzyD2Jjh GZ5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=z/9Ixycx/LYlQd6UMbHXpUggd8IbMp2Hl/AT93Yb1qk=; b=m64qSRdQc0toqYcZAtML3sCGwt+BPpo39cyCKWNHcAU4DJR4tgCsShlS2w373bdWlp Bkh5OJlqfS8ALxhiwaOEDk1M7ms3HImfc/WXlwk3n/seSpJxRuFoGSYLhi7AFimyIcF/ z16pqkPojvcyw7ME/DyFbDQqAosQ25UxU9fwGxq+uWOc0evkhE7JZ+ThWBngjNTZO1He SHjFyEuYqbdRVTJxj2Mb4Z7Dk0kOz0TC9oqgbrzw480RallhfLIy/nGAOscoNF0vnl4M sxJQs7zFBL/396Ar1ZpVBp5c4Ez20OUs5SeNUaVDubYbd5cmRtQRuT8vK8aOnmG1nZeJ ZRiw== X-Gm-Message-State: AN3rC/43XtB6cl03DjTQverV0pt0xxSu9WvmWz99eERU6ndRFFDCRnba aqm8nBknUuzAcVU0zcE= X-Received: by 10.223.148.35 with SMTP id 32mr29752470wrq.175.1494187237838; Sun, 07 May 2017 13:00:37 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-002b-ce19-f74c-0f07.holly.idiocy.org. [2001:8b0:3f8:8129:2b:ce19:f74c:f07]) by smtp.gmail.com with ESMTPSA id w17sm9681185wme.13.2017.05.07.13.00.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 May 2017 13:00:36 -0700 (PDT) Date: Sun, 7 May 2017 21:00:34 +0100 From: Alan Third Message-ID: <20170507200034.GA661@breton.holly.idiocy.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) On Sun, May 07, 2017 at 05:11:52PM +0200, Charles A. Roelli wrote: > As far as I know, mouse movement by Emacs has never worked in OS X. > > The following change to frame_set_mouse_pixel_position allows you to move > the mouse from Lisp: > > diff --git a/src/nsterm.m b/src/nsterm.m > index c22c5a7..e81b7ee 100644 > --- a/src/nsterm.m > +++ b/src/nsterm.m > @@ -2322,14 +2322,14 @@ so some key presses (TAB) are swallowed by the > system. */ > { > NSTRACE ("frame_set_mouse_pixel_position"); > ns_raise_frame (f); > -#if 0 > - /* FIXME: this does not work, and what about GNUstep? */ > + /* FIXME: what about GNUstep? */ > #ifdef NS_IMPL_COCOA > [FRAME_NS_VIEW (f) lockFocus]; AFAICT this call to lockFocus isn’t required. It should tie subsequent actions to the NSView, however CGWarpMouseCursorPosition always uses the global screen space. > - PSsetmouse ((float)pix_x, (float)pix_y); > + CGPoint mouse_pos = CGPointMake(f->left_pos + pix_x, > + f->top_pos + pix_y); > + CGWarpMouseCursorPosition (mouse_pos); > [FRAME_NS_VIEW (f) unlockFocus]; Same with unlockFocus. > (test with (set-mouse-position (selected-frame) 0 0)) set-mouse-position takes coordinates in characters, so (0, 0) should, I think, be below the title and tool bars. You should be able to just add (or subtract?) FRAME_NS_TITLEBAR_HEIGHT and FRAME_TOOLBAR_HEIGHT to get it in the right place. Unless I’ve misunderstood it. > Still some things to fix: > > With a portrait monitor to the left of the main monitor (the left monitor > being in the negative x-coord. space), running the above test code on a > single frame inside the left monitor leaves the mouse pointer about half a > frame further down than the bottom-left corner of the frame. The pointer > should end up in the top-left corner. Does this mean that the top of the portrait monitor is higher than the top of the main monitor? It might be that NS_PARENT_WINDOW_TOP_POS isn’t taking that extra height into account. #define NS_PARENT_WINDOW_TOP_POS(f) \ (FRAME_PARENT_FRAME (f) != NULL \ ? ([[FRAME_NS_VIEW (f) window] parentWindow].frame.origin.y \ + [[FRAME_NS_VIEW (f) window] parentWindow].frame.size.height \ - FRAME_NS_TITLEBAR_HEIGHT (FRAME_PARENT_FRAME (f))) \ : [[[FRAME_NS_VIEW (f) window] screen] frame].size.height) That last line just takes the screen’s height, and I guess that’s wrong. It should probably be the top left co‐ord (origin.y + size.height)? -- Alan Third From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 May 2017 18:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.14942685055148 (code B ref 26816); Mon, 08 May 2017 18:36:02 +0000 Received: (at 26816) by debbugs.gnu.org; 8 May 2017 18:35:05 +0000 Received: from localhost ([127.0.0.1]:60039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7nUv-0001Ky-8M for submit@debbugs.gnu.org; Mon, 08 May 2017 14:35:05 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:43267) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7nUt-0001KJ-Oj for 26816@debbugs.gnu.org; Mon, 08 May 2017 14:35:04 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id ABF9C22420 for <26816@debbugs.gnu.org>; Mon, 8 May 2017 18:30:44 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1494268242; x= 1495132243; bh=YPGKoB7xrCYoEjyGcQU/no7JVdvOz3Y7D/FAFLYkeoU=; b=O K+mZpk5OZTSK6+jACgD0rN1RKxRqzC+MgvDmmhFlurV+L7XS06F6gDdZ8X4YJnd8 q6ANTjRm+oemmpTJAzchZudlhNCXwmQdyLWKd98F/b9OOYK9hW1+3OG0cu+fQ3YN B4vranTA6SlXEyeaXp5WVcbGkjiyWIT37fxR5vH3/4= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 8OZZ5klSP5Fn for <26816@debbugs.gnu.org>; Mon, 8 May 2017 18:30:42 +0000 (UTC) Received: from [192.168.1.106] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id A2D6122151; Mon, 8 May 2017 18:30:40 +0000 (UTC) References: <83fuggehkr.fsf@gnu.org> From: "Charles A. Roelli" Message-ID: <747b2d94-03c8-44a4-ee1b-d93e831143c8@aurox.ch> Date: Mon, 8 May 2017 20:34:56 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <83fuggehkr.fsf@gnu.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) >> Date: Sun, 7 May 2017 17:11:52 +0200 >> >> As far as I know, mouse movement by Emacs has never worked in OS X. >> >> The following change to frame_set_mouse_pixel_position allows you to >> move the mouse from Lisp: > Thanks. Can you also add a test for this feature? Do you mean an automated test? If so, where might this go in the source tree? > I think this also warrants a NEWS entry. Sure, I will add one in my next revision of the patch. From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 May 2017 18:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Charles A. Roelli" Cc: 26816@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.14942696766844 (code B ref 26816); Mon, 08 May 2017 18:55:01 +0000 Received: (at 26816) by debbugs.gnu.org; 8 May 2017 18:54:36 +0000 Received: from localhost ([127.0.0.1]:60059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7nno-0001mJ-GJ for submit@debbugs.gnu.org; Mon, 08 May 2017 14:54:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7nnm-0001m6-Fi for 26816@debbugs.gnu.org; Mon, 08 May 2017 14:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7nne-0003kz-AV for 26816@debbugs.gnu.org; Mon, 08 May 2017 14:54:29 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7nne-0003kp-88; Mon, 08 May 2017 14:54:26 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2342 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d7nnd-0004mj-6N; Mon, 08 May 2017 14:54:25 -0400 Date: Mon, 08 May 2017 21:54:07 +0300 Message-Id: <834lwvch80.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <747b2d94-03c8-44a4-ee1b-d93e831143c8@aurox.ch> (charles@aurox.ch) References: <83fuggehkr.fsf@gnu.org> <747b2d94-03c8-44a4-ee1b-d93e831143c8@aurox.ch> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Cc: 26816@debbugs.gnu.org > From: "Charles A. Roelli" > Date: Mon, 8 May 2017 20:34:56 +0200 > > > Thanks. Can you also add a test for this feature? > > Do you mean an automated test? Yes. > If so, where might this go in the source tree? Under the test/ subdirectory. > > I think this also warrants a NEWS entry. > > Sure, I will add one in my next revision of the patch. Thanks. From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 May 2017 19:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third Cc: 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149435698012400 (code B ref 26816); Tue, 09 May 2017 19:10:01 +0000 Received: (at 26816) by debbugs.gnu.org; 9 May 2017 19:09:40 +0000 Received: from localhost ([127.0.0.1]:34478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8AVw-0003Dw-FZ for submit@debbugs.gnu.org; Tue, 09 May 2017 15:09:40 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:44115) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8AVu-0003Di-9k for 26816@debbugs.gnu.org; Tue, 09 May 2017 15:09:39 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 02E0D22413 for <26816@debbugs.gnu.org>; Tue, 9 May 2017 19:05:20 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:references:to :subject:subject:from:from; s=dkim; t=1494356718; x=1495220719; bh=HvChgZtYxb7Jpi9WCblirlMt227SzOR8NOv09nqWa9g=; b=fgx4AS6kXLv9 eZsE4eWDvJ7D1g3cJTdvl1A4PEmA0p4yiob3KkzALAl0rTyRbuWKquuVA7KynNov cTJEg36jPU81fkLgYYnG6woaLWTov3X0u5Nvip2ceGJ7djBKroyNOCK002twStdv /NoqT4C9JJkp8x3fiWmU2Tczm8ZCSlQ= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id BNLBH8jnPEjs for <26816@debbugs.gnu.org>; Tue, 9 May 2017 19:05:18 +0000 (UTC) Received: from [192.168.1.106] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id B6F1422151; Tue, 9 May 2017 19:05:17 +0000 (UTC) From: "Charles A. Roelli" References: <20170507200034.GA661@breton.holly.idiocy.org> Message-ID: Date: Tue, 9 May 2017 21:09:29 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170507200034.GA661@breton.holly.idiocy.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 07/05/2017 22:00, Alan Third wrote: >> diff --git a/src/nsterm.m b/src/nsterm.m >> index c22c5a7..e81b7ee 100644 >> --- a/src/nsterm.m >> +++ b/src/nsterm.m >> @@ -2322,14 +2322,14 @@ so some key presses (TAB) are swallowed by the >> system. */ >> { >> NSTRACE ("frame_set_mouse_pixel_position"); >> ns_raise_frame (f); >> -#if 0 >> - /* FIXME: this does not work, and what about GNUstep? */ >> + /* FIXME: what about GNUstep? */ >> #ifdef NS_IMPL_COCOA >> [FRAME_NS_VIEW (f) lockFocus]; > AFAICT this call to lockFocus isn’t required. It should tie subsequent > actions to the NSView, however CGWarpMouseCursorPosition always uses > the global screen space. > >> - PSsetmouse ((float)pix_x, (float)pix_y); >> + CGPoint mouse_pos = CGPointMake(f->left_pos + pix_x, >> + f->top_pos + pix_y); >> + CGWarpMouseCursorPosition (mouse_pos); >> [FRAME_NS_VIEW (f) unlockFocus]; > Same with unlockFocus. > >> (test with (set-mouse-position (selected-frame) 0 0)) > set-mouse-position takes coordinates in characters, so (0, 0) should, > I think, be below the title and tool bars. You should be able to just > add (or subtract?) FRAME_NS_TITLEBAR_HEIGHT and FRAME_TOOLBAR_HEIGHT > to get it in the right place. > > Unless I’ve misunderstood it. Right, right and right: I got rid of the [un]lockFocus calls, and added in the adjustments for the toolbar height and titlebar height. After this, moving the mouse to position x, y with: (set-mouse-position (selected-frame) x y) results in a call to (mouse-position) returning ( x . y) -- except for the specific case I mentioned (see below). I'm still working on the patch, and will send a new one in the next few days. >> Still some things to fix: >> >> With a portrait monitor to the left of the main monitor (the left monitor >> being in the negative x-coord. space), running the above test code on a >> single frame inside the left monitor leaves the mouse pointer about half a >> frame further down than the bottom-left corner of the frame. The pointer >> should end up in the top-left corner. > Does this mean that the top of the portrait monitor is higher than the > top of the main monitor? Yes. For reference, this is what (display-monitor-attributes-list) gives in Emacs 25.2: (((name . "Color LCD") (geometry 0 0 1280 800) (workarea 0 22 1280 714) (mm-size 290 180) (frames # #) (source . "NS")) ((name . "DELL 2007WFP") (geometry -1050 -880 1050 1680) (workarea -1050 -880 1050 1680) (mm-size 430 270) (frames #) (source . "NS"))) With the frame in the taller monitor as mentioned, after calling (set-mouse-position (selected-frame) 0 0), (mouse-position) returns (# 0 . 55), which happens to be about 800 pixels from the place where it should end up (i.e. it sounds like the calculation is off the mark by the height of the primary monitor). > It might be that NS_PARENT_WINDOW_TOP_POS > isn’t taking that extra height into account. > > #define NS_PARENT_WINDOW_TOP_POS(f) \ > (FRAME_PARENT_FRAME (f) != NULL \ > ? ([[FRAME_NS_VIEW (f) window] parentWindow].frame.origin.y \ > + [[FRAME_NS_VIEW (f) window] parentWindow].frame.size.height \ > - FRAME_NS_TITLEBAR_HEIGHT (FRAME_PARENT_FRAME (f))) \ > : [[[FRAME_NS_VIEW (f) window] screen] frame].size.height) > > That last line just takes the screen’s height, and I guess that’s > wrong. It should probably be the top left co‐ord (origin.y + > size.height)? > I ran NS_PARENT_WINDOW_TOP_POS(f) on the frame in the taller monitor as described, and it always returned 1680. I tried adding ([[[FRAME_NS_VIEW (f) window] screen] frame].origin.y) to the last line in the macro you mentioned, but this must always be returning zero, because it made no difference and the macro still returned 1680. From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 May 2017 22:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Charles A. Roelli" Cc: 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.14943698867289 (code B ref 26816); Tue, 09 May 2017 22:45:02 +0000 Received: (at 26816) by debbugs.gnu.org; 9 May 2017 22:44:46 +0000 Received: from localhost ([127.0.0.1]:34729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8Ds5-0001tU-L0 for submit@debbugs.gnu.org; Tue, 09 May 2017 18:44:45 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:35819) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8Ds4-0001tI-Bs for 26816@debbugs.gnu.org; Tue, 09 May 2017 18:44:44 -0400 Received: by mail-wr0-f181.google.com with SMTP id z52so19298366wrc.2 for <26816@debbugs.gnu.org>; Tue, 09 May 2017 15:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=IPO93bN6ZmpXR15+zoWMmPxprtrhYf0Tjrhldr/fCNI=; b=MPX/E+iu6QN/t2ENVJUN5bPyTiDWlRl1pxu+sTXxhRkxNQBt3kyDZhj1c0iwn8+1Xa pRpXajxU7+v3ixh2lBl0zso/WjEG5sH7cTMiSaYAb9fW4KrLubw2g8a7BDTo/LDtEmaB JzsmpUrAv0KNkachikHhM1oNNKPx01l/PKq7W3l97HaDt5PFGn+RzGixCqGHdpDfExAs hhPeKtYxSpb/840+8RsEWLyh+Uxz55gFn3B2SwbAFg7mflbTBFwUmI8fJeKH4cehHyKO pcN0FciiXVgFc4yluXYF5OqAKlGHuOKc0ILgpSO/I0cZy9N45oChhki83FirTq64V2mg qoxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=IPO93bN6ZmpXR15+zoWMmPxprtrhYf0Tjrhldr/fCNI=; b=PKjjCzBF4XBhH+Vi4PU0gfNe1S4v1UmW7TLSGSXHasrmocNLTOKXKoNUYNuVNJUi5V qObVTSMdzrWY3fWkGkfxQLaLU2jRZdQGNDfwALnxDN7Jfcwf2ppE4q2A0hgEK1aAvPyc qoCCVf66gmOhVrkfCmsP57jwIjtOIrzC5dJsqWvgs9zErW5MIdsDm+pmDim43KxWprz4 /qlmu6W+c2+Wy5GsDTRkjhCh4X0cF1tybXU0wC+8hs/gPM7gWleiU/PGBNJvUDrPNR4b agp7YRda/6r/oUeGUfi5SS2Kx3nYO8ToxwctbQVVEpbloO2u8oEVKVauk8WVOi1U76lI CF/Q== X-Gm-Message-State: AODbwcCIfhAlAEfx2Zk5K5gqIj4Fw0BaiNvM41BicukdTZUmyR2bIOSa UIUtlCofB9ke305nhM4= X-Received: by 10.223.139.20 with SMTP id n20mr1606501wra.169.1494369878619; Tue, 09 May 2017 15:44:38 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-002b-ce19-f74c-0f07.holly.idiocy.org. [2001:8b0:3f8:8129:2b:ce19:f74c:f07]) by smtp.gmail.com with ESMTPSA id u200sm2331679wmd.16.2017.05.09.15.44.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 May 2017 15:44:37 -0700 (PDT) Date: Tue, 9 May 2017 23:44:35 +0100 From: Alan Third Message-ID: <20170509224435.GB8974@breton.holly.idiocy.org> References: <20170507200034.GA661@breton.holly.idiocy.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) On Tue, May 09, 2017 at 09:09:29PM +0200, Charles A. Roelli wrote: > With the frame in the taller monitor as mentioned, after calling > (set-mouse-position (selected-frame) 0 0), (mouse-position) returns (# *scratch* 0x1058883a8> 0 . 55), which happens to be about 800 pixels from > the place where it should end up (i.e. it sounds like the calculation is off > the mark by the height of the primary monitor). > > > It might be that NS_PARENT_WINDOW_TOP_POS > > isn’t taking that extra height into account. > > > > #define NS_PARENT_WINDOW_TOP_POS(f) \ > > (FRAME_PARENT_FRAME (f) != NULL \ > > ? ([[FRAME_NS_VIEW (f) window] parentWindow].frame.origin.y \ > > + [[FRAME_NS_VIEW (f) window] parentWindow].frame.size.height \ > > - FRAME_NS_TITLEBAR_HEIGHT (FRAME_PARENT_FRAME (f))) \ > > : [[[FRAME_NS_VIEW (f) window] screen] frame].size.height) > > > > That last line just takes the screen’s height, and I guess that’s > > wrong. It should probably be the top left co‐ord (origin.y + > > size.height)? > > > > I ran NS_PARENT_WINDOW_TOP_POS(f) on the frame in the taller monitor as > described, and it always returned 1680. I tried adding ([[[FRAME_NS_VIEW > (f) window] screen] frame].origin.y) to the last line in the macro you > mentioned, but this must always be returning zero, because it made no > difference and the macro still returned 1680. Hmm, this is harder than I first thought. Presumably (frame-position) returns nonsensical values on your portrait monitor, and (set-frame-position nil 0 0) also plants the frame in the wrong place (ie. not the top left)? Can you try changing that last line of NS_PARENT_WINDOW_TOP_POS to return NSScreen.screens[0].frame.size.height I *think* that should set the top left of the primary screen as (0, 0). If that works for this, there may be other places where we’re using window.screen that we’ll have to change to use the primary screen, but I’m not really sure. I wonder if it’ll break when ‘screens have separate spaces’ is turned on...? :/ Almost anything seems to work here, but I’m not using multiple monitors. -- Alan Third From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 May 2017 18:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third Cc: 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.14945259859949 (code B ref 26816); Thu, 11 May 2017 18:07:01 +0000 Received: (at 26816) by debbugs.gnu.org; 11 May 2017 18:06:25 +0000 Received: from localhost ([127.0.0.1]:39030 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8sTp-0002aO-J5 for submit@debbugs.gnu.org; Thu, 11 May 2017 14:06:25 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:45262) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8sTn-0002aA-0b for 26816@debbugs.gnu.org; Thu, 11 May 2017 14:06:23 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id D260C22420 for <26816@debbugs.gnu.org>; Thu, 11 May 2017 18:02:02 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1494525721; x= 1495389722; bh=zF1Cv9an+IZWBdCK6wRE6ElJiy578SbD29T110nZnhk=; b=A Zd2DfqDahjIAWTPv+O+5pKb5avfsEqf+epY20gegabtw12hEN2NNs9G/TfEIKWLC QKKs/owCqdX5v6eN5l0gAEBa1VRHf3NjD5WBY0I6QXKmSzNl13EKfI2atwJgdZYV qgj41AFctyAShOXwyfaN067QAhZBGMWi6Q1KRpfjWE= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 1Ivt0Yms9uXq for <26816@debbugs.gnu.org>; Thu, 11 May 2017 18:02:01 +0000 (UTC) Received: from [192.168.1.106] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 0EBEB22151; Thu, 11 May 2017 18:02:00 +0000 (UTC) References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> From: "Charles A. Roelli" Message-ID: Date: Thu, 11 May 2017 20:06:13 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170509224435.GB8974@breton.holly.idiocy.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) >> I ran NS_PARENT_WINDOW_TOP_POS(f) on the frame in the taller monitor as >> described, and it always returned 1680. I tried adding ([[[FRAME_NS_VIEW >> (f) window] screen] frame].origin.y) to the last line in the macro you >> mentioned, but this must always be returning zero, because it made no >> difference and the macro still returned 1680. > Hmm, this is harder than I first thought. > > Presumably (frame-position) returns nonsensical values on your > portrait monitor, and (set-frame-position nil 0 0) also plants the > frame in the wrong place (ie. not the top left)? (set-frame-position nil 0 0) places the frame in the top-left corner of the primary monitor for me in Emacs 25.2. (frame-position) with the frame in the top-left corner of the secondary monitor reports (-1050 . -880). I'm not sure: is this expected behavior? > Can you try changing that last line of NS_PARENT_WINDOW_TOP_POS to > return > > NSScreen.screens[0].frame.size.height > > I *think* that should set the top left of the primary screen as (0, > 0). If that works for this, there may be other places where we’re > using window.screen that we’ll have to change to use the primary > screen, but I’m not really sure. > > I wonder if it’ll break when ‘screens have separate spaces’ is turned > on...? :/ > > Almost anything seems to work here, but I’m not using multiple > monitors. > I made the line say [[[NSScreen screens] objectAtIndex: 0] frame].size.height (equivalent to what you wrote) and the mouse can now be set to a position in the frame as expected. Thanks for your help with this. This now reminds me of a related problem, though: with Emacs 25.2 (or in Emacs 26, with the above change applied to NS_PARENT_WINDOW_TOP_POS(f)), tooltips originating from an area with a help-echo property (like "Lisp Interaction" in the mode line in emacs -Q) in a frame on the secondary monitor actually show up in the primary monitor instead -- as if the tooltip frame is constrained to having a positive x-coordinate only. I haven't found where it happens, but I guess the cause is similar. From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 May 2017 21:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Charles A. Roelli" Cc: 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.14945390335099 (code B ref 26816); Thu, 11 May 2017 21:44:01 +0000 Received: (at 26816) by debbugs.gnu.org; 11 May 2017 21:43:53 +0000 Received: from localhost ([127.0.0.1]:39265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8vsH-0001KB-C6 for submit@debbugs.gnu.org; Thu, 11 May 2017 17:43:53 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:36587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8vsG-0001Jy-1t for 26816@debbugs.gnu.org; Thu, 11 May 2017 17:43:52 -0400 Received: by mail-wr0-f179.google.com with SMTP id l50so31508636wrc.3 for <26816@debbugs.gnu.org>; Thu, 11 May 2017 14:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=jE4oPv187sL8pyG4TylOuScF4crWiufwEYmmOYQJVCA=; b=KhQavcwpsToai/eQYR9C8Ok97OCFAUIUHP0/l/nFTJSwSprgQlbH0Xu+WRN/hTHG5j 9GMsMLA0wsYGzZs7QX6hJs9SlleXtJMlzuhdJONKiVaF0ndoNFpCb/d9EvlskIh0KyKB CsDUQBTDPvPvMY6nyVrbk38Yfzp5oHKN9FwXZTF0hN9xdl9X5tDr9rGkkiC56U0nHlof xxsI1FgQIb5gGJnfUJykwWyBtUfAwkF7cJsUMMLEIRbudxWxdKtPMi3Ub13JSKwmFUW2 rFuewokMpI/8+YtTppkIblEw+yCv6dMQmJHd6x1nYTIEjhN57T7fsJbW4ISRrvnBi10r BA/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=jE4oPv187sL8pyG4TylOuScF4crWiufwEYmmOYQJVCA=; b=RfswyBMVEnkUIPjbtlDQSM9sNN6O8kwwHBonEuqZKjVtJocfoYuAkb5ig+hmiwlmxn dxJWLWYeF9fRzWALOX5UFqhwS7u3+8jvVmz1KIE7DPDp8Eu4FYWYqei7lgQHfSgh42Lk hC8j/xvpNc8yjqSWEhtvUPhPH2KBhaRVZX+bCEb74Gg1P4Uy/HwI6bn9GjWD/8KaZbSS lWQhzDD8kWz5tx1FYonqotA74lRnVnjghyYVrWg7wswiLH07YoiM+Ty104/hCdL/3Syd ufAGHEhbdMimr05/Y10r7f/ysLcnAEZzYqyRKu9LMNcytyIm8ToVQ2JiVWKlFR+715RL NbuA== X-Gm-Message-State: AODbwcCjs8E/B0nJPbFdcDg+CiQTeoO2jz8bQUoBN2IkqkS+8tNLrwC2 yWxU91W2hg7YPEO5ZMc= X-Received: by 10.223.133.35 with SMTP id 32mr428166wrh.200.1494539025712; Thu, 11 May 2017 14:43:45 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-dc3e-4bdc-b913-fd48.holly.idiocy.org. [2001:8b0:3f8:8129:dc3e:4bdc:b913:fd48]) by smtp.gmail.com with ESMTPSA id l29sm1842262wmi.8.2017.05.11.14.43.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 May 2017 14:43:44 -0700 (PDT) Date: Thu, 11 May 2017 22:43:42 +0100 From: Alan Third Message-ID: <20170511214342.GA10431@breton.holly.idiocy.org> References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) On Thu, May 11, 2017 at 08:06:13PM +0200, Charles A. Roelli wrote: > > Presumably (frame-position) returns nonsensical values on your > > portrait monitor, and (set-frame-position nil 0 0) also plants the > > frame in the wrong place (ie. not the top left)? > > (set-frame-position nil 0 0) places the frame in the top-left corner of the > primary monitor for me in Emacs 25.2. (frame-position) with the frame in > the top-left corner of the secondary monitor reports (-1050 . -880). > > I'm not sure: is this expected behavior? It’s what I’d expect with the below modification to NS_PARENT_WINDOW_TOP_POS, so if Emacs 25 does that too then I’m happy. I was thinking that without the modification, Emacs 26 would do strange things, just like it did with positioning the mouse pointer. > I made the line say [[[NSScreen screens] objectAtIndex: 0] > frame].size.height (equivalent to what you wrote) and the mouse can > now be set to a position in the frame as expected. Thanks for your > help with this. Thank you for working on it. Besides, I introduced this particular bug. > This now reminds me of a related problem, though: with Emacs 25.2 (or in > Emacs 26, with the above change applied to NS_PARENT_WINDOW_TOP_POS(f)), > tooltips originating from an area with a help-echo property (like "Lisp > Interaction" in the mode line in emacs -Q) in a frame on the secondary > monitor actually show up in the primary monitor instead -- as if the tooltip > frame is constrained to having a positive x-coordinate only. I haven't > found where it happens, but I guess the cause is similar. Look at compute_tip_xy in nsfns.m. It moves tooltips into the positive screen space. I’ve not managed to get to grips with this code yet. I think what we want is for it to try to keep the tooltip on one screen, so it’s not spanning two monitors, but allow it to go into negative space. Perhaps this should be a separate bug report. -- Alan Third From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 May 2017 13:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third Cc: martin rudalics , 26816@debbugs.gnu.org, Eli Zaretskii Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149476861327284 (code B ref 26816); Sun, 14 May 2017 13:31:01 +0000 Received: (at 26816) by debbugs.gnu.org; 14 May 2017 13:30:13 +0000 Received: from localhost ([127.0.0.1]:43697 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9tbA-000760-Mp for submit@debbugs.gnu.org; Sun, 14 May 2017 09:30:13 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:47104) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9tb8-00074l-JO for 26816@debbugs.gnu.org; Sun, 14 May 2017 09:30:11 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 5247C22428 for <26816@debbugs.gnu.org>; Sun, 14 May 2017 13:25:46 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:references:to:subject:subject:from:from; s=dkim; t=1494768343; x=1495632344; bh=ui5WhodOl/2k9jX1vkZ2ByGk KM3rii7+HflBLQL8sA8=; b=NkJbfqTCBVDDY4ELXjxRjkfCLsB9ExFq2sE3QldI K7Xjn3qwEcnT+tabIDL/smm+KtS204bQVzdKYZM8zt9NmMeKQOzRCsx6K1fdBGZw mnFkWvVus/MDcjlpKA9KvuoqvlByq6S3W6zwp+0N49ObvmgdgylemazFk7w0bQGV 2aU= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vOBXaWj-jLbT for <26816@debbugs.gnu.org>; Sun, 14 May 2017 13:25:43 +0000 (UTC) Received: from [192.168.1.106] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id E6EFA22426; Sun, 14 May 2017 13:25:41 +0000 (UTC) From: "Charles A. Roelli" References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> <20170511214342.GA10431@breton.holly.idiocy.org> Message-ID: <3dc0d587-8290-f873-ceef-d059bec0b7f6@aurox.ch> Date: Sun, 14 May 2017 15:29:57 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170511214342.GA10431@breton.holly.idiocy.org> Content-Type: multipart/mixed; boundary="------------17CB9CA4E33926BDEA17CB13" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is a multi-part message in MIME format. --------------17CB9CA4E33926BDEA17CB13 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Attached is a patch now working with multiple monitors. I also added `ns-set-mouse-absolute-pixel-position', a test and a NEWS entry. The test works interactively, but it requires a frame to run and I'm not sure whether tests run with them by default. The code for handling the y-coord in `ns-set-mouse-absolute-pixel-position' is from `ns-display-monitor-attributes-list' (in the calculation of the screen geometry). I also made (set-mouse-absolute-pixel-position 0 0) put the mouse in the top-left corner of the current screen. I tried out both `set-mouse-position' and `set-mouse-absolute-pixel-position' on setups with the secondary monitor on the left, right, top and bottom, and they seem to work right. I also got rid of the call to `ns_raise_frame' in `frame_set_mouse_pixel_position', which is unnecessary. >> This now reminds me of a related problem, though: with Emacs 25.2 (or in >> Emacs 26, with the above change applied to NS_PARENT_WINDOW_TOP_POS(f)), >> tooltips originating from an area with a help-echo property (like "Lisp >> Interaction" in the mode line in emacs -Q) in a frame on the secondary >> monitor actually show up in the primary monitor instead -- as if the tooltip >> frame is constrained to having a positive x-coordinate only. I haven't >> found where it happens, but I guess the cause is similar. > Look at compute_tip_xy in nsfns.m. It moves tooltips into the positive > screen space. I’ve not managed to get to grips with this code yet. > > I think what we want is for it to try to keep the tooltip on one > screen, so it’s not spanning two monitors, but allow it to go into > negative space. > > Perhaps this should be a separate bug report. Done (#26905). --------------17CB9CA4E33926BDEA17CB13 Content-Type: text/x-patch; name="0001-mouse-movement-macos.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-mouse-movement-macos.patch" diff --git a/etc/NEWS b/etc/NEWS index 6667a44..25f0f18 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1292,6 +1292,9 @@ This is in contrast to the default action on POSIX Systems, where it causes the receiving process to terminate with a core dump if no debugger has been attached to it. +** `set-mouse-position' and `set-mouse-absolute-pixel-position' work +on macOS. + ---------------------------------------------------------------------- This file is part of GNU Emacs. diff --git a/lisp/frame.el b/lisp/frame.el index 05db8cf..02871e0 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1465,6 +1465,7 @@ mouse-absolute-pixel-position (t (cons 0 0))))) +(declare-function ns-set-mouse-absolute-pixel-position "nsfns.m" (x y)) (declare-function w32-set-mouse-absolute-pixel-position "w32fns.c" (x y)) (declare-function x-set-mouse-absolute-pixel-position "xfns.c" (x y)) @@ -1474,6 +1475,8 @@ set-mouse-absolute-pixel-position position (0, 0) of the selected frame's terminal." (let ((frame-type (framep-on-display))) (cond + ((eq frame-type 'ns) + (ns-set-mouse-absolute-pixel-position x y)) ((eq frame-type 'x) (x-set-mouse-absolute-pixel-position x y)) ((eq frame-type 'w32) diff --git a/src/nsfns.m b/src/nsfns.m index cbe0ffb..e916f6a 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -3053,6 +3053,44 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are : Qnative_edges)); } +DEFUN ("ns-set-mouse-absolute-pixel-position", + Fns_set_mouse_absolute_pixel_position, + Sns_set_mouse_absolute_pixel_position, 2, 2, 0, + doc: /* Move mouse pointer to absolute pixel position (X, Y). +The coordinates X and Y are interpreted in pixels relative to a position +\(0, 0) of the selected frame's display. */) + (Lisp_Object x, Lisp_Object y) +{ + struct frame *f = SELECTED_FRAME (); + EmacsView *view = FRAME_NS_VIEW (f); + NSScreen *screen = [[view window] screen]; + NSRect screen_frame = [screen frame]; + int mouse_x, mouse_y; + + NSScreen *primary_screen = [[NSScreen screens] objectAtIndex:0]; + NSRect primary_screen_frame = [primary_screen frame]; + CGFloat primary_screen_height = primary_screen_frame.size.height; + + if (FRAME_INITIAL_P (f) || !FRAME_NS_P (f)) + return Qnil; + + CHECK_TYPE_RANGED_INTEGER (int, x); + CHECK_TYPE_RANGED_INTEGER (int, y); + + mouse_x = screen_frame.origin.x + XINT (x); + + if (screen == primary_screen) + mouse_y = screen_frame.origin.y + XINT (y); + else + mouse_y = (primary_screen_height - screen_frame.size.height + - screen_frame.origin.y) + XINT (y); + + CGPoint mouse_pos = CGPointMake(mouse_x, mouse_y); + CGWarpMouseCursorPosition (mouse_pos); + + return Qnil; +} + /* ========================================================================== Class implementations @@ -3241,6 +3279,7 @@ - (NSString *)panel: (id)sender userEnteredFilename: (NSString *)filename defsubr (&Sns_frame_edges); defsubr (&Sns_frame_list_z_order); defsubr (&Sns_frame_restack); + defsubr (&Sns_set_mouse_absolute_pixel_position); defsubr (&Sx_display_mm_width); defsubr (&Sx_display_mm_height); defsubr (&Sx_display_screens); diff --git a/src/nsterm.h b/src/nsterm.h index 9285178..ac339bf 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1087,7 +1087,7 @@ struct x_output ? ([[FRAME_NS_VIEW (f) window] parentWindow].frame.origin.y \ + [[FRAME_NS_VIEW (f) window] parentWindow].frame.size.height \ - FRAME_NS_TITLEBAR_HEIGHT (FRAME_PARENT_FRAME (f))) \ - : [[[FRAME_NS_VIEW (f) window] screen] frame].size.height) + : [[[NSScreen screens] objectAtIndex: 0] frame].size.height) #define FRAME_NS_FONT_TABLE(f) (FRAME_DISPLAY_INFO (f)->font_table) diff --git a/src/nsterm.m b/src/nsterm.m index c22c5a7..a7ab73b 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2321,14 +2321,14 @@ so some key presses (TAB) are swallowed by the system. */ -------------------------------------------------------------------------- */ { NSTRACE ("frame_set_mouse_pixel_position"); - ns_raise_frame (f); -#if 0 - /* FIXME: this does not work, and what about GNUstep? */ + + /* FIXME: what about GNUstep? */ #ifdef NS_IMPL_COCOA - [FRAME_NS_VIEW (f) lockFocus]; - PSsetmouse ((float)pix_x, (float)pix_y); - [FRAME_NS_VIEW (f) unlockFocus]; -#endif + CGPoint mouse_pos = + CGPointMake(f->left_pos + pix_x, + f->top_pos + pix_y + + FRAME_NS_TITLEBAR_HEIGHT(f) + FRAME_TOOLBAR_HEIGHT(f)); + CGWarpMouseCursorPosition (mouse_pos); #endif } diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el index fffaa2f..c743df4 100644 --- a/test/lisp/mouse-tests.el +++ b/test/lisp/mouse-tests.el @@ -47,4 +47,12 @@ (should-not (mouse--down-1-maybe-follows-link)) (should (equal unread-command-events '((mouse-2 nil 1)))))) +(ert-deftest bug26816-mouse-frame-movement () + "Mouse moves relative to frame." + (let ((frame (selected-frame))) + (set-mouse-position frame 0 0) + (should (equal (mouse-position) + (cons frame (cons 0 0)))))) + + ;;; mouse-tests.el ends here --------------17CB9CA4E33926BDEA17CB13-- From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 May 2017 14:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Charles A. Roelli" Cc: martin rudalics , 26816@debbugs.gnu.org, Eli Zaretskii Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149477036130986 (code B ref 26816); Sun, 14 May 2017 14:00:03 +0000 Received: (at 26816) by debbugs.gnu.org; 14 May 2017 13:59:21 +0000 Received: from localhost ([127.0.0.1]:44849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9u3N-00083i-Jp for submit@debbugs.gnu.org; Sun, 14 May 2017 09:59:21 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:35141) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9u3M-00083V-0J for 26816@debbugs.gnu.org; Sun, 14 May 2017 09:59:20 -0400 Received: by mail-wr0-f177.google.com with SMTP id z52so65283872wrc.2 for <26816@debbugs.gnu.org>; Sun, 14 May 2017 06:59:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=LMVadZPvatpFpggmgr2WgkcccLxkd+xMR/w/JSaicV8=; b=R2kaCz5Hp3t2n6TvV0kK9ajwgAAwVQnL6mZBjV1MbfHw3zOLMLvP+EoSjbpmidQ1M3 MGat7OHgsqOdyfecM5XzVXRdH2Px6YfmCvxRK5rDd+IHeZfMCOTR9cuC429ftY9xyjwB Bh8eXl9PePVF5u7102rnb4aS4s0y14ProXPPGxn6s30zBGyXafgmFpXV+4+DmHNhFtDV u9Ff345M2kpD9m26MjytB7YNcQmTbuSAxqzfAO3/hjMzNae/GTYCj5WUxFSmhnnPrSkI q6MbHbB6RQSvfsQI80QeaqLwRIjX3KU5W3S2rhnmNEhe2lwSOs0ZDyaABVkS8N8hsFQw +0eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=LMVadZPvatpFpggmgr2WgkcccLxkd+xMR/w/JSaicV8=; b=rzTDy1DRD3GBZzQmo7PyXYiIXVO0EwGX6o0YaFH/qnMRlJr/JCF0mjIXAuNFOxpnYQ TXCXEHPXRxowxbjoElSgX/jRIQozWWZKmgnf00Yb38T3G1Udj29W6FwMvyTyU1QoASlh nzOVnUjmmgTjQZyeWj5/1leAbe072QkfCU1czaNBHKeKFdjvEkNRnCPSurONh8tC7AZ2 jdTLmzEhpOEy3cG8xxYEAMKwfwBh1f/2Fspdkfor/xhbu4yT1F/wGkkQB4PCwNXamUCl VbCrC7zFK9uNhPMoUic3rxE5eNfzuVLSUntzvUQMSfKJr+jFw2EDsnjTjrZkQuFXl9+o 7DTQ== X-Gm-Message-State: AODbwcDOtiO+Iletd1d5uQJTEkvqei3CzBKdIJS7IPNFOFpD3TVD8nwi NTUXUEePygGv3g== X-Received: by 10.223.168.97 with SMTP id l88mr1215685wrc.54.1494770354046; Sun, 14 May 2017 06:59:14 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-e9b1-3358-0f3c-df92.holly.idiocy.org. [2001:8b0:3f8:8129:e9b1:3358:f3c:df92]) by smtp.gmail.com with ESMTPSA id e187sm16712928wmf.31.2017.05.14.06.59.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 May 2017 06:59:12 -0700 (PDT) Date: Sun, 14 May 2017 14:59:10 +0100 From: Alan Third Message-ID: <20170514135910.GA13710@breton.holly.idiocy.org> References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> <20170511214342.GA10431@breton.holly.idiocy.org> <3dc0d587-8290-f873-ceef-d059bec0b7f6@aurox.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3dc0d587-8290-f873-ceef-d059bec0b7f6@aurox.ch> User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) On Sun, May 14, 2017 at 03:29:57PM +0200, Charles A. Roelli wrote: > Attached is a patch now working with multiple monitors. I also added > `ns-set-mouse-absolute-pixel-position', a test and a NEWS entry. The test > works interactively, but it requires a frame to run and I'm not sure whether > tests run with them by default. Usually you run tests with ’make check’, and there’s no frame available. I’ve just checked and it does throw up an error for that test. I’m not sure how that should be handled. > The code for handling the y-coord in `ns-set-mouse-absolute-pixel-position' > is from `ns-display-monitor-attributes-list' (in the calculation of the > screen geometry). I also made (set-mouse-absolute-pixel-position 0 0) put > the mouse in the top-left corner of the current screen. > > I tried out both `set-mouse-position' and > `set-mouse-absolute-pixel-position' on setups with the secondary monitor on > the left, right, top and bottom, and they seem to work right. > > I also got rid of the call to `ns_raise_frame' in > `frame_set_mouse_pixel_position', which is unnecessary. It all looks good to me. Leave this here a few days and if nobody complains push it to master. I’m not sure what to do about the test. If nobody offers a suggestion here, you could ask in emacs-devel. Thanks for working on this. -- Alan Third From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 May 2017 14:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third Cc: rudalics@gmx.at, 26816@debbugs.gnu.org, charles@aurox.ch Reply-To: Eli Zaretskii Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.14947727102169 (code B ref 26816); Sun, 14 May 2017 14:39:01 +0000 Received: (at 26816) by debbugs.gnu.org; 14 May 2017 14:38:30 +0000 Received: from localhost ([127.0.0.1]:44881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9ufF-0000Yu-Th for submit@debbugs.gnu.org; Sun, 14 May 2017 10:38:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35063) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9ufE-0000Yi-Vw for 26816@debbugs.gnu.org; Sun, 14 May 2017 10:38:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9uf8-0006nY-Lf for 26816@debbugs.gnu.org; Sun, 14 May 2017 10:38:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9uf2-0006kJ-AM; Sun, 14 May 2017 10:38:16 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1952 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d9uf1-0005yV-En; Sun, 14 May 2017 10:38:15 -0400 Date: Sun, 14 May 2017 17:37:58 +0300 Message-Id: <83y3tz7bcp.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <20170514135910.GA13710@breton.holly.idiocy.org> (message from Alan Third on Sun, 14 May 2017 14:59:10 +0100) References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> <20170511214342.GA10431@breton.holly.idiocy.org> <3dc0d587-8290-f873-ceef-d059bec0b7f6@aurox.ch> <20170514135910.GA13710@breton.holly.idiocy.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Date: Sun, 14 May 2017 14:59:10 +0100 > From: Alan Third > Cc: 26816@debbugs.gnu.org, martin rudalics , > Eli Zaretskii > > On Sun, May 14, 2017 at 03:29:57PM +0200, Charles A. Roelli wrote: > > Attached is a patch now working with multiple monitors. I also added > > `ns-set-mouse-absolute-pixel-position', a test and a NEWS entry. The test > > works interactively, but it requires a frame to run and I'm not sure whether > > tests run with them by default. > > Usually you run tests with ’make check’, and there’s no frame > available. There's always a frame, even in batch sessions. Observe: emacs -batch --eval "(message \"%s\" (selected-frame))" => # It's just that it's not a frame which this feature could use. > I’ve just checked and it does throw up an error for that > test. I’m not sure how that should be handled. You could explicitly test for non-interactive sessions, and skip the test, or display a message that this test can only be run interactively. Would that be good enough? From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 May 2017 18:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Alan Third Cc: rudalics@gmx.at, 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149487261519155 (code B ref 26816); Mon, 15 May 2017 18:24:01 +0000 Received: (at 26816) by debbugs.gnu.org; 15 May 2017 18:23:35 +0000 Received: from localhost ([127.0.0.1]:46898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAKed-0004yt-C9 for submit@debbugs.gnu.org; Mon, 15 May 2017 14:23:35 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:48120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAKec-0004yg-0S for 26816@debbugs.gnu.org; Mon, 15 May 2017 14:23:34 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 6089922432 for <26816@debbugs.gnu.org>; Mon, 15 May 2017 18:19:10 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:to:subject:subject; s=dkim; t=1494872347; x=1495736348; bh=NKbbZNyWuZ5iipLrnFGLxeMH ABBxi5VWXHZNUNGnY9g=; b=FmiUfR0Stmmb65qO29sMDVb30wXwagkkvBLSWZsB /Stwl9x0PcTY3dNSp2bHwhMCimvBfi2DFw7KqVuTSqViYUBe2h31XHEc+x7eyS6z 1Xl4rVNvdaU4Ot+GS13pWzE641Vau4ZPYwqtC3BsFpiMXyw7KoJdm8MPoU4trhL9 yAo= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LeuAemnnr31z for <26816@debbugs.gnu.org>; Mon, 15 May 2017 18:19:07 +0000 (UTC) Received: from [192.168.1.121] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 3F5EB22407; Mon, 15 May 2017 18:19:05 +0000 (UTC) References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> <20170511214342.GA10431@breton.holly.idiocy.org> <3dc0d587-8290-f873-ceef-d059bec0b7f6@aurox.ch> <20170514135910.GA13710@breton.holly.idiocy.org> <83y3tz7bcp.fsf@gnu.org> From: "Charles A. Roelli" Message-ID: <76527b19-1f31-0642-ac3a-8e55fd9b0a90@aurox.ch> Date: Mon, 15 May 2017 20:23:27 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <83y3tz7bcp.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------E360186C1A06C95F89B99723" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is a multi-part message in MIME format. --------------E360186C1A06C95F89B99723 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit I've added a `skip-unless' form to the beginning of the test: (skip-unless (display-graphic-p)) Seems to take care of the issue. Patch is attached, with a commit message. On 14/05/2017 16:37, Eli Zaretskii wrote: >> Date: Sun, 14 May 2017 14:59:10 +0100 >> From: Alan Third >> Cc: 26816@debbugs.gnu.org, martin rudalics , >> Eli Zaretskii >> >> On Sun, May 14, 2017 at 03:29:57PM +0200, Charles A. Roelli wrote: >>> Attached is a patch now working with multiple monitors. I also added >>> `ns-set-mouse-absolute-pixel-position', a test and a NEWS entry. The test >>> works interactively, but it requires a frame to run and I'm not sure whether >>> tests run with them by default. >> Usually you run tests with ’make check’, and there’s no frame >> available. > There's always a frame, even in batch sessions. Observe: > > emacs -batch --eval "(message \"%s\" (selected-frame))" > => # > > It's just that it's not a frame which this feature could use. > >> I’ve just checked and it does throw up an error for that >> test. I’m not sure how that should be handled. > You could explicitly test for non-interactive sessions, and skip the > test, or display a message that this test can only be run > interactively. Would that be good enough? --------------E360186C1A06C95F89B99723 Content-Type: text/x-patch; name="0001-Fix-macOS-mouse-movement.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-macOS-mouse-movement.patch" >From 66c9d13f9709d11dd06cf640a5873d39a8fb952c Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Mon, 15 May 2017 20:18:21 +0200 Subject: [PATCH] Fix macOS mouse movement * lisp/frame.el (ns-set-mouse-absolute-pixel-position): New function (Lisp). (set-mouse-absolute-pixel-position): Change it to call `ns-set-mouse-absolute-pixel-position' on macOS. * src/nsfns.m (Fns_set_mouse_absolute_pixel_position): New function. * src/nsterm.h (NS_PARENT_WINDOW_TOP_POS): Use the primary screen's height as a base for calculating global coordinates. * src/nsterm.m (frame_set_mouse_pixel_position): Fix it in macOS. * test/lisp/mouse-tests.el (bug26816-mouse-frame-movement): Test movement of mouse relative to frame. --- etc/NEWS | 3 +++ lisp/frame.el | 3 +++ src/nsfns.m | 39 +++++++++++++++++++++++++++++++++++++++ src/nsterm.h | 2 +- src/nsterm.m | 14 +++++++------- test/lisp/mouse-tests.el | 9 +++++++++ 6 files changed, 62 insertions(+), 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 6667a44..25f0f18 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1292,6 +1292,9 @@ This is in contrast to the default action on POSIX Systems, where it causes the receiving process to terminate with a core dump if no debugger has been attached to it. +** `set-mouse-position' and `set-mouse-absolute-pixel-position' work +on macOS. + ---------------------------------------------------------------------- This file is part of GNU Emacs. diff --git a/lisp/frame.el b/lisp/frame.el index 05db8cf..02871e0 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1465,6 +1465,7 @@ mouse-absolute-pixel-position (t (cons 0 0))))) +(declare-function ns-set-mouse-absolute-pixel-position "nsfns.m" (x y)) (declare-function w32-set-mouse-absolute-pixel-position "w32fns.c" (x y)) (declare-function x-set-mouse-absolute-pixel-position "xfns.c" (x y)) @@ -1474,6 +1475,8 @@ set-mouse-absolute-pixel-position position (0, 0) of the selected frame's terminal." (let ((frame-type (framep-on-display))) (cond + ((eq frame-type 'ns) + (ns-set-mouse-absolute-pixel-position x y)) ((eq frame-type 'x) (x-set-mouse-absolute-pixel-position x y)) ((eq frame-type 'w32) diff --git a/src/nsfns.m b/src/nsfns.m index cbe0ffb..e916f6a 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -3053,6 +3053,44 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are : Qnative_edges)); } +DEFUN ("ns-set-mouse-absolute-pixel-position", + Fns_set_mouse_absolute_pixel_position, + Sns_set_mouse_absolute_pixel_position, 2, 2, 0, + doc: /* Move mouse pointer to absolute pixel position (X, Y). +The coordinates X and Y are interpreted in pixels relative to a position +\(0, 0) of the selected frame's display. */) + (Lisp_Object x, Lisp_Object y) +{ + struct frame *f = SELECTED_FRAME (); + EmacsView *view = FRAME_NS_VIEW (f); + NSScreen *screen = [[view window] screen]; + NSRect screen_frame = [screen frame]; + int mouse_x, mouse_y; + + NSScreen *primary_screen = [[NSScreen screens] objectAtIndex:0]; + NSRect primary_screen_frame = [primary_screen frame]; + CGFloat primary_screen_height = primary_screen_frame.size.height; + + if (FRAME_INITIAL_P (f) || !FRAME_NS_P (f)) + return Qnil; + + CHECK_TYPE_RANGED_INTEGER (int, x); + CHECK_TYPE_RANGED_INTEGER (int, y); + + mouse_x = screen_frame.origin.x + XINT (x); + + if (screen == primary_screen) + mouse_y = screen_frame.origin.y + XINT (y); + else + mouse_y = (primary_screen_height - screen_frame.size.height + - screen_frame.origin.y) + XINT (y); + + CGPoint mouse_pos = CGPointMake(mouse_x, mouse_y); + CGWarpMouseCursorPosition (mouse_pos); + + return Qnil; +} + /* ========================================================================== Class implementations @@ -3241,6 +3279,7 @@ - (NSString *)panel: (id)sender userEnteredFilename: (NSString *)filename defsubr (&Sns_frame_edges); defsubr (&Sns_frame_list_z_order); defsubr (&Sns_frame_restack); + defsubr (&Sns_set_mouse_absolute_pixel_position); defsubr (&Sx_display_mm_width); defsubr (&Sx_display_mm_height); defsubr (&Sx_display_screens); diff --git a/src/nsterm.h b/src/nsterm.h index 9285178..ac339bf 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1087,7 +1087,7 @@ struct x_output ? ([[FRAME_NS_VIEW (f) window] parentWindow].frame.origin.y \ + [[FRAME_NS_VIEW (f) window] parentWindow].frame.size.height \ - FRAME_NS_TITLEBAR_HEIGHT (FRAME_PARENT_FRAME (f))) \ - : [[[FRAME_NS_VIEW (f) window] screen] frame].size.height) + : [[[NSScreen screens] objectAtIndex: 0] frame].size.height) #define FRAME_NS_FONT_TABLE(f) (FRAME_DISPLAY_INFO (f)->font_table) diff --git a/src/nsterm.m b/src/nsterm.m index c22c5a7..a7ab73b 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2321,14 +2321,14 @@ so some key presses (TAB) are swallowed by the system. */ -------------------------------------------------------------------------- */ { NSTRACE ("frame_set_mouse_pixel_position"); - ns_raise_frame (f); -#if 0 - /* FIXME: this does not work, and what about GNUstep? */ + + /* FIXME: what about GNUstep? */ #ifdef NS_IMPL_COCOA - [FRAME_NS_VIEW (f) lockFocus]; - PSsetmouse ((float)pix_x, (float)pix_y); - [FRAME_NS_VIEW (f) unlockFocus]; -#endif + CGPoint mouse_pos = + CGPointMake(f->left_pos + pix_x, + f->top_pos + pix_y + + FRAME_NS_TITLEBAR_HEIGHT(f) + FRAME_TOOLBAR_HEIGHT(f)); + CGWarpMouseCursorPosition (mouse_pos); #endif } diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el index fffaa2f..70e932b 100644 --- a/test/lisp/mouse-tests.el +++ b/test/lisp/mouse-tests.el @@ -47,5 +47,13 @@ (should-not (mouse--down-1-maybe-follows-link)) (should (equal unread-command-events '((mouse-2 nil 1)))))) +(ert-deftest bug26816-mouse-frame-movement () + "Mouse moves relative to frame." + (skip-unless (display-graphic-p)) + (let ((frame (selected-frame))) + (set-mouse-position frame 0 0) + (should (equal (mouse-position) + (cons frame (cons 0 0)))))) + + ;;; mouse-tests.el ends here -- 1.7.4.4 --------------E360186C1A06C95F89B99723-- From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 May 2017 22:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Charles A. Roelli" Cc: rudalics@gmx.at, Eli Zaretskii , 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149497519218434 (code B ref 26816); Tue, 16 May 2017 22:54:01 +0000 Received: (at 26816) by debbugs.gnu.org; 16 May 2017 22:53:12 +0000 Received: from localhost ([127.0.0.1]:49281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAlL6-0004nG-Bi for submit@debbugs.gnu.org; Tue, 16 May 2017 18:53:12 -0400 Received: from mail-wr0-f182.google.com ([209.85.128.182]:32918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAlL4-0004n2-9t for 26816@debbugs.gnu.org; Tue, 16 May 2017 18:53:10 -0400 Received: by mail-wr0-f182.google.com with SMTP id w50so84775437wrc.0 for <26816@debbugs.gnu.org>; Tue, 16 May 2017 15:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=0gfJQqrb2zzX3GKP0LGLafz8xbTRdURx166PZl5wvBY=; b=pF9Beo2+BkG4x83Ryfl8rkAa3/eF3FEUNm1vc4x4wQu77CdO7leFrAwWQPIbDxcrZv Oo7L0I++7U+hhUl9R1CJ8v7OVXe03pBOnSXzizl8scRNOgjQBB8LQAuwGaWe1zHBOP8g stXQ4jnVmXJ8v3oQVfrRLioq3x0rmqgtfYFL2pcGJyk+YW62zka6SlfKxKNDFr9gsTlI BnQbYfdBFzLaZjrzxRRu45LFiYaIsScL7L83aizLposJpBA4DcEuNLsSfOG5AvZFZ+Ka WqXQQoPDsnoe17CwAvjhK9p9G8UKoqRknsqEGStL35Rt4xjyNF4vGwPsDqijxIUTR5Cx qjRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=0gfJQqrb2zzX3GKP0LGLafz8xbTRdURx166PZl5wvBY=; b=ZhcGp+q5PWTywdO4qtZpQKZStMQsFgSpQaQsZ++6mYBvyXKa/39EXEUZZzNNAEbmPu zMvxpAQ+eq8ZPcIBZFCleU5p5MpBpEJYue3A44tRSbwZyteXvF1mJxOR+JqWvB9VnbyT i63d6eK1CK10zCoLpV8YWM/NvDpPfRYaqnM4DWqid/hydWN4wRh5N8fg3MFGap5N0Plh O/m2Wj5148iYm+3Hg+4wbc0aezRWq4asvxVA8N/jFm/aFIm1s78KQxHrS9s8oo3Raca9 AzV1enqfp1A7JhBUjxZTsmnhuDMNZ0HqoJbEhxtbCtSOENwj0lWgDHgsJV4fkik5URSb PEHA== X-Gm-Message-State: AODbwcAvF406HZsZDZ3bGLNt8VUR1AfIxMaM6LZp6JYvZL05QV05RQ6A 6WgwPYz7ETX7hA== X-Received: by 10.223.139.72 with SMTP id v8mr143574wra.13.1494975184432; Tue, 16 May 2017 15:53:04 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-e9b1-3358-0f3c-df92.holly.idiocy.org. [2001:8b0:3f8:8129:e9b1:3358:f3c:df92]) by smtp.gmail.com with ESMTPSA id w96sm388345wrc.14.2017.05.16.15.53.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 May 2017 15:53:03 -0700 (PDT) Date: Tue, 16 May 2017 23:53:01 +0100 From: Alan Third Message-ID: <20170516225301.GA49449@breton.holly.idiocy.org> References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> <20170511214342.GA10431@breton.holly.idiocy.org> <3dc0d587-8290-f873-ceef-d059bec0b7f6@aurox.ch> <20170514135910.GA13710@breton.holly.idiocy.org> <83y3tz7bcp.fsf@gnu.org> <76527b19-1f31-0642-ac3a-8e55fd9b0a90@aurox.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <76527b19-1f31-0642-ac3a-8e55fd9b0a90@aurox.ch> User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) On Mon, May 15, 2017 at 08:23:27PM +0200, Charles A. Roelli wrote: > Patch is attached, with a commit message. For some reason I can’t apply this patch. It looks fine, and I can’t see what the problem is at all. Do you have commit access to the repository? If so then I don’t suppose it matters if I can’t apply it locally, but if not then either I need to fix this or someone else needs to push it for you. Here’s the error from magit, in case it means something to someone: 128 git … am --3way -- /Users/alan/0001-Fix-macOS-mouse-movement.patch Applying: Fix macOS mouse movement Using index info to reconstruct a base tree... M src/nsfns.m M src/nsterm.m error: patch failed: test/lisp/mouse-tests.el:47 error: test/lisp/mouse-tests.el: patch does not apply error: Did you hand edit your patch? It does not apply to blobs recorded in its index. Patch failed at 0001 Fix macOS mouse movement The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". -- Alan Third From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 May 2017 08:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third Cc: 26816@debbugs.gnu.org, "Charles A. Roelli" Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.14950102185608 (code B ref 26816); Wed, 17 May 2017 08:37:01 +0000 Received: (at 26816) by debbugs.gnu.org; 17 May 2017 08:36:58 +0000 Received: from localhost ([127.0.0.1]:49540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAuS2-0001SO-8O for submit@debbugs.gnu.org; Wed, 17 May 2017 04:36:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:49309 helo=mx1.suse.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAuS0-0001SG-TU for 26816@debbugs.gnu.org; Wed, 17 May 2017 04:36:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8A8D8AAB1; Wed, 17 May 2017 08:36:54 +0000 (UTC) From: Andreas Schwab References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> <20170511214342.GA10431@breton.holly.idiocy.org> <3dc0d587-8290-f873-ceef-d059bec0b7f6@aurox.ch> <20170514135910.GA13710@breton.holly.idiocy.org> <83y3tz7bcp.fsf@gnu.org> <76527b19-1f31-0642-ac3a-8e55fd9b0a90@aurox.ch> <20170516225301.GA49449@breton.holly.idiocy.org> X-Yow: I'm receiving a coded message from EUBIE BLAKE!! Date: Wed, 17 May 2017 10:36:53 +0200 In-Reply-To: <20170516225301.GA49449@breton.holly.idiocy.org> (Alan Third's message of "Tue, 16 May 2017 23:53:01 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On Mai 16 2017, Alan Third wrote: > On Mon, May 15, 2017 at 08:23:27PM +0200, Charles A. Roelli wrote: >> Patch is attached, with a commit message. > > For some reason I can’t apply this patch. It looks fine, and I can’t > see what the problem is at all. The patch is broken, the hunk for test/lisp/mouse-tests.el has the wrong line count: @@ -47,5 +47,13 @@ (should-not (mouse--down-1-maybe-follows-link)) (should (equal unread-command-events '((mouse-2 nil 1)))))) +(ert-deftest bug26816-mouse-frame-movement () + "Mouse moves relative to frame." + (skip-unless (display-graphic-p)) + (let ((frame (selected-frame))) + (set-mouse-position frame 0 0) + (should (equal (mouse-position) + (cons frame (cons 0 0)))))) + + ;;; mouse-tests.el ends here -- Note that the last line of the hunk should not be part of it. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." From unknown Fri Aug 08 15:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26816: mouse movement support for OS X Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 May 2017 19:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26816 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andreas Schwab , Alan Third Cc: 26816@debbugs.gnu.org Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149513663112378 (code B ref 26816); Thu, 18 May 2017 19:44:02 +0000 Received: (at 26816) by debbugs.gnu.org; 18 May 2017 19:43:51 +0000 Received: from localhost ([127.0.0.1]:53834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBRKw-0003DZ-I7 for submit@debbugs.gnu.org; Thu, 18 May 2017 15:43:50 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:50502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBRKv-0003DM-6O for 26816@debbugs.gnu.org; Thu, 18 May 2017 15:43:50 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 1CBF622435 for <26816@debbugs.gnu.org>; Thu, 18 May 2017 19:39:21 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:to:subject:subject; s=dkim; t=1495136358; x=1496000359; bh=3lSAbyc5ageDhDKwdnUkZ1pA 7X1VmZzPOHid6ajJPxs=; b=lEmPmRtNqDEOsarVOX4ZGR736RsIJk2FQvA089mj gVESvDZ/dfxLMCgJTBcs/oBVr9DWRJmnn4w4Db9I9daGfRrJ1wVKwJiGAa49RBLb /IdwakQlJwkl/wEnXS1m/88j+MtDvP43bOL+H46Nof0GskEikxJJxltk45TZ7qIC HyU= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TJtQg5DnFFGJ for <26816@debbugs.gnu.org>; Thu, 18 May 2017 19:39:18 +0000 (UTC) Received: from [192.168.1.121] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 767092242E; Thu, 18 May 2017 19:39:17 +0000 (UTC) References: <20170507200034.GA661@breton.holly.idiocy.org> <20170509224435.GB8974@breton.holly.idiocy.org> <20170511214342.GA10431@breton.holly.idiocy.org> <3dc0d587-8290-f873-ceef-d059bec0b7f6@aurox.ch> <20170514135910.GA13710@breton.holly.idiocy.org> <83y3tz7bcp.fsf@gnu.org> <76527b19-1f31-0642-ac3a-8e55fd9b0a90@aurox.ch> <20170516225301.GA49449@breton.holly.idiocy.org> From: "Charles A. Roelli" Message-ID: <576caa34-3ec3-3670-c113-23501db35779@aurox.ch> Date: Thu, 18 May 2017 21:43:37 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------CABF158FC5B308C0D90B740E" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is a multi-part message in MIME format. --------------CABF158FC5B308C0D90B740E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sorry for the trouble -- I had called M-x untabify on two lines of the patch (bad idea, I think) and I must have messed up the line count at that point too. Second attempt attached. Cheers, Charles On 17/05/2017 10:36, Andreas Schwab wrote: > On Mai 16 2017, Alan Third wrote: > >> On Mon, May 15, 2017 at 08:23:27PM +0200, Charles A. Roelli wrote: >>> Patch is attached, with a commit message. >> For some reason I can’t apply this patch. It looks fine, and I can’t >> see what the problem is at all. > The patch is broken, the hunk for test/lisp/mouse-tests.el has the wrong > line count: > > @@ -47,5 +47,13 @@ > (should-not (mouse--down-1-maybe-follows-link)) > (should (equal unread-command-events '((mouse-2 nil 1)))))) > > +(ert-deftest bug26816-mouse-frame-movement () > + "Mouse moves relative to frame." > + (skip-unless (display-graphic-p)) > + (let ((frame (selected-frame))) > + (set-mouse-position frame 0 0) > + (should (equal (mouse-position) > + (cons frame (cons 0 0)))))) > + > + > ;;; mouse-tests.el ends here --------------CABF158FC5B308C0D90B740E Content-Type: text/x-patch; name="0001-Fix-macOS-mouse-movement.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-macOS-mouse-movement.patch" >From c052ea0a343beefe35c6d7343740724e062a5989 Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Thu, 18 May 2017 21:31:46 +0200 Subject: [PATCH] Fix macOS mouse movement * lisp/frame.el (ns-set-mouse-absolute-pixel-position): New function (Lisp). (set-mouse-absolute-pixel-position): Change it to call `ns-set-mouse-absolute-pixel-position' on macOS. * src/nsfns.m (Fns_set_mouse_absolute_pixel_position): New function. * src/nsterm.h (NS_PARENT_WINDOW_TOP_POS): Use the primary screen's height as a base for calculating global coordinates. * src/nsterm.m (frame_set_mouse_pixel_position): Fix it in macOS. * test/lisp/mouse-tests.el (bug26816-mouse-frame-movement): Test movement of mouse relative to frame. --- etc/NEWS | 3 +++ lisp/frame.el | 3 +++ src/nsfns.m | 39 +++++++++++++++++++++++++++++++++++++++ src/nsterm.h | 2 +- src/nsterm.m | 14 +++++++------- test/lisp/mouse-tests.el | 9 +++++++++ 6 files changed, 62 insertions(+), 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 6851dc9..1faa1db 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1294,6 +1294,9 @@ This is in contrast to the default action on POSIX Systems, where it causes the receiving process to terminate with a core dump if no debugger has been attached to it. +** `set-mouse-position' and `set-mouse-absolute-pixel-position' work +on macOS. + ---------------------------------------------------------------------- This file is part of GNU Emacs. diff --git a/lisp/frame.el b/lisp/frame.el index 05db8cf..02871e0 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1465,6 +1465,7 @@ mouse-absolute-pixel-position (t (cons 0 0))))) +(declare-function ns-set-mouse-absolute-pixel-position "nsfns.m" (x y)) (declare-function w32-set-mouse-absolute-pixel-position "w32fns.c" (x y)) (declare-function x-set-mouse-absolute-pixel-position "xfns.c" (x y)) @@ -1474,6 +1475,8 @@ set-mouse-absolute-pixel-position position (0, 0) of the selected frame's terminal." (let ((frame-type (framep-on-display))) (cond + ((eq frame-type 'ns) + (ns-set-mouse-absolute-pixel-position x y)) ((eq frame-type 'x) (x-set-mouse-absolute-pixel-position x y)) ((eq frame-type 'w32) diff --git a/src/nsfns.m b/src/nsfns.m index cbe0ffb..f9fb964 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -3053,6 +3053,44 @@ value is a list of the form (LEFT, TOP, RIGHT, BOTTOM). All values are : Qnative_edges)); } +DEFUN ("ns-set-mouse-absolute-pixel-position", + Fns_set_mouse_absolute_pixel_position, + Sns_set_mouse_absolute_pixel_position, 2, 2, 0, + doc: /* Move mouse pointer to absolute pixel position (X, Y). +The coordinates X and Y are interpreted in pixels relative to a position +\(0, 0) of the selected frame's display. */) + (Lisp_Object x, Lisp_Object y) +{ + struct frame *f = SELECTED_FRAME (); + EmacsView *view = FRAME_NS_VIEW (f); + NSScreen *screen = [[view window] screen]; + NSRect screen_frame = [screen frame]; + int mouse_x, mouse_y; + + NSScreen *primary_screen = [[NSScreen screens] objectAtIndex:0]; + NSRect primary_screen_frame = [primary_screen frame]; + CGFloat primary_screen_height = primary_screen_frame.size.height; + + if (FRAME_INITIAL_P (f) || !FRAME_NS_P (f)) + return Qnil; + + CHECK_TYPE_RANGED_INTEGER (int, x); + CHECK_TYPE_RANGED_INTEGER (int, y); + + mouse_x = screen_frame.origin.x + XINT (x); + + if (screen == primary_screen) + mouse_y = screen_frame.origin.y + XINT (y); + else + mouse_y = (primary_screen_height - screen_frame.size.height + - screen_frame.origin.y) + XINT (y); + + CGPoint mouse_pos = CGPointMake(mouse_x, mouse_y); + CGWarpMouseCursorPosition (mouse_pos); + + return Qnil; +} + /* ========================================================================== Class implementations @@ -3241,6 +3279,7 @@ - (NSString *)panel: (id)sender userEnteredFilename: (NSString *)filename defsubr (&Sns_frame_edges); defsubr (&Sns_frame_list_z_order); defsubr (&Sns_frame_restack); + defsubr (&Sns_set_mouse_absolute_pixel_position); defsubr (&Sx_display_mm_width); defsubr (&Sx_display_mm_height); defsubr (&Sx_display_screens); diff --git a/src/nsterm.h b/src/nsterm.h index 9285178..ac339bf 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1087,7 +1087,7 @@ struct x_output ? ([[FRAME_NS_VIEW (f) window] parentWindow].frame.origin.y \ + [[FRAME_NS_VIEW (f) window] parentWindow].frame.size.height \ - FRAME_NS_TITLEBAR_HEIGHT (FRAME_PARENT_FRAME (f))) \ - : [[[FRAME_NS_VIEW (f) window] screen] frame].size.height) + : [[[NSScreen screens] objectAtIndex: 0] frame].size.height) #define FRAME_NS_FONT_TABLE(f) (FRAME_DISPLAY_INFO (f)->font_table) diff --git a/src/nsterm.m b/src/nsterm.m index c22c5a7..a7ab73b 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2321,14 +2321,14 @@ so some key presses (TAB) are swallowed by the system. */ -------------------------------------------------------------------------- */ { NSTRACE ("frame_set_mouse_pixel_position"); - ns_raise_frame (f); -#if 0 - /* FIXME: this does not work, and what about GNUstep? */ + + /* FIXME: what about GNUstep? */ #ifdef NS_IMPL_COCOA - [FRAME_NS_VIEW (f) lockFocus]; - PSsetmouse ((float)pix_x, (float)pix_y); - [FRAME_NS_VIEW (f) unlockFocus]; -#endif + CGPoint mouse_pos = + CGPointMake(f->left_pos + pix_x, + f->top_pos + pix_y + + FRAME_NS_TITLEBAR_HEIGHT(f) + FRAME_TOOLBAR_HEIGHT(f)); + CGWarpMouseCursorPosition (mouse_pos); #endif } diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el index fffaa2f..a8eca28 100644 --- a/test/lisp/mouse-tests.el +++ b/test/lisp/mouse-tests.el @@ -47,4 +47,13 @@ (should-not (mouse--down-1-maybe-follows-link)) (should (equal unread-command-events '((mouse-2 nil 1)))))) +(ert-deftest bug26816-mouse-frame-movement () + "Mouse moves relative to frame." + (skip-unless (display-graphic-p)) + (let ((frame (selected-frame))) + (set-mouse-position frame 0 0) + (should (equal (mouse-position) + (cons frame (cons 0 0)))))) + + ;;; mouse-tests.el ends here -- 1.7.4.4 --------------CABF158FC5B308C0D90B740E-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 20 19:15:13 2017 Received: (at control) by debbugs.gnu.org; 20 May 2017 23:15:13 +0000 Received: from localhost ([127.0.0.1]:57477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCDab-00064H-79 for submit@debbugs.gnu.org; Sat, 20 May 2017 19:15:13 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCDaZ-000642-Gm for control@debbugs.gnu.org; Sat, 20 May 2017 19:15:11 -0400 Received: by mail-wm0-f66.google.com with SMTP id d127so24580159wmf.1 for ; Sat, 20 May 2017 16:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:message-id:to:from:subject; bh=/kAxXDFVdwd/MjWgM8wFoRWiqQJBfOHXzPjg5LImnq4=; b=XuCf6W/ES1Eha0cV8QUs/VGAtj0PTcuJMAeuFtf8xgDVdWvyEBKG+WnHS2xLywC73K UYxD7k4gwC1jr2m8QpJNf9ot1NfFfkX+N0O4HeUncdSBrZa72uxGyxO87BAX7UemvUWr Pf0dMFvZk/AdeNpbZkFiPdbTrm7IFkZcJf3cIdguxGAtLOVk9zozSR6H+iiPVkikIqLn j2gGifV5OzEbcVayCsGwt5kObOqwmkOKlAnbGZnvMCdatn0tzlhpS0V+MLHla9u9uWDu noIL6SOMPmHhG7AJ8uViJTRo2jHt0vjVfu7WAzThu9KTpoB9+2L6ER4gQKkPQva6pVkj 8T2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:to:from:subject; bh=/kAxXDFVdwd/MjWgM8wFoRWiqQJBfOHXzPjg5LImnq4=; b=kCVwLqRhSPlVZfWDCfpVoZZ//A8KG6HPDD0ZuD87DqOCjcF09W7LeJ9ySi1UYwWdI2 Y/iVP6XZpfdccYBt+HnwKAI5JGgUNJTTzQR/dUL/U8k2jPTy+D3lU4rkTOjhlUnwAHUj uPzPS8JIdTs3Pb2vX0O47APu/2VKvJ+b5Ckh40QtkNB6e5vMpFhed0LzQCx4/Ckh1LR+ td43xX/BIaX1kAQMYgsd9UrmxUc7SjzgK2iIAy1NwCjCicm9YcPC2506z5BAuG6hRXA8 orz8YxDQNhq8E7MCaE6TtsOIwk1kUKOA5dPYkNSStg0fQvs+CROwLxqBbEtnAt503jMa lu3g== X-Gm-Message-State: AODbwcDJV/opgqIjMkbU8G5y/7tJiE54GS/j1AO0uzOE8yfCt65XYhJa IGx7MoW5SqBZDURQ448= X-Received: by 10.28.153.209 with SMTP id b200mr19096879wme.7.1495322105727; Sat, 20 May 2017 16:15:05 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-1c23-04ca-53b1-12e4.holly.idiocy.org. [2001:8b0:3f8:8129:1c23:4ca:53b1:12e4]) by smtp.gmail.com with ESMTPSA id x133sm25424691wme.0.2017.05.20.16.15.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 20 May 2017 16:15:04 -0700 (PDT) Date: Sun, 21 May 2017 00:14:58 +0100 Message-Id: To: control@debbugs.gnu.org From: Alan Third Subject: control message for bug #26816 X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) tags 26816 fixed close 26816 26.1