12.7 Managing Input Focus

CLX provides the set-focus-input and focus-input functions to set and get the keyboard input focus window.



set-input-focus display focus revert-to &optional time Function
        
display
A display.
focus
The new input focus window.
revert-to
The focus window when focus is no longer viewable.
time
A timestamp.

Changes the keyboard input focus and the last-focus-change time. The function has no effect if the specified time is earlier than the current last-focus-change time or is later than the current server time; otherwise, the last-focus-change time is set to the specified time. The set-input-focus function causes the X server to generate :focus-in and :focus-out events.

If :none is specified as the focus, all keyboard events are discarded until a new focus window is set. In this case, the revert-to argument is ignored.

If a window is specified as the focus argument, it becomes the keyboard's focus window. If a generated keyboard event would normally be reported to this window or one of its inferiors, the event is reported normally; otherwise, the event is reported with respect to the focus window.

If :pointer-root is specified as the focus argument, the input focus window is set to the root window of the screen containing the pointer when each keyboard event occurs. In this case, the revert-to argument is ignored.

The specified focus window must be viewable at the time of the request. If the focus window later becomes not viewable, the new focus window depends on the revert-to argument. If revert-to is specified as :parent, the focus reverts to the parent (or the closest viewable ancestor) and the new revert-to value is take to be :none. If revert-to is :pointer-root or :none, the focus reverts to that value. When the focus reverts, :focus-in and :focus-out events are generated, but the last-focus-change time is not affected.



input-focus display Function
        
display
A display.

Returns the focus window, :pointer-root, or :none, depending on the current state of the focus window. revert-to returns the current focus revert-to state.

focus
Type (or window (member :none :pointer-root)).
revert-to
Type (or window (member :none :pointer-root :parent)).