Mercurial > emacs
changeset 972:f47d221cbfe6
* window.c (MIN_SAFE_WINDOW_HEIGHT, MIN_SAFE_WINDOW_WIDTH): Macros
defined here now, rather than window.h.
(check_frame_size): New function.
* window.c (FRAME_IS_TERMCAP, FRAME_IS_X, FRAME_HAS_MINIBUF):
Renamed these to FRAME_TERMCAP_P, FRAME_X_P, and
FRAME_HAS_MINIBUF_P, for consistency with the rest of the
frame macros.
* window.c (check_min_window_sizes): New function.
(set_window_height): Call it.
(Fsplit_window, change_window_height): Call it, instead of writing
out its code.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 12 Aug 1992 14:28:27 +0000 |
parents | 85adc3a66e22 |
children | 52267046b144 |
files | src/window.c |
diffstat | 1 files changed, 45 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/window.c Wed Aug 12 14:23:38 1992 +0000 +++ b/src/window.c Wed Aug 12 14:28:27 1992 +0000 @@ -1244,6 +1244,46 @@ } /* Set the height of WINDOW and all its inferiors. */ + +/* The smallest acceptable dimensions for a window. Anything smaller + might crash Emacs. */ +#define MIN_SAFE_WINDOW_WIDTH (2) +#define MIN_SAFE_WINDOW_HEIGHT (2) + +/* Make sure that window_min_height and window_min_width are + not too small; if they are, set them to safe minima. */ + +static void +check_min_window_sizes () +{ + /* Smaller values might permit a crash. */ + if (window_min_width < MIN_SAFE_WINDOW_WIDTH) + window_min_width = MIN_SAFE_WINDOW_WIDTH; + if (window_min_height < MIN_SAFE_WINDOW_HEIGHT) + window_min_height = MIN_SAFE_WINDOW_HEIGHT; +} + +/* If *ROWS or *COLS are too small a size for FRAME, set them to the + minimum allowable size. */ +extern void +check_frame_size (frame, rows, cols) +FRAME_PTR frame; +int *rows, *cols; +{ + /* For height, we have to see whether the frame has a minibuffer, and + whether it wants a mode line. */ + int min_height = + ((FRAME_MINIBUF_ONLY_P (frame) + || ! FRAME_HAS_MINIBUF_P (frame)) + ? MIN_SAFE_WINDOW_HEIGHT + : 2 * MIN_SAFE_WINDOW_HEIGHT - 1); + + if (*rows < min_height) + *rows = min_height; + if (*cols < MIN_SAFE_WINDOW_WIDTH) + *cols = MIN_SAFE_WINDOW_WIDTH; +} + /* 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) */ @@ -1259,6 +1299,8 @@ int top, pos, lastbot, opos, lastobot; Lisp_Object child; + check_min_window_sizes (); + if (!nodelete && ! NILP (w->parent) && height < window_min_height) @@ -1657,11 +1699,7 @@ else if (FRAME_NO_SPLIT_P (XFRAME (WINDOW_FRAME (o)))) error ("Attempt to split unsplittable frame"); - /* Smaller values might permit a crash. */ - if (window_min_width < 2) - window_min_width = 2; - if (window_min_height < 2) - window_min_height = 2; + check_min_window_sizes (); if (NILP (horflag)) { @@ -1795,11 +1833,7 @@ ? set_window_width : set_window_height); - /* Smaller values might permit a crash. */ - if (window_min_width < 2) - window_min_width = 2; - if (window_min_height < 2) - window_min_height = 2; + check_min_window_sizes (); window = selected_window; while (1) @@ -2415,7 +2449,7 @@ FRAME_ROOT_WINDOW (f) = data->root_window; #ifdef MULTI_FRAME - if (f != selected_frame && ! FRAME_IS_TERMCAP (f)) + if (f != selected_frame && ! FRAME_TERMCAP_P (f)) Fselect_frame (WINDOW_FRAME (XWINDOW (data->root_window)), Qnil); #endif