From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#26816: mouse movement support for OS X Date: Sun, 7 May 2017 21:00:34 +0100 Message-ID: <20170507200034.GA661@breton.holly.idiocy.org> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1494187277 23270 195.159.176.226 (7 May 2017 20:01:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 7 May 2017 20:01:17 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: 26816@debbugs.gnu.org To: "Charles A. Roelli" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 07 22:01:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7SMg-0005to-By for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 May 2017 22:01:10 +0200 Original-Received: from localhost ([::1]:56607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7SMi-000466-TR for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 May 2017 16:01:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7SMb-00045X-TJ for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 16:01:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7SMY-0004hB-QW for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 16:01:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34351) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d7SMY-0004h4-LU for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 16:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d7SMY-0003f3-6P for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 16:01:02 -0400 X-Loop: help-debbugs@gnu.org 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: Original-Received: via spool by 26816-submit@debbugs.gnu.org id=B26816.149418724514043 (code B ref 26816); Sun, 07 May 2017 20:01:02 +0000 Original-Received: (at 26816) by debbugs.gnu.org; 7 May 2017 20:00:45 +0000 Original-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 Original-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 Original-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) Original-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) Content-Disposition: inline In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132360 Archived-At: 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