Function: frame-selected-window

frame-selected-window is a function defined in window.c.

Signature

(frame-selected-window &optional FRAME-OR-WINDOW)

Documentation

Return the selected window of FRAME-OR-WINDOW.

If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. Else if FRAME-OR-WINDOW denotes a valid window, return the selected window of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return the selected window of that frame.

Source Code

// Defined in /usr/src/emacs/src/window.c
{
  Lisp_Object window;

  if (NILP (frame_or_window))
    window = SELECTED_FRAME ()->selected_window;
  else if (WINDOW_VALID_P (frame_or_window))
    window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window;
  else
    {
      CHECK_LIVE_FRAME (frame_or_window);
      window = XFRAME (frame_or_window)->selected_window;
    }

  return window;
}