aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann1999-08-13 20:51:51 +0000
committerGerd Moellmann1999-08-13 20:51:51 +0000
commitc1636aa6ab1112f2131b13df93d0687d0c6c0ba5 (patch)
tree8bcdda1ab621473847448f56e8ecb05cd2e5b030 /src
parent5b957ad81e6ca5ecdcbae1a75fbd52e6af4c3d41 (diff)
downloademacs-c1636aa6ab1112f2131b13df93d0687d0c6c0ba5.tar.gz
emacs-c1636aa6ab1112f2131b13df93d0687d0c6c0ba5.zip
(MINSIZE): Removed.
(window_min_size): New. (set_window_height): Use window_min_size. (change_window_height): Ditto.
Diffstat (limited to 'src')
-rw-r--r--src/window.c73
1 files changed, 52 insertions, 21 deletions
diff --git a/src/window.c b/src/window.c
index fc238d967c1..9f33695527b 100644
--- a/src/window.c
+++ b/src/window.c
@@ -51,7 +51,7 @@ static int get_leaf_windows P_ ((struct window *, struct window **, int));
51static void window_scroll P_ ((Lisp_Object, int, int, int)); 51static void window_scroll P_ ((Lisp_Object, int, int, int));
52static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int)); 52static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int));
53static void window_scroll_line_based P_ ((Lisp_Object, int, int, int)); 53static void window_scroll_line_based P_ ((Lisp_Object, int, int, int));
54 54static int window_min_size P_ ((struct window *, int));
55 55
56 56
57/* This is the window in which the terminal's cursor should 57/* This is the window in which the terminal's cursor should
@@ -1884,6 +1884,33 @@ check_frame_size (frame, rows, cols)
1884 *cols = MIN_SAFE_WINDOW_WIDTH; 1884 *cols = MIN_SAFE_WINDOW_WIDTH;
1885} 1885}
1886 1886
1887
1888/* Return the minimum size of window W. WIDTH_P non-zero means
1889 return the minimum width, otherwise return the minimum height. */
1890
1891static INLINE int
1892window_min_size (w, width_p)
1893 struct window *w;
1894 int width_p;
1895{
1896 int size;
1897
1898 if (width_p)
1899 size = window_min_width;
1900 else
1901 {
1902 if (MINI_WINDOW_P (w)
1903 || (!WINDOW_WANTS_MODELINE_P (w)
1904 && !WINDOW_WANTS_TOP_LINE_P (w)))
1905 size = 1;
1906 else
1907 size = window_min_height;
1908 }
1909
1910 return size;
1911}
1912
1913
1887/* Normally the window is deleted if it gets too small. nodelete 1914/* Normally the window is deleted if it gets too small. nodelete
1888 nonzero means do not do this. (The caller should check later and 1915 nonzero means do not do this. (The caller should check later and
1889 do so if appropriate) */ 1916 do so if appropriate) */
@@ -1902,14 +1929,14 @@ set_window_height (window, height, nodelete)
1902 1929
1903 check_min_window_sizes (); 1930 check_min_window_sizes ();
1904 1931
1905 if (!nodelete 1932 if (!nodelete && !NILP (w->parent))
1906 && ! NILP (w->parent)
1907 && (MINI_WINDOW_P (w)
1908 ? height < 1
1909 : height < window_min_height))
1910 { 1933 {
1911 delete_window (window); 1934 int min_height = window_min_size (w, 0);
1912 return; 1935 if (height < min_height)
1936 {
1937 delete_window (window);
1938 return;
1939 }
1913 } 1940 }
1914 1941
1915 XSETFASTINT (w->last_modified, 0); 1942 XSETFASTINT (w->last_modified, 0);
@@ -2755,11 +2782,7 @@ window_width (window)
2755 return XFASTINT (p->width); 2782 return XFASTINT (p->width);
2756} 2783}
2757 2784
2758#define MINSIZE(w) \ 2785
2759 (widthflag \
2760 ? window_min_width \
2761 : (MINI_WINDOW_P (XWINDOW (w)) ? 1 : window_min_height))
2762
2763#define CURBEG(w) \ 2786#define CURBEG(w) \
2764 *(widthflag ? (int *) &(XWINDOW (w)->left) : (int *) &(XWINDOW (w)->top)) 2787 *(widthflag ? (int *) &(XWINDOW (w)->left) : (int *) &(XWINDOW (w)->top))
2765 2788
@@ -2811,8 +2834,12 @@ change_window_height (delta, widthflag)
2811 register int maxdelta; 2834 register int maxdelta;
2812 2835
2813 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep 2836 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep
2814 : !NILP (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next) 2837 : !NILP (p->next) ? ((*sizefun) (p->next)
2815 : !NILP (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev) 2838 - window_min_size (XWINDOW (p->next),
2839 widthflag))
2840 : !NILP (p->prev) ? ((*sizefun) (p->prev)
2841 - window_min_size (XWINDOW (p->prev),
2842 widthflag))
2816 /* This is a frame with only one window, a minibuffer-only 2843 /* This is a frame with only one window, a minibuffer-only
2817 or a minibufferless frame. */ 2844 or a minibufferless frame. */
2818 : (delta = 0)); 2845 : (delta = 0));
@@ -2824,7 +2851,7 @@ change_window_height (delta, widthflag)
2824 delta = maxdelta; 2851 delta = maxdelta;
2825 } 2852 }
2826 2853
2827 if (*sizep + delta < MINSIZE (window)) 2854 if (*sizep + delta < window_min_size (XWINDOW (window), widthflag))
2828 { 2855 {
2829 delete_window (window); 2856 delete_window (window);
2830 return; 2857 return;
@@ -2836,9 +2863,11 @@ change_window_height (delta, widthflag)
2836 /* Find the total we can get from other siblings. */ 2863 /* Find the total we can get from other siblings. */
2837 maximum = 0; 2864 maximum = 0;
2838 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) 2865 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next)
2839 maximum += (*sizefun) (next) - MINSIZE (next); 2866 maximum += (*sizefun) (next) - window_min_size (XWINDOW (next),
2867 widthflag);
2840 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) 2868 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev)
2841 maximum += (*sizefun) (prev) - MINSIZE (prev); 2869 maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev),
2870 widthflag);
2842 2871
2843 /* If we can get it all from them, do so. */ 2872 /* If we can get it all from them, do so. */
2844 if (delta <= maximum) 2873 if (delta <= maximum)
@@ -2858,7 +2887,8 @@ change_window_height (delta, widthflag)
2858 break; 2887 break;
2859 if (! NILP (next)) 2888 if (! NILP (next))
2860 { 2889 {
2861 int this_one = (*sizefun) (next) - MINSIZE (next); 2890 int this_one = ((*sizefun) (next)
2891 - window_min_size (XWINDOW (next), widthflag));
2862 if (this_one > delta) 2892 if (this_one > delta)
2863 this_one = delta; 2893 this_one = delta;
2864 2894
@@ -2872,7 +2902,8 @@ change_window_height (delta, widthflag)
2872 break; 2902 break;
2873 if (! NILP (prev)) 2903 if (! NILP (prev))
2874 { 2904 {
2875 int this_one = (*sizefun) (prev) - MINSIZE (prev); 2905 int this_one = ((*sizefun) (prev)
2906 - window_min_size (XWINDOW (prev), widthflag));
2876 if (this_one > delta) 2907 if (this_one > delta)
2877 this_one = delta; 2908 this_one = delta;
2878 2909
@@ -2935,7 +2966,7 @@ change_window_height (delta, widthflag)
2935 /* Adjust glyph matrices. */ 2966 /* Adjust glyph matrices. */
2936 adjust_glyphs (XFRAME (WINDOW_FRAME (XWINDOW (window)))); 2967 adjust_glyphs (XFRAME (WINDOW_FRAME (XWINDOW (window))));
2937} 2968}
2938#undef MINSIZE 2969
2939#undef CURBEG 2970#undef CURBEG
2940#undef CURSIZE 2971#undef CURSIZE
2941 2972