Event Loop
**********
The event loop reads all X events received on any of the windows that
Sawfish is aware off. Many of these events invoke hooks, as described
in Note:Standard Hooks. Keyboard and pointer events are translated to
their Lisp equivalents (Note:Events) and then used to scan all
active keymaps for a binding. If a binding is found, the associated
command is invoked through the `call-command' function.
The active keymaps are determined as follows:
* If the variable `override-keymap' is non-nil, then this is the
only keymap searched
* Otherwise three keymaps are searched:
1. the `keymap' property of the currently "clicked" frame part
if there is one,
2. the `keymap' property of the currently focused window
3. the contents of the variable `global-keymap'.
Note that for `ButtonRelease' events, the frame part's keymap is
only searched if the pointer is actually within the frame part when the
release event occurs.
If no binding may be found in any of the active keymaps, then the
`unbound-key-hook' hook is called. This is an `or' type hook--the first
function that returns non-nil will terminate the hook call.
- Function: lookup-event-binding event
Perform the usual binding lookup for the event object OBJECT.
Returns the command found, or `nil' if no binding exists.
By default, both key-release events, and events that are bound to
modifier keys (e.g. <Control_L>), are ignored. However, this behavior
may be changed:
- Variable: eval-modifier-events
When non-nil, key events bound to modifier keys are evaluated.
- Variable: eval-key-release-events
When non-nil, key-release events are evaluated.
While a command is being evaluated, information about the event that
caused it may be found:
- Function: current-event
Return the event which caused the current command to be invoked
- Function: current-event-string
Returns the string which the current event would usually insert.
- Function: current-event-window
Return the window that received the current event, or the symbol
`root', or `nil' if no such window.
- Function: last-event
Return the previous event which occurred.
- Function: proxy-current-event window &optional mask propagate
Send the current X event to WINDOW, either a window object, a
numeric window id, or the symbol `root'. If a `ButtonPress' event
the pointer grab will be released first.
MASK may be an integer defining the X event mask to pass to the
`XSendEvent' function. If not defined, a mask is chosen that would
usually be used to select the type of event being proxied.
- Function: allow-events mode
This is a wrapper for the `XAllowEvents' function. The MODE
parameter may be one of the following symbols: `async-pointer',
`async-keyboard', `sync-pointer', `sync-keyboard',
`replay-pointer', `replay-keyboard', `async-both', `sync-both'.
Events that have to be grabbed to be received (i.e. all bindings
in the `global-keymap' and the `window-keymap') are grabbed
synchronously. This means that no more events will be received
until either the command returns, or `allow-events' is called.
This is normally not important, but if the command expects to
receive further events it must call `allow-events'. See the
interactive move and resize functions for an example.
- Function: forget-button-press
Cause the next button press to be treated as a single click event,
no matter how soon it occurs after the prevous button-press event.
- Function: accept-x-input &optional mask
Handle any X events received. If MASK is non-nil then only events
matching this numeric value are handled (see the X header files for
details).
- Function: x-events-queued
Returns the number of X events waiting to be handled.