Function: redirect-frame-focus
redirect-frame-focus is a function defined in frame.c.
Signature
(redirect-frame-focus FRAME FOCUS-FRAME)
Documentation
Arrange for keystrokes typed at FRAME to be sent to FOCUS-FRAME.
In other words, switch-frame events caused by events in FRAME will
request a switch to FOCUS-FRAME, and last-event-frame will be
FOCUS-FRAME after reading an event typed at FRAME.
If FOCUS-FRAME is nil, any existing redirection is canceled, and the frame again receives its own keystrokes.
Focus redirection is useful for temporarily redirecting keystrokes to a surrogate minibuffer frame when a frame doesn't have its own minibuffer window.
A frame's focus redirection can be changed by select-frame. If frame
FOO is selected, and then a different frame BAR is selected, any
frames redirecting their focus to FOO are shifted to redirect their
focus to BAR. This allows focus redirection to work properly when the
user switches from one frame to another using select-window.
This means that a frame whose focus is redirected to itself is treated
differently from a frame whose focus is redirected to nil; the former
is affected by select-frame, while the latter is not.
The redirection lasts until redirect-frame-focus is called to change it.
Source Code
// Defined in /usr/src/emacs/src/frame.c
{
/* Note that we don't check for a live frame here. It's reasonable
to redirect the focus of a frame you're about to delete, if you
know what other frame should receive those keystrokes. */
struct frame *f = decode_any_frame (frame);
if (! NILP (focus_frame))
CHECK_LIVE_FRAME (focus_frame);
fset_focus_frame (f, focus_frame);
if (FRAME_TERMINAL (f)->frame_rehighlight_hook)
(*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f);
return Qnil;
}