[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 The Mouse

* Mouse Position:: Asking where the mouse is, or moving it.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Mouse Position

The functions mouse-position, mouse-pixel-position, set-mouse-position and set-mouse-pixel-position give access to the current position of the mouse.

Function: mouse-position &optional device

This function returns a list (window x . y) giving the current mouse window and position. The position is given in character cells, where ‘(0, 0)’ is the upper-left corner.

device specifies the device on which to read the mouse position, and defaults to the selected device. If the device is a mouseless terminal or XEmacs hasn’t been programmed to read its mouse position, it returns the device’s selected window for window and nil for x and y.

Function: mouse-pixel-position &optional device

This function returns a list (window x . y) giving the current mouse window and position. The position is given in pixel units, where ‘(0, 0)’ is the upper-left corner.

device specifies the device on which to read the mouse position, and defaults to the selected device. If the device is a mouseless terminal or XEmacs hasn’t been programmed to read its mouse position, it returns the device’s selected window for window and nil for x and y.

Function: set-mouse-position window x y

This function warps the mouse to the center of character position x, y in frame window. The arguments x and y are integers, giving the position in characters relative to the top left corner of window.

Warping the mouse means changing the screen position of the mouse as if the user had moved the physical mouse—thus simulating the effect of actual mouse motion.

Function: set-mouse-pixel-position window x y

This function warps the mouse to pixel position x, y in frame window. The arguments x and y are integers, giving the position in pixels relative to the top left corner of window.


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on December 6, 2024 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on December 6, 2024 using texi2html 5.0.