PREV UP NEXT GNU Emacs Lisp Reference Manual

26.14: 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 position in characters relative to the top left corner of the inside of frame.
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 characters relative to the top left corner of the inside of frame.
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. These coordinates are not required to be within the frame.