frame-first-window

frame-first-window is a built-in function in `C source code'.

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

Return the topmost, leftmost live window on 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 first window
of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return
the first window of that frame.