/[emacs]/emacs/src/window.c
ViewVC logotype

Diff of /emacs/src/window.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.396 by raeburn, Thu Dec 27 05:49:33 2001 UTC revision 1.397 by rms, Tue Jan 8 05:41:37 2002 UTC
# Line 1214  delete_window (window) Line 1214  delete_window (window)
1214    
1215    /* Are we trying to delete any frame's selected window?  */    /* Are we trying to delete any frame's selected window?  */
1216    {    {
1217      Lisp_Object pwindow;      Lisp_Object swindow, pwindow;
1218    
1219      /* See if the frame's selected window is either WINDOW      /* See if the frame's selected window is either WINDOW
1220         or any subwindow of it, by finding all that window's parents         or any subwindow of it, by finding all that window's parents
1221         and comparing each one with WINDOW.  */         and comparing each one with WINDOW.  */
1222      pwindow = FRAME_SELECTED_WINDOW (f);      swindow = FRAME_SELECTED_WINDOW (f);
1223    
1224      while (!NILP (pwindow))      while (1)
1225        {        {
1226          if (EQ (window, pwindow))          pwindow = swindow;
1227            while (!NILP (pwindow))
1228              {
1229                if (EQ (window, pwindow))
1230                  break;
1231                pwindow = XWINDOW (pwindow)->parent;
1232              }
1233    
1234            /* If the window being deleted is not a parent of SWINDOW,
1235               then SWINDOW is ok as the new selected window.  */
1236            if (!EQ (window, pwindow))
1237            break;            break;
1238          pwindow = XWINDOW (pwindow)->parent;          /* Otherwise, try another window for SWINDOW.  */
1239            swindow = Fnext_window (swindow, Qlambda, Qnil);;
1240    
1241            /* If we get back to the frame's selected window,
1242               it means there was no acceptable alternative,
1243               so we cannot delete.  */
1244            if (EQ (swindow, FRAME_SELECTED_WINDOW (f)))
1245              error ("Cannot delete window");
1246        }        }
1247    
1248      if (EQ (window, pwindow))      /* If we need to change SWINDOW, do it.  */
1249        if (! EQ (swindow, FRAME_SELECTED_WINDOW (f)))
1250        {        {
         Lisp_Object alternative;  
         alternative = Fnext_window (window, Qlambda, Qnil);  
   
1251          /* If we're about to delete the selected window on the          /* If we're about to delete the selected window on the
1252             selected frame, then we should use Fselect_window to select             selected frame, then we should use Fselect_window to select
1253             the new window.  On the other hand, if we're about to             the new window.  On the other hand, if we're about to
1254             delete the selected window on any other frame, we shouldn't do             delete the selected window on any other frame, we shouldn't do
1255             anything but set the frame's selected_window slot.  */             anything but set the frame's selected_window slot.  */
1256          if (EQ (window, selected_window))          if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))
1257            Fselect_window (alternative);            Fselect_window (swindow);
1258          else          else
1259            FRAME_SELECTED_WINDOW (f) = alternative;            FRAME_SELECTED_WINDOW (f) = swindow;
1260        }        }
1261    }    }
1262    
# Line 2372  window_min_size (w, width_p, ignore_fixe Line 2387  window_min_size (w, width_p, ignore_fixe
2387     WINDOW's width.  Resize WINDOW's children, if any, so that they     WINDOW's width.  Resize WINDOW's children, if any, so that they
2388     keep their proportionate size relative to WINDOW.  Propagate     keep their proportionate size relative to WINDOW.  Propagate
2389     WINDOW's top or left edge position to children.  Delete windows     WINDOW's top or left edge position to children.  Delete windows
2390     that become too small unless NODELETE_P is non-zero.  */     that become too small unless NODELETE_P is non-zero.
2391    
2392       If NODELETE_P is 2, that means we do delete windows that are
2393       too small, even if they were too small before!  */
2394    
2395  static void  static void
2396  size_window (window, size, width_p, nodelete_p)  size_window (window, size, width_p, nodelete_p)
# Line 2384  size_window (window, size, width_p, node Line 2402  size_window (window, size, width_p, node
2402    Lisp_Object child, *forward, *sideward;    Lisp_Object child, *forward, *sideward;
2403    int old_size, min_size;    int old_size, min_size;
2404    
2405      if (nodelete_p == 2)
2406        nodelete_p = 0;
2407    
2408    check_min_window_sizes ();    check_min_window_sizes ();
2409    size = max (0, size);    size = max (0, size);
2410        
# Line 2400  size_window (window, size, width_p, node Line 2421  size_window (window, size, width_p, node
2421        old_size = XINT (w->height);        old_size = XINT (w->height);
2422        min_size = window_min_height;        min_size = window_min_height;
2423      }      }
2424      
2425    if (old_size < min_size)    if (old_size < min_size && nodelete_p != 2)
2426      w->too_small_ok = Qt;      w->too_small_ok = Qt;
2427    
2428    /* Maybe delete WINDOW if it's too small.  */    /* Maybe delete WINDOW if it's too small.  */
2429    if (!nodelete_p && !NILP (w->parent))    if (nodelete_p != 1 && !NILP (w->parent))
2430      {      {
2431        if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok))        if (!MINI_WINDOW_P (w) && !NILP (w->too_small_ok))
2432          min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT;          min_size = width_p ? MIN_SAFE_WINDOW_WIDTH : MIN_SAFE_WINDOW_HEIGHT;
# Line 2531  size_window (window, size, width_p, node Line 2552  size_window (window, size, width_p, node
2552              int child_size;              int child_size;
2553              c = XWINDOW (child);              c = XWINDOW (child);
2554              child_size = width_p ? XINT (c->width) : XINT (c->height);              child_size = width_p ? XINT (c->width) : XINT (c->height);
2555              size_window (child, child_size, width_p, 0);              size_window (child, child_size, width_p, 2);
2556            }            }
2557      }      }
2558  }  }

Legend:
Removed from v.1.396  
changed lines
  Added in v.1.397

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26