elisp: Mouse Position

 
 28.15 Mouse Position
 ====================
 
 The functions ‘mouse-position’ and ‘set-mouse-position’ give access to
 the current position of the mouse.
 
  -- Function: mouse-position
      This function returns a description of the position of the mouse.
      The value looks like ‘(FRAME X . Y)’, where X and Y are integers
      giving the (possibly rounded) position in multiples of the default
      character size of FRAME (SeeFrame Font) relative to the native
      position of FRAME (SeeFrame Geometry).
 
  -- Variable: mouse-position-function
      If non-‘nil’, the value of this variable is a function for
      ‘mouse-position’ to call.  ‘mouse-position’ calls this function
      just before returning, with its normal return value as the sole
      argument, and it returns whatever this function returns to it.
 
      This abnormal hook exists for the benefit of packages like
      ‘xt-mouse.el’ that need to do mouse handling at the Lisp level.
 
  -- Function: set-mouse-position frame x y
      This function “warps the mouse” to position X, Y in frame FRAME.
      The arguments X and Y are integers, giving the position in
      Font::) relative to the native position of FRAME (SeeFrame
      Geometry).
 
      The resulting mouse position is constrained to the native frame of
      FRAME.  If FRAME is not visible, this function does nothing.  The
      return value is not significant.
 
  -- Function: mouse-pixel-position
      This function is like ‘mouse-position’ except that it returns
      coordinates in units of pixels rather than units of characters.
 
  -- Function: set-mouse-pixel-position frame x y
      This function warps the mouse like ‘set-mouse-position’ except that
      X and Y are in units of pixels rather than units of characters.
 
      The resulting mouse position is not constrained to the native frame
      of FRAME.  If FRAME is not visible, this function does nothing.
      The return value is not significant.
 
    On a graphical terminal the following two functions allow the
 absolute position of the mouse cursor to be retrieved and set.
 
  -- Function: mouse-absolute-pixel-position
      This function returns a cons cell (X .  Y) of the coordinates of
      the mouse cursor position in pixels, relative to a position (0, 0)
      of the selected frame’s display.
 
  -- Function: set-mouse-absolute-pixel-position x y
      This function moves the mouse cursor to the position (X, Y).  The
      coordinates X and Y are interpreted in pixels relative to a
      position (0, 0) of the selected frame’s display.
 
    The following function can tell whether the mouse cursor is currently
 visible on a frame:
 
  -- Function: frame-pointer-visible-p &optional frame
      This predicate function returns non-‘nil’ if the mouse pointer
      displayed on FRAME is visible; otherwise it returns ‘nil’.  FRAME
      omitted or ‘nil’ means the selected frame.  This is useful when
      ‘make-pointer-invisible’ is set to ‘t’: it allows you to know if
      the pointer has been hidden.  See(emacs)Mouse Avoidance.