window-top-child

window-top-child is a built-in function in `C source code'.

(window-top-child &optional WINDOW)

Return the topmost child window of window WINDOW.
WINDOW must be a valid window and defaults to the selected one.
Return nil if WINDOW is a live window (live windows have no children).
Return nil if WINDOW is an internal window whose children form a
horizontal combination.