PREV UP NEXT GNU Emacs Lisp Reference Manual

18.5.8: Motion Events

Emacs sometimes generates mouse motion events to describe motion of the mouse without any button activity. Mouse motion events are represented by lists that look like this:

(mouse-movement
 (window buffer-pos (x . y) timestamp))

The second element of the list describes the current position of the mouse, just as in a click event (see Click Events).

The special form track-mouse enables generation of motion events within its body. Outside of track-mouse forms, Emacs does not generate events for mere motion of the mouse, and these events do not appear.

Special Form: track-mouse body...
This special form executes body, with generation of mouse motion events enabled. Typically body would use read-event to read the motion events and modify the display accordingly.

When the user releases the button, that generates a click event. Typically, body should return when it sees the click event, and discard that event.