Events received by a CLX client are stored in an event queue until they are read and processed. Events are processed by handler functions.
handler-function | &rest event-slots &key :display :event-key :send-event-p & allow-other-keys | Function |
The arguments to a handler function are keyword-value pairs that describe the contents of an event. The actual event-slots passed depend on the event type, except that :display, :event-key, and :send-event-p are given for all event types. The keyword symbols used for each event type are event slot names defined by the declare-event macro and are described in paragraph 12.12.8, Declaring Event Types. If a handler returns non-nil, the event is considered processed and can be removed from the event queue. Otherwise, if a handler function returns nil, the event can remain in the event queue for later processing.
|
process-event | display &key :handler :timeout :peek-p :discard-p (:force-output-p t) | Function |
Invokes :handler on each queued event until :handler returns non-nil. Then, the non-nil :handler value is returned by process-event. If :handler returns nil for each event in the event queue, process-event waits for another event to arrive. If timeout is non-nil and no event arrives within the specified timeout interval (given in seconds), process-event returns nil; if timeout is nil , process-event will not return until :handler returns non-nil. process-event may wait only once on network data, and therefore timeout prematurely. If :force-output-p is true, process-event first invokes display-force-output to send any buffered requests. If :peek-p is true, a processed event is not removed from the queue. If :discard-p is true, unprocessed events are removed from the queue; otherwise, unprocessed events are left in place. If :handler is a sequence, it is expected to contain handler functions for each event type. The sequence index of the handler function for a particular event type is given by ( position event-key *event-key-vector*).
|
event-case | display &key :timeout :peek-p :discard-p (:force-output-p t) &body clauses | Macro |
Executes the matching clause for each queued event until a clause returns non-nil. The non-nil clause value is then returned. Each of the clauses is a list of the form ( event-match [event-slots] &rest forms), where:
A clause matches an event if the event-key is equal to or a member of the event-match, or if the event-match is t or otherwise. If no t or otherwise clause appears, it is equivalent to having a final clause that returns nil. If event-slots is given, these symbols are bound to the value of the corresponding event slot in the clause forms. Each element of event-slots can also be a list of the form ( event-slot-keyword variable), in which case the variable symbol is bound to the value of the event slot specified by the event-slot-keyword. If every clause returns nil for each event in the event queue, event-case waits for another event to arrive. If :timeout is non-nil and no event arrives within the specified timeout interval (given in seconds), event-case returns nil; if :timeout is nil, event-case will not return until a clause returns non-nil. event-case may wait only once on network data and therefore timeout prematurely. If :force-output-p is true, event-case first invokes display-force-output to send any buffered requests. If :peek-p is true, a processed event is not removed from the queue. If :discard-p is true, unprocessed events are removed from the queue; otherwise, unprocessed events are left in place.
|
event-cond | display &key :timeout :peek-p :discard-p (:force-output-p t) &body clauses | Macro |
Similar to event-case except that each of the clauses is a list of the form (event-match [event-slots] test-form &rest forms). Executes the test-form of the clause that matches each queued event until a test-form returns non-nil. The body forms of the clause are then executed. The values returned by the last clause body form are then returned by event-cond . When a test-form returns true and :peek-p is nil, or when a test-form returns nil and :discard-p is true, the matching event is removed from the event queue before the body forms are executed.
|