Next: , Previous: , Up: Top   [Contents][Index]

19 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 Standard Hooks. Keyboard and pointer events are translated to their Lisp equivalents (see 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:

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 #!optional win

Extract the owning window of the current X event (this is a window object, or the symbol root for the root window, or nil if there is no window or no event). This is stored internally as the current event window, and returned.

If the optional argument win is a window, then it will be returned as the current event 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.

Propagate is a flag (nil/non-nil) passed directly to an underlying XSendEvent call. (And if someone would like to explain what that means, please do so ...

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.

Next: , Previous: , Up: Top   [Contents][Index]