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

39.8 Input Focus

At any time, one frame in SXEmacs is the selected frame. The selected window always resides on the selected frame. As the focus moves from device to device, the selected frame on each device is remembered and restored when the focus moves back to that device.

Function: selected-frame &optional device

This function returns the selected frame on device. If device is not specified, the selected device will be used. If no frames exist on the device, nil is returned.

The X server normally directs keyboard input to the X window that the mouse is in. Some window managers use mouse clicks or keyboard events to shift the focus to various X windows, overriding the normal behavior of the server.

Lisp programs can switch frames “temporarily” by calling the function select-frame. This does not override the window manager; rather, it escapes from the window manager’s control until that control is somehow reasserted.

When using a text-only terminal, there is no window manager; therefore, select-frame is the only way to switch frames, and the effect lasts until overridden by a subsequent call to select-frame. Only the selected terminal frame is actually displayed on the terminal. Each terminal screen except for the initial one has a number, and the number of the selected frame appears in the mode line after the word ‘XEmacs’ (see Modeline Variables).

Function: select-frame frame

This function selects frame frame, temporarily disregarding the focus of the X server if any. The selection of frame lasts until the next time the user does something to select a different frame, or until the next time this function is called.

Note that select-frame does not actually cause the window-system focus to be set to this frame, or the select-frame-hook or deselect-frame-hook to be run, until the next time that XEmacs is waiting for an event.

Also note that when the variable focus-follows-mouse is non-nil, the frame selection is temporary and is reverted when the current command terminates, much like the buffer selected by set-buffer. In order to effect a permanent focus change use focus-frame.

Function: focus-frame frame

This function selects frame and gives it the window system focus. The operation of focus-frame is not affected by the value of focus-follows-mouse.

Special Form: save-selected-frame forms…

This special form records the selected frame, executes forms in sequence, then restores the earlier selected frame. The value returned is the value of the last form.

Special Form: with-selected-frame frame forms…

This special form records the selected frame, then selects frame and executes forms in sequence. After the last form is finished, the earlier selected frame is restored. The value returned is the value of the last form.

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