Mercurial > emacs
changeset 25254:518d62d71d21
(MINSIZE): Removed.
(window_min_size): New.
(set_window_height): Use window_min_size.
(change_window_height): Ditto.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 13 Aug 1999 20:51:51 +0000 |
parents | 2b995720c93e |
children | 29c5c79b1483 |
files | src/window.c |
diffstat | 1 files changed, 52 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/window.c Fri Aug 13 17:52:48 1999 +0000 +++ b/src/window.c Fri Aug 13 20:51:51 1999 +0000 @@ -51,7 +51,7 @@ static void window_scroll P_ ((Lisp_Object, int, int, int)); static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int)); static void window_scroll_line_based P_ ((Lisp_Object, int, int, int)); - +static int window_min_size P_ ((struct window *, int)); /* This is the window in which the terminal's cursor should @@ -1884,6 +1884,33 @@ *cols = MIN_SAFE_WINDOW_WIDTH; } + +/* Return the minimum size of window W. WIDTH_P non-zero means + return the minimum width, otherwise return the minimum height. */ + +static INLINE int +window_min_size (w, width_p) + struct window *w; + int width_p; +{ + int size; + + if (width_p) + size = window_min_width; + else + { + if (MINI_WINDOW_P (w) + || (!WINDOW_WANTS_MODELINE_P (w) + && !WINDOW_WANTS_TOP_LINE_P (w))) + size = 1; + else + size = window_min_height; + } + + return size; +} + + /* Normally the window is deleted if it gets too small. nodelete nonzero means do not do this. (The caller should check later and do so if appropriate) */ @@ -1902,14 +1929,14 @@ check_min_window_sizes (); - if (!nodelete - && ! NILP (w->parent) - && (MINI_WINDOW_P (w) - ? height < 1 - : height < window_min_height)) + if (!nodelete && !NILP (w->parent)) { - delete_window (window); - return; + int min_height = window_min_size (w, 0); + if (height < min_height) + { + delete_window (window); + return; + } } XSETFASTINT (w->last_modified, 0); @@ -2755,11 +2782,7 @@ return XFASTINT (p->width); } -#define MINSIZE(w) \ - (widthflag \ - ? window_min_width \ - : (MINI_WINDOW_P (XWINDOW (w)) ? 1 : window_min_height)) - + #define CURBEG(w) \ *(widthflag ? (int *) &(XWINDOW (w)->left) : (int *) &(XWINDOW (w)->top)) @@ -2811,8 +2834,12 @@ register int maxdelta; maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep - : !NILP (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next) - : !NILP (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev) + : !NILP (p->next) ? ((*sizefun) (p->next) + - window_min_size (XWINDOW (p->next), + widthflag)) + : !NILP (p->prev) ? ((*sizefun) (p->prev) + - window_min_size (XWINDOW (p->prev), + widthflag)) /* This is a frame with only one window, a minibuffer-only or a minibufferless frame. */ : (delta = 0)); @@ -2824,7 +2851,7 @@ delta = maxdelta; } - if (*sizep + delta < MINSIZE (window)) + if (*sizep + delta < window_min_size (XWINDOW (window), widthflag)) { delete_window (window); return; @@ -2836,9 +2863,11 @@ /* Find the total we can get from other siblings. */ maximum = 0; for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) - maximum += (*sizefun) (next) - MINSIZE (next); + maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), + widthflag); for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) - maximum += (*sizefun) (prev) - MINSIZE (prev); + maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), + widthflag); /* If we can get it all from them, do so. */ if (delta <= maximum) @@ -2858,7 +2887,8 @@ break; if (! NILP (next)) { - int this_one = (*sizefun) (next) - MINSIZE (next); + int this_one = ((*sizefun) (next) + - window_min_size (XWINDOW (next), widthflag)); if (this_one > delta) this_one = delta; @@ -2872,7 +2902,8 @@ break; if (! NILP (prev)) { - int this_one = (*sizefun) (prev) - MINSIZE (prev); + int this_one = ((*sizefun) (prev) + - window_min_size (XWINDOW (prev), widthflag)); if (this_one > delta) this_one = delta; @@ -2935,7 +2966,7 @@ /* Adjust glyph matrices. */ adjust_glyphs (XFRAME (WINDOW_FRAME (XWINDOW (window)))); } -#undef MINSIZE + #undef CURBEG #undef CURSIZE