unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26816: mouse movement support for OS X
@ 2017-05-07 15:11 Charles A. Roelli
  2017-05-07 16:51 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Charles A. Roelli @ 2017-05-07 15:11 UTC (permalink / raw)
  To: 26816

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.






^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-05-18 19:43 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-07 15:11 bug#26816: mouse movement support for OS X Charles A. Roelli
2017-05-07 16:51 ` Eli Zaretskii
2017-05-08 18:34   ` Charles A. Roelli
2017-05-08 18:54     ` Eli Zaretskii
2017-05-07 18:07 ` martin rudalics
2017-05-07 20:00 ` Alan Third
2017-05-09 19:09   ` Charles A. Roelli
2017-05-09 22:44     ` Alan Third
2017-05-11 18:06       ` Charles A. Roelli
2017-05-11 21:43         ` Alan Third
2017-05-14 13:29           ` Charles A. Roelli
2017-05-14 13:59             ` Alan Third
2017-05-14 14:37               ` Eli Zaretskii
2017-05-15 18:23                 ` Charles A. Roelli
2017-05-16 22:53                   ` Alan Third
2017-05-17  8:36                     ` Andreas Schwab
2017-05-18 19:43                       ` Charles A. Roelli

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).