diff src/toolbar.c @ 5077:d372b17f63ce

clean up toolbar/gutter edge geometry -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-25 Ben Wing <ben@xemacs.org> * EmacsFrame.c (EmacsFrameSetValues): * frame-impl.h: * frame-impl.h (struct frame): * frame-impl.h (FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT): * frame-impl.h (FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_HEIGHT): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_VISIBLE): * frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BOUNDS): * frame.h: * frame.h (enum edge_pos): * gutter.c: * gutter.c (get_gutter_coords): * gutter.c (display_boxes_in_gutter_p): * gutter.c (construct_window_gutter_spec): * gutter.c (calculate_gutter_size_from_display_lines): * gutter.c (calculate_gutter_size): * gutter.c (output_gutter): * gutter.c (clear_gutter): * gutter.c (mark_gutters): * gutter.c (gutter_extent_signal_changed_region_maybe): * gutter.c (update_gutter_geometry): * gutter.c (update_frame_gutter_geometry): * gutter.c (update_frame_gutters): * gutter.c (reset_gutter_display_lines): * gutter.c (redraw_exposed_gutter): * gutter.c (redraw_exposed_gutters): * gutter.c (free_frame_gutters): * gutter.c (decode_gutter_position): * gutter.c (Fset_default_gutter_position): * gutter.c (Fgutter_pixel_width): * gutter.c (Fgutter_pixel_height): * gutter.c (recompute_overlaying_specifier): * gutter.c (gutter_specs_changed_1): * gutter.c (gutter_specs_changed): * gutter.c (top_gutter_specs_changed): * gutter.c (bottom_gutter_specs_changed): * gutter.c (left_gutter_specs_changed): * gutter.c (right_gutter_specs_changed): * gutter.c (gutter_geometry_changed_in_window): * gutter.c (init_frame_gutters): * gutter.c (specifier_vars_of_gutter): * gutter.h: * gutter.h (WINDOW_REAL_TOP_GUTTER_BOUNDS): * gutter.h (FRAME_TOP_GUTTER_BOUNDS): * lisp.h (enum edge_style): * native-gtk-toolbar.c: * native-gtk-toolbar.c (gtk_output_toolbar): * native-gtk-toolbar.c (gtk_clear_toolbar): * native-gtk-toolbar.c (gtk_output_frame_toolbars): * native-gtk-toolbar.c (gtk_initialize_frame_toolbars): * toolbar-msw.c: * toolbar-msw.c (TOOLBAR_HANDLE): * toolbar-msw.c (allocate_toolbar_item_id): * toolbar-msw.c (mswindows_clear_toolbar): * toolbar-msw.c (mswindows_output_toolbar): * toolbar-msw.c (mswindows_move_toolbar): * toolbar-msw.c (mswindows_redraw_exposed_toolbars): * toolbar-msw.c (mswindows_initialize_frame_toolbars): * toolbar-msw.c (mswindows_output_frame_toolbars): * toolbar-msw.c (mswindows_clear_frame_toolbars): * toolbar-msw.c (DELETE_TOOLBAR): * toolbar-msw.c (mswindows_free_frame_toolbars): * toolbar-msw.c (mswindows_get_toolbar_button_text): * toolbar-xlike.c: * toolbar-xlike.c (__prepare_button_area): * toolbar-xlike.c (XLIKE_OUTPUT_BUTTONS_LOOP): * toolbar-xlike.c (xlike_output_toolbar): * toolbar-xlike.c (xlike_clear_toolbar): * toolbar-xlike.c (xlike_output_frame_toolbars): * toolbar-xlike.c (xlike_clear_frame_toolbars): * toolbar-xlike.c (xlike_redraw_exposed_toolbar): * toolbar-xlike.c (xlike_redraw_exposed_toolbars): * toolbar-xlike.c (xlike_redraw_frame_toolbars): * toolbar.c: * toolbar.c (decode_toolbar_position): * toolbar.c (Fset_default_toolbar_position): * toolbar.c (mark_frame_toolbar_buttons_dirty): * toolbar.c (compute_frame_toolbar_buttons): * toolbar.c (set_frame_toolbar): * toolbar.c (compute_frame_toolbars_data): * toolbar.c (update_frame_toolbars_geometry): * toolbar.c (init_frame_toolbars): * toolbar.c (get_toolbar_coords): * toolbar.c (CHECK_TOOLBAR): * toolbar.c (toolbar_buttons_at_pixpos): * toolbar.c (CTB_ERROR): * toolbar.c (recompute_overlaying_specifier): * toolbar.c (specifier_vars_of_toolbar): * toolbar.h: * toolbar.h (SET_TOOLBAR_WAS_VISIBLE_FLAG): Create new enum edge_pos with TOP_EDGE, BOTTOM_EDGE, LEFT_EDGE, RIGHT_EDGE; subsume TOP_BORDER, TOP_GUTTER, enum toolbar_pos, enum gutter_pos, etc. Create EDGE_POS_LOOP, subsuming GUTTER_POS_LOOP. Create NUM_EDGES, use in many places instead of hardcoded '4'. Instead of top_toolbar_was_visible, bottom_toolbar_was_visible, etc. make an array toolbar_was_visible[NUM_EDGES]. This increases the frame size by 15 bytes or so (could be 3 if we use Boolbytes) but hardly seems w to matter -- frames are heavy weight objects anyway. Same with top_gutter_was_visible, etc. Remove duplicated SET_TOOLBAR_WAS_VISIBLE_FLAG and put defn in one place (toolbar.h).
author Ben Wing <ben@xemacs.org>
date Thu, 25 Feb 2010 04:45:13 -0600
parents d0c14ea98592
children 0ca81354c4c7
line wrap: on
line diff
--- a/src/toolbar.c	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/toolbar.c	Thu Feb 25 04:45:13 2010 -0600
@@ -37,10 +37,10 @@
 #include "toolbar.h"
 #include "window.h"
 
-Lisp_Object Vtoolbar[4];
-Lisp_Object Vtoolbar_size[4];
-Lisp_Object Vtoolbar_visible_p[4];
-Lisp_Object Vtoolbar_border_width[4];
+Lisp_Object Vtoolbar[NUM_EDGES];
+Lisp_Object Vtoolbar_size[NUM_EDGES];
+Lisp_Object Vtoolbar_visible_p[NUM_EDGES];
+Lisp_Object Vtoolbar_border_width[NUM_EDGES];
 
 Lisp_Object Vdefault_toolbar, Vdefault_toolbar_visible_p;
 Lisp_Object Vdefault_toolbar_width, Vdefault_toolbar_height;
@@ -232,16 +232,16 @@
 }
 
 
-static enum toolbar_pos
+static enum edge_pos
 decode_toolbar_position (Lisp_Object position)
 {
-  if (EQ (position, Qtop))    return TOP_TOOLBAR;
-  if (EQ (position, Qbottom)) return BOTTOM_TOOLBAR;
-  if (EQ (position, Qleft))   return LEFT_TOOLBAR;
-  if (EQ (position, Qright))  return RIGHT_TOOLBAR;
+  if (EQ (position, Qtop))    return TOP_EDGE;
+  if (EQ (position, Qbottom)) return BOTTOM_EDGE;
+  if (EQ (position, Qleft))   return LEFT_EDGE;
+  if (EQ (position, Qright))  return RIGHT_EDGE;
   invalid_constant ("Invalid toolbar position", position);
 
-  RETURN_NOT_REACHED (TOP_TOOLBAR);
+  RETURN_NOT_REACHED (TOP_EDGE);
 }
 
 DEFUN ("set-default-toolbar-position", Fset_default_toolbar_position, 1, 1, 0, /*
@@ -251,8 +251,8 @@
 */
        (position))
 {
-  enum toolbar_pos cur = decode_toolbar_position (Vdefault_toolbar_position);
-  enum toolbar_pos new_ = decode_toolbar_position (position);
+  enum edge_pos cur = decode_toolbar_position (Vdefault_toolbar_position);
+  enum edge_pos new_ = decode_toolbar_position (position);
 
   if (cur != new_)
     {
@@ -264,7 +264,7 @@
       set_specifier_fallback (Vtoolbar[new_], Vdefault_toolbar);
       set_specifier_fallback (Vtoolbar_size[cur], list1 (Fcons (Qnil, Qzero)));
       set_specifier_fallback (Vtoolbar_size[new_],
-			      new_ == TOP_TOOLBAR || new_ == BOTTOM_TOOLBAR
+			      new_ == TOP_EDGE || new_ == BOTTOM_EDGE
 			      ? Vdefault_toolbar_height
 			      : Vdefault_toolbar_width);
       set_specifier_fallback (Vtoolbar_border_width[cur],
@@ -590,7 +590,7 @@
 }
 
 void
-mark_frame_toolbar_buttons_dirty (struct frame *f, enum toolbar_pos pos)
+mark_frame_toolbar_buttons_dirty (struct frame *f, enum edge_pos pos)
 {
   Lisp_Object button = FRAME_TOOLBAR_BUTTONS (f, pos);
 
@@ -604,7 +604,7 @@
 }
 
 static Lisp_Object
-compute_frame_toolbar_buttons (struct frame *f, enum toolbar_pos pos,
+compute_frame_toolbar_buttons (struct frame *f, enum edge_pos pos,
 			       Lisp_Object toolbar)
 {
   Lisp_Object buttons, prev_button, first_button;
@@ -713,7 +713,7 @@
 }
 
 static void
-set_frame_toolbar (struct frame *f, enum toolbar_pos pos)
+set_frame_toolbar (struct frame *f, enum edge_pos pos)
 {
   struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
   Lisp_Object toolbar = w->toolbar[pos];
@@ -725,10 +725,10 @@
 static void
 compute_frame_toolbars_data (struct frame *f)
 {
-  set_frame_toolbar (f, TOP_TOOLBAR);
-  set_frame_toolbar (f, BOTTOM_TOOLBAR);
-  set_frame_toolbar (f, LEFT_TOOLBAR);
-  set_frame_toolbar (f, RIGHT_TOOLBAR);
+  set_frame_toolbar (f, TOP_EDGE);
+  set_frame_toolbar (f, BOTTOM_EDGE);
+  set_frame_toolbar (f, LEFT_EDGE);
+  set_frame_toolbar (f, RIGHT_EDGE);
 }
 
 /* Update the toolbar geometry separately from actually displaying the
@@ -762,14 +762,15 @@
 	 unchanged, as it will hose windows whose pixsizes are not
 	 multiple of character sizes. */
 
-      for (pos = 0; pos < 4; pos++)
+      EDGE_POS_LOOP (pos)
 	if (FRAME_REAL_TOOLBAR_SIZE (f, pos)
 	    != FRAME_CURRENT_TOOLBAR_SIZE (f, pos))
 	  frame_size_changed = 1;
 
-      for (pos = 0; pos < 4; pos++) {
-	f->current_toolbar_size[pos] = FRAME_REAL_TOOLBAR_SIZE (f, pos);
-      }
+      EDGE_POS_LOOP (pos)
+	{
+	  f->current_toolbar_size[pos] = FRAME_REAL_TOOLBAR_SIZE (f, pos);
+	}
 
       /* Removed the check for the minibuffer here.  We handle this
 	 more correctly now by consistently using
@@ -833,7 +834,7 @@
 	 already recomputed, and possibly modified by resource
 	 initialization. Remember current toolbar geometry so next
 	 redisplay will not needlessly relayout toolbars. */
-      for (pos = 0; pos < 4; pos++)
+      EDGE_POS_LOOP (pos)
 	f->current_toolbar_size[pos] = FRAME_REAL_TOOLBAR_SIZE (f, pos);
     }
 }
@@ -868,7 +869,7 @@
 }
 
 void
-get_toolbar_coords (struct frame *f, enum toolbar_pos pos, int *x, int *y,
+get_toolbar_coords (struct frame *f, enum edge_pos pos, int *x, int *y,
 		    int *width, int *height, int *vert, int for_layout)
 {
   int visible_top_toolbar_height, visible_bottom_toolbar_height;
@@ -892,7 +893,7 @@
 
   switch (pos)
     {
-    case TOP_TOOLBAR:
+    case TOP_EDGE:
       *x = 1;
       *y = 0;	/* #### should be 1 if no menubar */
       *width = FRAME_PIXWIDTH (f) - 2;
@@ -900,7 +901,7 @@
 	2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f) - adjust;
       *vert = 0;
       break;
-    case BOTTOM_TOOLBAR:
+    case BOTTOM_EDGE:
       *x = 1;
       *y = FRAME_PIXHEIGHT (f) - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) -
 	2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f);
@@ -909,7 +910,7 @@
 	2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f) - adjust;
       *vert = 0;
       break;
-    case LEFT_TOOLBAR:
+    case LEFT_EDGE:
       *x = 1;
       *y = visible_top_toolbar_height;
       *width = FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) +
@@ -918,7 +919,7 @@
 		 visible_bottom_toolbar_height - 1);
       *vert = 1;
       break;
-    case RIGHT_TOOLBAR:
+    case RIGHT_EDGE:
       *x = FRAME_PIXWIDTH (f) - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -
 	2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f);
       *y = visible_top_toolbar_height;
@@ -934,7 +935,7 @@
 }
 
 #define CHECK_TOOLBAR(pos) do {						\
-  if (FRAME_REAL_##pos##_VISIBLE (f))					\
+  if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))				\
     {									\
       int x, y, width, height, vert;					\
   									\
@@ -950,10 +951,10 @@
 static Lisp_Object
 toolbar_buttons_at_pixpos (struct frame *f, int x_coord, int y_coord)
 {
-  CHECK_TOOLBAR (TOP_TOOLBAR);
-  CHECK_TOOLBAR (BOTTOM_TOOLBAR);
-  CHECK_TOOLBAR (LEFT_TOOLBAR);
-  CHECK_TOOLBAR (RIGHT_TOOLBAR);
+  CHECK_TOOLBAR (TOP_EDGE);
+  CHECK_TOOLBAR (BOTTOM_EDGE);
+  CHECK_TOOLBAR (LEFT_EDGE);
+  CHECK_TOOLBAR (RIGHT_EDGE);
 
   return Qnil;
 }
@@ -997,9 +998,9 @@
 
 DEFINE_SPECIFIER_TYPE (toolbar);
 
-#define CTB_ERROR(msg) do {						    \
-									      maybe_signal_error (Qinvalid_argument, msg, button, Qtoolbar, errb); \
-  RETURN_SANS_WARNINGS Qnil;						    \
+#define CTB_ERROR(msg) do {						\
+  maybe_signal_error (Qinvalid_argument, msg, button, Qtoolbar, errb);	\
+  RETURN_SANS_WARNINGS Qnil;						\
 } while (0)
 
 /* Returns Q_style if key was :style, Qt if ok otherwise, Qnil if error. */
@@ -1216,9 +1217,9 @@
   specifier caching changes
 */
 static void
-recompute_overlaying_specifier (Lisp_Object real_one[4])
+recompute_overlaying_specifier (Lisp_Object real_one[NUM_EDGES])
 {
-  enum toolbar_pos pos = decode_toolbar_position (Vdefault_toolbar_position);
+  enum edge_pos pos = decode_toolbar_position (Vdefault_toolbar_position);
   Fset_specifier_dirty_flag (real_one[pos]);
 }
 
@@ -1501,19 +1502,19 @@
 			 0, 0, 0);
 
   DEFVAR_SPECIFIER ("top-toolbar",
-		    &Vtoolbar[TOP_TOOLBAR] /*
+		    &Vtoolbar[TOP_EDGE] /*
 Specifier for the toolbar at the top of the frame.
 Use `set-specifier' to change this.
 See `default-toolbar' for a description of a valid toolbar instantiator.
 */ );
-  Vtoolbar[TOP_TOOLBAR] = Fmake_specifier (Qtoolbar);
-  set_specifier_caching (Vtoolbar[TOP_TOOLBAR],
-			 offsetof (struct window, toolbar[TOP_TOOLBAR]),
+  Vtoolbar[TOP_EDGE] = Fmake_specifier (Qtoolbar);
+  set_specifier_caching (Vtoolbar[TOP_EDGE],
+			 offsetof (struct window, toolbar[TOP_EDGE]),
 			 toolbar_specs_changed,
 			 0, 0, 0);
 
   DEFVAR_SPECIFIER ("bottom-toolbar",
-		    &Vtoolbar[BOTTOM_TOOLBAR] /*
+		    &Vtoolbar[BOTTOM_EDGE] /*
 Specifier for the toolbar at the bottom of the frame.
 Use `set-specifier' to change this.
 See `default-toolbar' for a description of a valid toolbar instantiator.
@@ -1523,14 +1524,14 @@
 `bottom-toolbar-height') is 0; thus, a bottom toolbar will not be
 displayed even if you provide a value for `bottom-toolbar'.
 */ );
-  Vtoolbar[BOTTOM_TOOLBAR] = Fmake_specifier (Qtoolbar);
-  set_specifier_caching (Vtoolbar[BOTTOM_TOOLBAR],
-			 offsetof (struct window, toolbar[BOTTOM_TOOLBAR]),
+  Vtoolbar[BOTTOM_EDGE] = Fmake_specifier (Qtoolbar);
+  set_specifier_caching (Vtoolbar[BOTTOM_EDGE],
+			 offsetof (struct window, toolbar[BOTTOM_EDGE]),
 			 toolbar_specs_changed,
 			 0, 0, 0);
 
   DEFVAR_SPECIFIER ("left-toolbar",
-		    &Vtoolbar[LEFT_TOOLBAR] /*
+		    &Vtoolbar[LEFT_EDGE] /*
 Specifier for the toolbar at the left edge of the frame.
 Use `set-specifier' to change this.
 See `default-toolbar' for a description of a valid toolbar instantiator.
@@ -1540,14 +1541,14 @@
 `left-toolbar-width') is 0; thus, a left toolbar will not be
 displayed even if you provide a value for `left-toolbar'.
 */ );
-  Vtoolbar[LEFT_TOOLBAR] = Fmake_specifier (Qtoolbar);
-  set_specifier_caching (Vtoolbar[LEFT_TOOLBAR],
-			 offsetof (struct window, toolbar[LEFT_TOOLBAR]),
+  Vtoolbar[LEFT_EDGE] = Fmake_specifier (Qtoolbar);
+  set_specifier_caching (Vtoolbar[LEFT_EDGE],
+			 offsetof (struct window, toolbar[LEFT_EDGE]),
 			 toolbar_specs_changed,
 			 0, 0, 0);
 
   DEFVAR_SPECIFIER ("right-toolbar",
-		    &Vtoolbar[RIGHT_TOOLBAR] /*
+		    &Vtoolbar[RIGHT_EDGE] /*
 Specifier for the toolbar at the right edge of the frame.
 Use `set-specifier' to change this.
 See `default-toolbar' for a description of a valid toolbar instantiator.
@@ -1557,9 +1558,9 @@
 `right-toolbar-width') is 0; thus, a right toolbar will not be
 displayed even if you provide a value for `right-toolbar'.
 */ );
-  Vtoolbar[RIGHT_TOOLBAR] = Fmake_specifier (Qtoolbar);
-  set_specifier_caching (Vtoolbar[RIGHT_TOOLBAR],
-			 offsetof (struct window, toolbar[RIGHT_TOOLBAR]),
+  Vtoolbar[RIGHT_EDGE] = Fmake_specifier (Qtoolbar);
+  set_specifier_caching (Vtoolbar[RIGHT_EDGE],
+			 offsetof (struct window, toolbar[RIGHT_EDGE]),
 			 toolbar_specs_changed,
 			 0, 0, 0);
 
@@ -1567,10 +1568,10 @@
      changed with `set-default-toolbar-position'. */
   fb = list1 (Fcons (Qnil, Qnil));
   set_specifier_fallback (Vdefault_toolbar, fb);
-  set_specifier_fallback (Vtoolbar[TOP_TOOLBAR], Vdefault_toolbar);
-  set_specifier_fallback (Vtoolbar[BOTTOM_TOOLBAR], fb);
-  set_specifier_fallback (Vtoolbar[LEFT_TOOLBAR],   fb);
-  set_specifier_fallback (Vtoolbar[RIGHT_TOOLBAR],  fb);
+  set_specifier_fallback (Vtoolbar[TOP_EDGE], Vdefault_toolbar);
+  set_specifier_fallback (Vtoolbar[BOTTOM_EDGE], fb);
+  set_specifier_fallback (Vtoolbar[LEFT_EDGE],   fb);
+  set_specifier_fallback (Vtoolbar[RIGHT_EDGE],  fb);
 
   DEFVAR_SPECIFIER ("default-toolbar-height", &Vdefault_toolbar_height /*
 *Height of the default toolbar, if it's oriented horizontally.
@@ -1632,59 +1633,59 @@
 			 default_toolbar_size_changed_in_frame, 0);
 
   DEFVAR_SPECIFIER ("top-toolbar-height",
-		    &Vtoolbar_size[TOP_TOOLBAR] /*
+		    &Vtoolbar_size[TOP_EDGE] /*
 *Height of the top toolbar.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-height' for more information.
 */ );
-  Vtoolbar_size[TOP_TOOLBAR] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vtoolbar_size[TOP_TOOLBAR],
-			 offsetof (struct window, toolbar_size[TOP_TOOLBAR]),
+  Vtoolbar_size[TOP_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vtoolbar_size[TOP_EDGE],
+			 offsetof (struct window, toolbar_size[TOP_EDGE]),
 			 toolbar_geometry_changed_in_window,
-			 offsetof (struct frame, toolbar_size[TOP_TOOLBAR]),
+			 offsetof (struct frame, toolbar_size[TOP_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("bottom-toolbar-height",
-		    &Vtoolbar_size[BOTTOM_TOOLBAR] /*
+		    &Vtoolbar_size[BOTTOM_EDGE] /*
 *Height of the bottom toolbar.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-height' for more information.
 */ );
-  Vtoolbar_size[BOTTOM_TOOLBAR] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vtoolbar_size[BOTTOM_TOOLBAR],
-			 offsetof (struct window, toolbar_size[BOTTOM_TOOLBAR]),
+  Vtoolbar_size[BOTTOM_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vtoolbar_size[BOTTOM_EDGE],
+			 offsetof (struct window, toolbar_size[BOTTOM_EDGE]),
 			 toolbar_geometry_changed_in_window,
-			 offsetof (struct frame, toolbar_size[BOTTOM_TOOLBAR]),
+			 offsetof (struct frame, toolbar_size[BOTTOM_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("left-toolbar-width",
-		    &Vtoolbar_size[LEFT_TOOLBAR] /*
+		    &Vtoolbar_size[LEFT_EDGE] /*
 *Width of left toolbar.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-height' for more information.
 */ );
-  Vtoolbar_size[LEFT_TOOLBAR] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vtoolbar_size[LEFT_TOOLBAR],
-			 offsetof (struct window, toolbar_size[LEFT_TOOLBAR]),
+  Vtoolbar_size[LEFT_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vtoolbar_size[LEFT_EDGE],
+			 offsetof (struct window, toolbar_size[LEFT_EDGE]),
 			 toolbar_geometry_changed_in_window,
-			 offsetof (struct frame, toolbar_size[LEFT_TOOLBAR]),
+			 offsetof (struct frame, toolbar_size[LEFT_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("right-toolbar-width",
-		    &Vtoolbar_size[RIGHT_TOOLBAR] /*
+		    &Vtoolbar_size[RIGHT_EDGE] /*
 *Width of right toolbar.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-height' for more information.
 */ );
-  Vtoolbar_size[RIGHT_TOOLBAR] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vtoolbar_size[RIGHT_TOOLBAR],
-			 offsetof (struct window, toolbar_size[RIGHT_TOOLBAR]),
+  Vtoolbar_size[RIGHT_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vtoolbar_size[RIGHT_EDGE],
+			 offsetof (struct window, toolbar_size[RIGHT_EDGE]),
 			 toolbar_geometry_changed_in_window,
-			 offsetof (struct frame, toolbar_size[RIGHT_TOOLBAR]),
+			 offsetof (struct frame, toolbar_size[RIGHT_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("toolbar-shadow-thickness",
@@ -1750,11 +1751,11 @@
   if (!NILP (fb))
     set_specifier_fallback (Vdefault_toolbar_width, fb);
 
-  set_specifier_fallback (Vtoolbar_size[TOP_TOOLBAR], Vdefault_toolbar_height);
+  set_specifier_fallback (Vtoolbar_size[TOP_EDGE], Vdefault_toolbar_height);
   fb = list1 (Fcons (Qnil, Qzero));
-  set_specifier_fallback (Vtoolbar_size[BOTTOM_TOOLBAR], fb);
-  set_specifier_fallback (Vtoolbar_size[LEFT_TOOLBAR],   fb);
-  set_specifier_fallback (Vtoolbar_size[RIGHT_TOOLBAR],  fb);
+  set_specifier_fallback (Vtoolbar_size[BOTTOM_EDGE], fb);
+  set_specifier_fallback (Vtoolbar_size[LEFT_EDGE],   fb);
+  set_specifier_fallback (Vtoolbar_size[RIGHT_EDGE],  fb);
 
   DEFVAR_SPECIFIER ("default-toolbar-border-width",
 		    &Vdefault_toolbar_border_width /*
@@ -1786,67 +1787,67 @@
 			 default_toolbar_border_width_changed_in_frame, 0);
 
   DEFVAR_SPECIFIER ("top-toolbar-border-width",
-		    &Vtoolbar_border_width[TOP_TOOLBAR] /*
+		    &Vtoolbar_border_width[TOP_EDGE] /*
 *Border width of the top toolbar.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-height' for more information.
 */ );
-  Vtoolbar_border_width[TOP_TOOLBAR] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vtoolbar_border_width[TOP_TOOLBAR],
+  Vtoolbar_border_width[TOP_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vtoolbar_border_width[TOP_EDGE],
 			 offsetof (struct window,
-				   toolbar_border_width[TOP_TOOLBAR]),
+				   toolbar_border_width[TOP_EDGE]),
 			 toolbar_geometry_changed_in_window,
 			 offsetof (struct frame,
-				   toolbar_border_width[TOP_TOOLBAR]),
+				   toolbar_border_width[TOP_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("bottom-toolbar-border-width",
-		    &Vtoolbar_border_width[BOTTOM_TOOLBAR] /*
+		    &Vtoolbar_border_width[BOTTOM_EDGE] /*
 *Border width of the bottom toolbar.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-height' for more information.
 */ );
-  Vtoolbar_border_width[BOTTOM_TOOLBAR] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vtoolbar_border_width[BOTTOM_TOOLBAR],
+  Vtoolbar_border_width[BOTTOM_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vtoolbar_border_width[BOTTOM_EDGE],
 			 offsetof (struct window,
-				   toolbar_border_width[BOTTOM_TOOLBAR]),
+				   toolbar_border_width[BOTTOM_EDGE]),
 			 toolbar_geometry_changed_in_window,
 			 offsetof (struct frame,
-				   toolbar_border_width[BOTTOM_TOOLBAR]),
+				   toolbar_border_width[BOTTOM_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("left-toolbar-border-width",
-		    &Vtoolbar_border_width[LEFT_TOOLBAR] /*
+		    &Vtoolbar_border_width[LEFT_EDGE] /*
 *Border width of left toolbar.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-height' for more information.
 */ );
-  Vtoolbar_border_width[LEFT_TOOLBAR] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vtoolbar_border_width[LEFT_TOOLBAR],
+  Vtoolbar_border_width[LEFT_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vtoolbar_border_width[LEFT_EDGE],
 			 offsetof (struct window,
-				   toolbar_border_width[LEFT_TOOLBAR]),
+				   toolbar_border_width[LEFT_EDGE]),
 			 toolbar_geometry_changed_in_window,
 			 offsetof (struct frame,
-				   toolbar_border_width[LEFT_TOOLBAR]),
+				   toolbar_border_width[LEFT_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("right-toolbar-border-width",
-		    &Vtoolbar_border_width[RIGHT_TOOLBAR] /*
+		    &Vtoolbar_border_width[RIGHT_EDGE] /*
 *Border width of right toolbar.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-height' for more information.
 */ );
-  Vtoolbar_border_width[RIGHT_TOOLBAR] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vtoolbar_border_width[RIGHT_TOOLBAR],
+  Vtoolbar_border_width[RIGHT_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vtoolbar_border_width[RIGHT_EDGE],
 			 offsetof (struct window,
-				   toolbar_border_width[RIGHT_TOOLBAR]),
+				   toolbar_border_width[RIGHT_EDGE]),
 			 toolbar_geometry_changed_in_window,
 			 offsetof (struct frame,
-				   toolbar_border_width[RIGHT_TOOLBAR]),
+				   toolbar_border_width[RIGHT_EDGE]),
 			 frame_size_slipped, 0);
 
   fb = Qnil;
@@ -1865,11 +1866,11 @@
   if (!NILP (fb))
     set_specifier_fallback (Vdefault_toolbar_border_width, fb);
 
-  set_specifier_fallback (Vtoolbar_border_width[TOP_TOOLBAR], Vdefault_toolbar_border_width);
+  set_specifier_fallback (Vtoolbar_border_width[TOP_EDGE], Vdefault_toolbar_border_width);
   fb = list1 (Fcons (Qnil, Qzero));
-  set_specifier_fallback (Vtoolbar_border_width[BOTTOM_TOOLBAR], fb);
-  set_specifier_fallback (Vtoolbar_border_width[LEFT_TOOLBAR],   fb);
-  set_specifier_fallback (Vtoolbar_border_width[RIGHT_TOOLBAR],  fb);
+  set_specifier_fallback (Vtoolbar_border_width[BOTTOM_EDGE], fb);
+  set_specifier_fallback (Vtoolbar_border_width[LEFT_EDGE],   fb);
+  set_specifier_fallback (Vtoolbar_border_width[RIGHT_EDGE],  fb);
 
   DEFVAR_SPECIFIER ("default-toolbar-visible-p", &Vdefault_toolbar_visible_p /*
 *Whether the default toolbar is visible.
@@ -1899,78 +1900,78 @@
 			 default_toolbar_visible_p_changed_in_frame, 0);
 
   DEFVAR_SPECIFIER ("top-toolbar-visible-p",
-		    &Vtoolbar_visible_p[TOP_TOOLBAR] /*
+		    &Vtoolbar_visible_p[TOP_EDGE] /*
 *Whether the top toolbar is visible.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-visible-p' for more information.
 */ );
-  Vtoolbar_visible_p[TOP_TOOLBAR] = Fmake_specifier (Qboolean);
-  set_specifier_caching (Vtoolbar_visible_p[TOP_TOOLBAR],
+  Vtoolbar_visible_p[TOP_EDGE] = Fmake_specifier (Qboolean);
+  set_specifier_caching (Vtoolbar_visible_p[TOP_EDGE],
 			 offsetof (struct window,
-				   toolbar_visible_p[TOP_TOOLBAR]),
+				   toolbar_visible_p[TOP_EDGE]),
 			 toolbar_geometry_changed_in_window,
 			 offsetof (struct frame,
-				   toolbar_visible_p[TOP_TOOLBAR]),
+				   toolbar_visible_p[TOP_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("bottom-toolbar-visible-p",
-		    &Vtoolbar_visible_p[BOTTOM_TOOLBAR] /*
+		    &Vtoolbar_visible_p[BOTTOM_EDGE] /*
 *Whether the bottom toolbar is visible.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-visible-p' for more information.
 */ );
-  Vtoolbar_visible_p[BOTTOM_TOOLBAR] = Fmake_specifier (Qboolean);
-  set_specifier_caching (Vtoolbar_visible_p[BOTTOM_TOOLBAR],
+  Vtoolbar_visible_p[BOTTOM_EDGE] = Fmake_specifier (Qboolean);
+  set_specifier_caching (Vtoolbar_visible_p[BOTTOM_EDGE],
 			 offsetof (struct window,
-				   toolbar_visible_p[BOTTOM_TOOLBAR]),
+				   toolbar_visible_p[BOTTOM_EDGE]),
 			 toolbar_geometry_changed_in_window,
 			 offsetof (struct frame,
-				   toolbar_visible_p[BOTTOM_TOOLBAR]),
+				   toolbar_visible_p[BOTTOM_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("left-toolbar-visible-p",
-		    &Vtoolbar_visible_p[LEFT_TOOLBAR] /*
+		    &Vtoolbar_visible_p[LEFT_EDGE] /*
 *Whether the left toolbar is visible.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-visible-p' for more information.
 */ );
-  Vtoolbar_visible_p[LEFT_TOOLBAR] = Fmake_specifier (Qboolean);
-  set_specifier_caching (Vtoolbar_visible_p[LEFT_TOOLBAR],
+  Vtoolbar_visible_p[LEFT_EDGE] = Fmake_specifier (Qboolean);
+  set_specifier_caching (Vtoolbar_visible_p[LEFT_EDGE],
 			 offsetof (struct window,
-				   toolbar_visible_p[LEFT_TOOLBAR]),
+				   toolbar_visible_p[LEFT_EDGE]),
 			 toolbar_geometry_changed_in_window,
 			 offsetof (struct frame,
-				   toolbar_visible_p[LEFT_TOOLBAR]),
+				   toolbar_visible_p[LEFT_EDGE]),
 			 frame_size_slipped, 0);
 
   DEFVAR_SPECIFIER ("right-toolbar-visible-p",
-		    &Vtoolbar_visible_p[RIGHT_TOOLBAR] /*
+		    &Vtoolbar_visible_p[RIGHT_EDGE] /*
 *Whether the right toolbar is visible.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-toolbar-visible-p' for more information.
 */ );
-  Vtoolbar_visible_p[RIGHT_TOOLBAR] = Fmake_specifier (Qboolean);
-  set_specifier_caching (Vtoolbar_visible_p[RIGHT_TOOLBAR],
+  Vtoolbar_visible_p[RIGHT_EDGE] = Fmake_specifier (Qboolean);
+  set_specifier_caching (Vtoolbar_visible_p[RIGHT_EDGE],
 			 offsetof (struct window,
-				   toolbar_visible_p[RIGHT_TOOLBAR]),
+				   toolbar_visible_p[RIGHT_EDGE]),
 			 toolbar_geometry_changed_in_window,
 			 offsetof (struct frame,
-				   toolbar_visible_p[RIGHT_TOOLBAR]),
+				   toolbar_visible_p[RIGHT_EDGE]),
 			 frame_size_slipped, 0);
 
   /* initially, top inherits from default; this can be
      changed with `set-default-toolbar-position'. */
   fb = list1 (Fcons (Qnil, Qt));
   set_specifier_fallback (Vdefault_toolbar_visible_p, fb);
-  set_specifier_fallback (Vtoolbar_visible_p[TOP_TOOLBAR],
+  set_specifier_fallback (Vtoolbar_visible_p[TOP_EDGE],
 			  Vdefault_toolbar_visible_p);
-  set_specifier_fallback (Vtoolbar_visible_p[BOTTOM_TOOLBAR], fb);
-  set_specifier_fallback (Vtoolbar_visible_p[LEFT_TOOLBAR],   fb);
-  set_specifier_fallback (Vtoolbar_visible_p[RIGHT_TOOLBAR],  fb);
+  set_specifier_fallback (Vtoolbar_visible_p[BOTTOM_EDGE], fb);
+  set_specifier_fallback (Vtoolbar_visible_p[LEFT_EDGE],   fb);
+  set_specifier_fallback (Vtoolbar_visible_p[RIGHT_EDGE],  fb);
 
   DEFVAR_SPECIFIER ("toolbar-buttons-captioned-p",
 		    &Vtoolbar_buttons_captioned_p /*