diff src/frame.c @ 6527:ab9f20a3f502

(Fframe_first_window): New function.
author Karl Heuer <kwzh@gnu.org>
date Fri, 25 Mar 1994 06:12:40 +0000
parents 551bff5cffde
children 0d5dec708788
line wrap: on
line diff
--- a/src/frame.c	Fri Mar 25 03:34:45 1994 +0000
+++ b/src/frame.c	Fri Mar 25 06:12:40 1994 +0000
@@ -464,6 +464,33 @@
   return XWINDOW (window)->frame;
 }
 
+DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0,
+  "Returns the topmost, leftmost window of FRAME.\n\
+If omitted, FRAME defaults to the currently selected frame.")
+  (frame)
+     Lisp_Object frame;
+{
+  Lisp_Object w;
+
+  if (NILP (frame))
+    w = selected_frame->root_window;
+  else
+    {
+      CHECK_LIVE_FRAME (frame, 0);
+      w = XFRAME (frame)->root_window;
+    }
+  while (NILP (XWINDOW (w)->buffer))
+    {
+      if (! NILP (XWINDOW (w)->hchild))
+	w = XWINDOW (w)->hchild;
+      else if (! NILP (XWINDOW (w)->vchild))
+	w = XWINDOW (w)->vchild;
+      else
+	abort ();
+    }
+  return w;
+}
+
 DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
        "Returns the root-window of FRAME.\n\
 If omitted, FRAME defaults to the currently selected frame.")