GNU bug report logs - #26816
mouse movement support for OS X

Previous Next

Package: emacs;

Reported by: "Charles A. Roelli" <charles <at> aurox.ch>

Date: Sun, 7 May 2017 15:13:01 UTC

Severity: normal

Tags: fixed

Fixed in version 26.1

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Charles A. Roelli" <charles <at> aurox.ch>
To: 26816 <at> debbugs.gnu.org
Subject: bug#26816: mouse movement support for OS X
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:

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.





This bug report was last modified 8 years and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.