emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xdisp.c,v


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/src/xdisp.c,v
Date: Fri, 29 Dec 2006 23:29:46 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kim F. Storm <kfstorm>  06/12/29 23:29:46

Index: xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1135
retrieving revision 1.1136
diff -u -b -r1.1135 -r1.1136
--- xdisp.c     15 Dec 2006 00:23:10 -0000      1.1135
+++ xdisp.c     29 Dec 2006 23:29:45 -0000      1.1136
@@ -283,10 +283,12 @@
 
 EMACS_INT tool_bar_button_relief;
 
-/* Non-zero means automatically resize tool-bars so that all tool-bar
-   items are visible, and no blank lines remain.  */
+/* Non-nil means automatically resize tool-bars so that all tool-bar
+   items are visible, and no blank lines remain.
 
-int auto_resize_tool_bars_p;
+   If value is `grow-only', only make tool-bar bigger.  */
+
+Lisp_Object Vauto_resize_tool_bars;
 
 /* Non-zero means draw block and hollow cursor as wide as the glyph
    under it.  For example, if a block cursor is over a tab, it will be
@@ -9694,9 +9696,16 @@
  out:;
 
   row->displays_text_p = row->used[TEXT_AREA] != 0;
-  /* Use default face for the border below the tool bar.  */
-  if (!row->displays_text_p)
+
+  /* Use default face for the border below the tool bar.
+
+     FIXME: When auto-resize-tool-bars is grow-only, there is
+     no additional border below the possibly empty tool-bar lines.
+     So to make the extra empty lines look "normal", we have to
+     use the tool-bar face for the border too.  */
+  if (!row->displays_text_p && !EQ (Vauto_resize_tool_bars, Qgrow_only))
     it->face_id = DEFAULT_FACE_ID;
+
   extend_face_to_end_of_line (it);
   last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1;
   last->right_box_line_p = 1;
@@ -9718,6 +9727,7 @@
   if (!row->displays_text_p)
     {
       row->height = row->phys_height = it->last_visible_y - row->y;
+      row->visible_height = row->height;
       row->ascent = row->phys_ascent = 0;
       row->extra_line_spacing = 0;
     }
@@ -9820,7 +9830,6 @@
   struct window *w;
   struct it it;
   struct glyph_row *row;
-  int change_height_p = 0;
 
 #ifdef USE_GTK
   if (FRAME_EXTERNAL_TOOL_BAR (f))
@@ -9915,10 +9924,10 @@
   w->desired_matrix->no_scrolling_p = 1;
   w->must_be_updated_p = 1;
 
-  if (auto_resize_tool_bars_p)
+  if (!NILP (Vauto_resize_tool_bars))
     {
-      int nlines, nrows;
       int max_tool_bar_height = MAX_FRAME_TOOL_BAR_HEIGHT (f);
+      int change_height_p = 0;
 
       /* If we couldn't display everything, change the tool-bar's
         height if there is room for more.  */
@@ -9944,14 +9953,22 @@
 
       /* Resize windows as needed by changing the `tool-bar-lines'
         frame parameter.  */
-      if (change_height_p
-         && (nlines = tool_bar_lines_needed (f, &nrows),
-             nlines != WINDOW_TOTAL_LINES (w)))
+      if (change_height_p)
        {
          extern Lisp_Object Qtool_bar_lines;
          Lisp_Object frame;
          int old_height = WINDOW_TOTAL_LINES (w);
+         int nrows;
+         int nlines = tool_bar_lines_needed (f, &nrows);
 
+         change_height_p = ((EQ (Vauto_resize_tool_bars, Qgrow_only)
+                             && !f->minimize_tool_bar_window_p)
+                            ? (nlines > old_height)
+                            : (nlines != old_height));
+         f->minimize_tool_bar_window_p = 0;
+
+         if (change_height_p)
+           {
          XSETFRAME (frame, f);
          Fmodify_frame_parameters (frame,
                                    Fcons (Fcons (Qtool_bar_lines,
@@ -9962,11 +9979,14 @@
              clear_glyph_matrix (w->desired_matrix);
              f->n_tool_bar_rows = nrows;
              fonts_changed_p = 1;
+                 return 1;
+               }
            }
        }
     }
 
-  return change_height_p;
+  f->minimize_tool_bar_window_p = 0;
+  return 0;
 }
 
 
@@ -13447,7 +13467,7 @@
 #else
       redisplay_tool_bar_p = WINDOWP (f->tool_bar_window)
         && (FRAME_TOOL_BAR_LINES (f) > 0
-            || auto_resize_tool_bars_p);
+            || !NILP (Vauto_resize_tool_bars));
 
 #endif
 
@@ -24077,12 +24097,13 @@
 unselects the minibuffer if it is active.  */);
   Vmouse_autoselect_window = Qnil;
 
-  DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p,
+  DEFVAR_LISP ("auto-resize-tool-bars", &Vauto_resize_tool_bars,
     doc: /* *Non-nil means automatically resize tool-bars.
-This increases a tool-bar's height if not all tool-bar items are visible.
-It decreases a tool-bar's height when it would display blank lines
-otherwise.  */);
-  auto_resize_tool_bars_p = 1;
+This dynamically changes the tool-bar's height to the minimum height
+that is needed to make all tool-bar items visible.
+If value is `grow-only', the tool-bar's height is only increased
+automatically; to decreace the tool-bar height, use \\[recenter].  */);
+  Vauto_resize_tool_bars = Qt;
 
   DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p,
     doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over 
them.  */);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]