15. Event Handling Functions
(event-listen display wait?)
See XPending, XPeekEvent.
Returns the size of the display's event queue.
If wait? is true and the event queue is empty, event-listen
flushes the output buffer and blocks until an event is received from
the server.
(get-motion-events window from-time to-time)
See XGetMotionEvents.
from-time and to-time are integers or the symbol now.
get-motion-events returns a vector of lists of three elements:
a time stamp (an integer or the symbol now), and the x and y
coordinates (integers).
(handle-events display discard? peek? . clauses)
See XNextEvent, XPeekEvent, XIfEvent, XPeekIfEvent.
handle-events is a special form.
Each clause is of the form (guard function); guard
is either an event name (a symbol, e.g. key-press or exposure),
a list of event names, or the symbol else.
handle-events gets the next event from the specified display.
Then the event type is matched against each event name in each guard
in order.
When a match occurs, the corresponding function is invoked with
the name of the event being dispatched (a symbol) and other, event
specific arguments (see below).
When no clause matches and an else clause is present, the function
from this clause is invoked.
handle-events loops until a function returns a value not
equal to #f in which case handle-events returns this value.
If discard? is true, unprocessed events (i.e. events for which
no matching clause has been found) are removed from the event queue,
otherwise they are left in place.
If peek? is true, processed events are not removed from
the event queue.
The following list gives all event specific arguments for each
event type.
The first argument is always the event type (a symbol).
In the following list, arguments with names of the form
something-window (or simply window) are always of type
window;
arguments with names of the form something-atom (or simply atom)
are always of type atom.
time is an integer or the symbol now.
x, y, width, height, border-width,
x-root, y-root, count, major-code, minor-code,
and keycode are integers.
state is a list of symbols (shift, lock, control,
mod1 ... mod5, button1 ... button5).
button is one of the symbols button1 ... button5,
button-mask is a list of one or more of these symbols.
cross-mode is a symbol (normal, grab, ungrab).
place is a symbol (top or bottom).
- key-press, key-release:
-
window, root-window, sub-window, time,
x, y, x-root, y-root, state, keycode,
same-screen?.
- button-press, button-release:
-
window, root-window, sub-window, time,
x, y, x-root, y-root, state, button,
same-screen?.
- motion-notify:
-
window, root-window, sub-window, time,
x, y, x-root, y-root, state, is-hint?,
same-screen?.
- enter-notify, leave-notify:
-
window, root-window, sub-window, time,
x, y, x-root, y-root, cross-mode,
cross-detail (one of the symbols ancestor, virtual,
inferior, nonlinear, nonlinear-virtual),
same-screen?, focus?, button-mask.
- focus-in, focus-out:
-
window, cross-mode, focus-detail (one of the symbols
ancestor, virtual, inferior, nonlinear,
nonlinear-virtual, pointer, pointer-root, none).
- keymap-notify:
-
window, keymap (a string of length 32).
- expose:
-
window, x, y, width, height, count.
- graphics-expose:
-
window, x, y, width, height, count,
major-code, minor-code.
- no-expose:
-
window, major-code, minor-code.
- visibility-notify:
-
window, visibility-state (one of the symbols unobscured,
partially-obscured, fully-obscured).
- create-notify:
-
parent-window, window, x, y, width, height,
border-width, override-redirect?.
- destroy-notify:
-
event-window, window.
- unmap-notify:
-
event-window, window, from-configure.
- map-notify:
-
event-window, window, override-redirect.
- map-request:
-
parent-window, window.
- reparent-notify:
-
event-window, parent-window, window, x, y,
override-redirect.
- configure-notify:
-
event-window, window, x, y, width,
height, border-width, above-window,
override-redirect?.
- configure-request:
-
parent-window, window, x, y, width, height,
border-width, above-window, stack-mode (see
set-window-stack-mode! above), value-mask (an integer).
- gravity-notify:
-
event-window, window, x, y.
- resize-request:
-
window, width, height.
- circulate-notify:
-
event-window, window, place.
- circulate-request:
-
parent-window, window, place.
- property-notify:
-
window, atom, time, property-state (one of the
symbols new-value, deleted).
- selection-clear:
-
window, selection-atom, time.
- selection-request:
-
owner-window, requestor-window, selection-atom,
target-atom, property-atom, time.
- selection-notify:
-
requestor-window, selection-atom, target-atom,
property-atom, time.
- colormap-notify:
-
window, colormap, new?, colormap-installed?.
- client-message:
-
window, message type (an atom), message data
(a string of length 20, or a vector of 10 or 5 integer numbers,
or, if the format field of the event is wrong, the format as a
number).
- mapping-notify:
-
window, request (one of the symbols modifier,
keyboard, pointer), keycode, count.
Markup created by unroff 1.0, September 24, 1996, net@informatik.uni-bremen.de