Next: , Previous: Event Types, Up: Events


25.5.2 Contents of the Different Types of Events

Every event, no matter what type it is, contains a timestamp (which is typically an offset in milliseconds from when the X server was started) indicating when the event occurred. In addition, many events contain a channel, which specifies which frame the event occurred on, and/or a value indicating which modifier keys (shift, control, etc.) were held down at the time of the event.

The contents of each event are as follows:

key-press event
channel
timestamp
key
Which key was pressed. This is an integer (in the printing ascii range: >32 and <127) or a symbol such as left or right.

Note: Many physical keys are actually treated as two separate keys, depending on whether the shift key is pressed; for example, the “a” key is treated as either “a” or “A” depending on the state of the shift key, and the “1” key is similarly treated as either “1” or “!” on most keyboards.

In such cases, the shift key does not show up in the modifier list. For other keys, such as backspace, the shift key shows up as a regular modifier.

modifiers
Which modifier keys were pressed. As mentioned above, the shift key is not treated as a modifier for many keys and will not show up in this list in such cases.

button-press event
button-release event
channel
timestamp
button
What button went down or up. Buttons are numbered starting at 1.
modifiers
Which modifier keys were pressed. The special business mentioned above for the shift key does not apply to mouse events.
x
y
The position of the pointer (in pixels) at the time of the event.

pointer-motion event
channel
timestamp
x
y
The position of the pointer (in pixels) after it moved.
modifiers
Which modifier keys were pressed. The special business mentioned above for the shift key does not apply to mouse events.

misc-user event
timestamp
function
The elisp function to call for this event. This is normally either eval or call-interactively.
object
The object to pass to the function. This is normally the callback that was specified in the menu description.
button
What button went down or up. Buttons are numbered starting at 1.
modifiers
Which modifier keys were pressed. The special business mentioned above for the shift key does not apply to mouse events.
x
y
The position of the pointer (in pixels) at the time of the event.

process_event
timestamp
process
The Emacs “process” object in question.

timeout event
timestamp
function
The elisp function to call for this timeout. It is called with one argument, the event.
object
Some Lisp object associated with this timeout, to make it easier to tell them apart. The function and object for this event were specified when the timeout was set.

magic event
timestamp

The rest of the information in this event is not user-accessible.

eval event
timestamp
function
An elisp function to call when this event is dispatched.
object
The object to pass to the function. The function and object are set when the event is created.
— Function: event-type event

Return the type of event.

This will be a symbol; one of

key-press
A key was pressed.
button-press
A mouse button was pressed.
button-release
A mouse button was released.
motion
The mouse moved.
misc-user
Some other user action happened; typically, this is a menu selection, scrollbar action, or drag and drop action.
process
Input is available from a subprocess.
timeout
A timeout has expired.
eval
This causes a specified action to occur when dispatched.
magic
Some window-system-specific event has occurred.