changeset 3723:ccb9c93aac80

(Fdelete_window): Handle deleting a parent of the selected window. (Fdelete_window): Mostly undo last change which made `frame' a FRAME_PTR. Don't initialize `frame' in the declaration.
author Richard M. Stallman <rms@gnu.org>
date Mon, 14 Jun 1993 07:07:05 +0000
parents c9938769a6b7
children dc73f3152d2f
files src/window.c
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Mon Jun 14 03:51:20 1993 +0000
+++ b/src/window.c	Mon Jun 14 07:07:05 1993 +0000
@@ -700,9 +700,22 @@
 
   /* Are we trying to delete any frame's selected window?  */
   {
-    FRAME_PTR frame = WINDOW_FRAME (XWINDOW (window));
-
-    if (EQ (window, FRAME_SELECTED_WINDOW (frame)))
+    Lisp_Object frame, pwindow;
+
+    /* See if the frame's selected window is either WINDOW
+       or any subwindow of it, by finding all that window's parents
+       and comparing each one with WINDOW.  */
+    frame = WINDOW_FRAME (XWINDOW (window));
+    pwindow = FRAME_SELECTED_WINDOW (XFRAME (frame));
+
+    while (!NILP (pwindow))
+      {
+	if (EQ (window, pwindow))
+	  break;
+	pwindow = XWINDOW (pwindow)->parent;
+      }
+
+    if (EQ (window, pwindow))
       {
 	Lisp_Object alternative = Fnext_window (window, Qlambda, Qnil);
 
@@ -714,7 +727,7 @@
 	if (EQ (window, selected_window))
 	  Fselect_window (alternative);
 	else
-	  FRAME_SELECTED_WINDOW (frame) = alternative;
+	  FRAME_SELECTED_WINDOW (XFRAME (frame)) = alternative;
       }
   }