Next: Drag Events, Previous: Mouse Events, Up: Input Events
When the user presses a mouse button and releases it at the same location, that generates a click event. All mouse click event share the same format:
(event-type position click-count)
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
.
To access the contents of a mouse position list in the position slot of a click event, you should typically use the functions documented in Accessing Mouse. The explicit format of the list depends on where the click occurred. For clicks in the text area, mode line, header line, or in the fringe or marginal areas, the mouse position list has the form
(window pos-or-area (x . y) timestamp object text-pos (col . row) image (dx . dy) (width . height))
The meanings of these list elements are as follows:
mode-line
,
header-line
, vertical-line
, left-margin
,
right-margin
, left-fringe
, or right-fringe
.
In one special case, pos-or-area 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 registered
by Emacs. See Key Sequence Input.
(0 . 0)
is taken to be
the top left corner of the text area. See Window Sizes. For
clicks in a mode line or header line, the coordinate origin is the top
left corner of the window itself. For fringes, margins, and the
vertical border, x does not have meaningful data. For fringes
and margins, y is relative to the bottom edge of the header
line. In all cases, the x and y coordinates increase
rightward and downward respectively.
nil
, which means the click occurred on buffer text, or a
cons cell of the form (string . string-pos) if there
is a string from a text property or an overlay at the click position.
nil
. For other events, it is the buffer position closest to
the click.
find-image
(see Defining Images); otherwise
this is nil
.
(0 . 0)
. If object is
nil
, which stands for a buffer, the coordinates are relative to
the top left corner of the character glyph clicked on.
nil
, those of the character glyph clicked on.
For clicks on a scroll bar, position has this form:
(window area (portion . whole) timestamp part)
vertical-scroll-bar
.
0
.
0
.
0
.
handle
(the scroll bar handle), above-handle
(the area above the handle), below-handle
(the area below the
handle), up
(the up arrow at one end of the scroll bar), or
down
(the down arrow at one end of the scroll bar).