Go to the first, previous, next, last section, table of contents.


Click Events

When the user presses a mouse button and releases it at the same location, that generates a click event. Mouse click events have this form:

(event-type
 (window buffer-pos (x . y) timestamp)
 click-count)

Here is what the elements normally mean:

event-type
This is a symbol that indicates which mouse button was used. It is one of the symbols mouse-1, mouse-2, ..., where the buttons are numbered left to right. You can also use prefixes `A-', `C-', `H-', `M-', `S-' and `s-' for modifiers alt, control, hyper, meta, shift and super, just as you would with function keys. This symbol also serves as the event type of the event. Key bindings describe events by their types; thus, if there is a key binding for mouse-1, that binding would apply to all events whose event-type is mouse-1.
window
This is the window in which the click occurred.
x, y
These are the pixel-denominated coordinates of the click, relative to the top left corner of window, which is (0 . 0).
buffer-pos
This is the buffer position of the character clicked on.
timestamp
This is the time at which the event occurred, in milliseconds. (Since this value wraps around the entire range of Emacs Lisp integers in about five hours, it is useful only for relating the times of nearby events.)
click-count
This is the number of rapid repeated presses so far of the same mouse button. See section Repeat Events.

The meanings of buffer-pos, x and y are somewhat different when the event location is in a special part of the screen, such as the mode line or a scroll bar.

If the location is in a scroll bar, then buffer-pos is the symbol vertical-scroll-bar or horizontal-scroll-bar, and the pair (x . y) is replaced with a pair (portion . whole), where portion is the distance of the click from the top or left end of the scroll bar, and whole is the length of the entire scroll bar.

If the position is on a mode line or the vertical line separating window from its neighbor to the right, then buffer-pos is the symbol mode-line or vertical-line. For the mode line, y does not have meaningful data. For the vertical line, x does not have meaningful data.

In one special case, buffer-pos is a list containing a symbol (one of the symbols listed above) instead of just the symbol. This happens after the imaginary prefix keys for the event are inserted into the input stream. See section Key Sequence Input.


Go to the first, previous, next, last section, table of contents.