front-window

If owned-p is nil (the
default), returns the frontmost child window of
parent-stream, if any, and otherwise returns
nil.

If owned-p is true, returns
the frontmost owned window of parent-stream that
is not also a child window of parent-stream, if
any, and otherwise returns nil.

If states is non-nil,
then it should be a list of window state symbols, and windows whose
state is not in
this list are skipped. If nil (the default),
then these windows are not skipped. Valid symbols for this list are
:normal, :shrunk,
:icon, and :maximized. See
state.

If for-focus is true, then
windows whose events are currently disabled (see enable-events) are skipped, and
"static" control windows are skipped as well.
("Static" control
windows include static-text-pane, static-picture-pane,
and group-box-pane.) If nil (the default), then these windows are not
skipped. Such windows do not handle any keyboard events, so passing
this argument as true may be useful for finding a window to move the
keyboard focus to by calling set-focus.