Subject: Re: bug#27053: 26.0.50; x-show-tip gets wrong mouse position if frame moves w/o mouse moving on macOS

From: Aaron Jensen <[email-masked]>
Date: Wed, 24 May 2017 07:57:10 -0700

On Wed, May 24, 2017 at 7:42 AM, Aaron Jensen <[email-masked]> wrote:
> It's as if emacs updates the mouse position only on mouse move and
> stores it in frame local coordinates on macOS.

Indeed, this appears to be exactly what it is doing (from nsterm.m):

-(void)mouseMoved: (NSEvent *)e
{
  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
  Lisp_Object frame;
  NSPoint pt;

  NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "[EmacsView mouseMoved:]");

  dpyinfo->last_mouse_movement_time = EV_TIMESTAMP (e);
  pt = [self convertPoint: [e locationInWindow] fromView: nil];
  dpyinfo->last_mouse_motion_x = pt.x;
  dpyinfo->last_mouse_motion_y = pt.y;

I do not know what the best solution to this is. They could be stored
in screen local coordinates and converted to frame local as they're
needed, or they could be recalculated/asked for whenever the frame is
moved.