changeset 31930:9c779861abff

(x_set_tool_bar_lines): Don't use more lines for the tool-bar than is available. (x_change_window_heights): Renamed from x_set_menu_bar_lines_1.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 27 Sep 2000 11:42:27 +0000
parents 366aa501ad5a
children 85c245edb7d7
files src/xfns.c
diffstat 1 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Wed Sep 27 11:39:14 2000 +0000
+++ b/src/xfns.c	Wed Sep 27 11:42:27 2000 +0000
@@ -744,6 +744,7 @@
   void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object));
 };
 
+static void x_change_window_heights P_ ((Lisp_Object, int));
 static void x_disable_image P_ ((struct frame *, struct image *));
 static void x_create_im P_ ((struct frame *));
 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
@@ -1916,9 +1917,12 @@
   else
     Fmake_frame_visible (frame);
 }
+
 
+/* Change window heights in windows rooted in WINDOW by N lines.  */
+
 static void
-x_set_menu_bar_lines_1 (window, n)
+x_change_window_heights (window, n)
   Lisp_Object window;
   int n;
 {
@@ -1934,13 +1938,13 @@
 
   /* Handle just the top child in a vertical split.  */
   if (!NILP (w->vchild))
-    x_set_menu_bar_lines_1 (w->vchild, n);
+    x_change_window_heights (w->vchild, n);
 
   /* Adjust all children in a horizontal split.  */
   for (window = w->hchild; !NILP (window); window = w->next)
     {
       w = XWINDOW (window);
-      x_set_menu_bar_lines_1 (window, n);
+      x_change_window_heights (window, n);
     }
 }
 
@@ -1988,7 +1992,7 @@
     }
 #else /* not USE_X_TOOLKIT */
   FRAME_MENU_BAR_LINES (f) = nlines;
-  x_set_menu_bar_lines_1 (f->root_window, nlines - olines);
+  x_change_window_heights (f->root_window, nlines - olines);
 #endif /* not USE_X_TOOLKIT */
   adjust_glyphs (f);
 }
@@ -2005,7 +2009,8 @@
      struct frame *f;
      Lisp_Object value, oldval;
 {
-  int delta, nlines;
+  int delta, nlines, root_height;
+  Lisp_Object root_window;
 
   /* Use VALUE only if an integer >= 0.  */
   if (INTEGERP (value) && XINT (value) >= 0)
@@ -2017,8 +2022,18 @@
   ++windows_or_buffers_changed;
 
   delta = nlines - FRAME_TOOL_BAR_LINES (f);
+
+  /* Don't resize the tool-bar to more than we have room for.  */
+  root_window = FRAME_ROOT_WINDOW (f);
+  root_height = XINT (XWINDOW (root_window)->height);
+  if (root_height - delta < 1)
+    {
+      delta = root_height - 1;
+      nlines = FRAME_TOOL_BAR_LINES (f) + delta;
+    }
+
   FRAME_TOOL_BAR_LINES (f) = nlines;
-  x_set_menu_bar_lines_1 (FRAME_ROOT_WINDOW (f), delta);
+  x_change_window_heights (root_window, delta);
   adjust_glyphs (f);
 }