changeset 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 d555581e3cba
children a04cf0fea770
files src/ChangeLog src/EmacsFrame.c src/frame-impl.h src/frame.h src/gutter.c src/gutter.h src/lisp.h src/native-gtk-toolbar.c src/toolbar-msw.c src/toolbar-xlike.c src/toolbar.c src/toolbar.h
diffstat 12 files changed, 550 insertions(+), 584 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/ChangeLog	Thu Feb 25 04:45:13 2010 -0600
@@ -1,3 +1,113 @@
+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).
+
 2010-02-22  Ben Wing  <ben@xemacs.org>
 
 	* .gdbinit.in.in:
--- a/src/EmacsFrame.c	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/EmacsFrame.c	Thu Feb 25 04:45:13 2010 -0600
@@ -411,49 +411,49 @@
       if (cur->emacs_frame.top_toolbar_height !=
 	  new_->emacs_frame.top_toolbar_height)
 	Fadd_spec_to_specifier
-	  (Vtoolbar_size[TOP_TOOLBAR],
+	  (Vtoolbar_size[TOP_EDGE],
 	   make_int (new_->emacs_frame.top_toolbar_height),
 	   wrap_frame (f), Qnil, Qnil);
       if (cur->emacs_frame.bottom_toolbar_height !=
 	  new_->emacs_frame.bottom_toolbar_height)
 	Fadd_spec_to_specifier
-	  (Vtoolbar_size[BOTTOM_TOOLBAR],
+	  (Vtoolbar_size[BOTTOM_EDGE],
 	   make_int (new_->emacs_frame.bottom_toolbar_height),
 	   wrap_frame (f), Qnil, Qnil);
       if (cur->emacs_frame.left_toolbar_width !=
 	  new_->emacs_frame.left_toolbar_width)
 	Fadd_spec_to_specifier
-	  (Vtoolbar_size[LEFT_TOOLBAR],
+	  (Vtoolbar_size[LEFT_EDGE],
 	   make_int (new_->emacs_frame.left_toolbar_width),
 	   wrap_frame (f), Qnil, Qnil);
       if (cur->emacs_frame.right_toolbar_width !=
 	  new_->emacs_frame.right_toolbar_width)
 	Fadd_spec_to_specifier
-	  (Vtoolbar_size[RIGHT_TOOLBAR],
+	  (Vtoolbar_size[RIGHT_EDGE],
 	   make_int (new_->emacs_frame.right_toolbar_width),
 	   wrap_frame (f), Qnil, Qnil);
       if (cur->emacs_frame.top_toolbar_border_width !=
 	  new_->emacs_frame.top_toolbar_border_width)
 	Fadd_spec_to_specifier
-	  (Vtoolbar_border_width[TOP_TOOLBAR],
+	  (Vtoolbar_border_width[TOP_EDGE],
 	   make_int (new_->emacs_frame.top_toolbar_border_width),
 	   wrap_frame (f), Qnil, Qnil);
       if (cur->emacs_frame.bottom_toolbar_border_width !=
 	  new_->emacs_frame.bottom_toolbar_border_width)
 	Fadd_spec_to_specifier
-	  (Vtoolbar_border_width[BOTTOM_TOOLBAR],
+	  (Vtoolbar_border_width[BOTTOM_EDGE],
 	   make_int (new_->emacs_frame.bottom_toolbar_border_width),
 	   wrap_frame (f), Qnil, Qnil);
       if (cur->emacs_frame.left_toolbar_border_width !=
 	  new_->emacs_frame.left_toolbar_border_width)
 	Fadd_spec_to_specifier
-	  (Vtoolbar_border_width[LEFT_TOOLBAR],
+	  (Vtoolbar_border_width[LEFT_EDGE],
 	   make_int (new_->emacs_frame.left_toolbar_border_width),
 	   wrap_frame (f), Qnil, Qnil);
       if (cur->emacs_frame.right_toolbar_border_width !=
 	  new_->emacs_frame.right_toolbar_border_width)
 	Fadd_spec_to_specifier
-	  (Vtoolbar_border_width[RIGHT_TOOLBAR],
+	  (Vtoolbar_border_width[RIGHT_EDGE],
 	   make_int (new_->emacs_frame.right_toolbar_border_width),
 	   wrap_frame (f), Qnil, Qnil);
 #endif /* HAVE_TOOLBARS */
--- a/src/frame-impl.h	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/frame-impl.h	Thu Feb 25 04:45:13 2010 -0600
@@ -100,17 +100,23 @@
   /* Size of toolbars as seen by redisplay. This is used to determine
      whether to re-layout windows by a call to change_frame_size early
      in redisplay_frame. */
-  int current_toolbar_size[4];
+  int current_toolbar_size[NUM_EDGES];
 #endif
 
   /* Size of gutters as seen by redisplay. This is used to determine
      whether to re-layout windows by a call to change_frame_size early
      in redisplay_frame. */
-  int current_gutter_bounds[4];
+  int current_gutter_bounds[NUM_EDGES];
+
+  /* Toolbar visibility */
+  int toolbar_was_visible[NUM_EDGES];
+
+  /* gutter visibility */
+  int gutter_was_visible[NUM_EDGES];
 
   /* Dynamic arrays of display lines for gutters */
-  display_line_dynarr *current_display_lines[4];
-  display_line_dynarr *desired_display_lines[4];
+  display_line_dynarr *current_display_lines[NUM_EDGES];
+  display_line_dynarr *desired_display_lines[NUM_EDGES];
 
   /* A structure of auxiliary data specific to the device type.  For
      example, struct x_frame is for X window frames; defined in
@@ -160,16 +166,6 @@
   /* True if frame's root window can't be split.  */
   unsigned int no_split :1;
 
-  unsigned int top_toolbar_was_visible :1;
-  unsigned int bottom_toolbar_was_visible :1;
-  unsigned int left_toolbar_was_visible :1;
-  unsigned int right_toolbar_was_visible :1;
-  /* gutter visibility */
-  unsigned int top_gutter_was_visible :1;
-  unsigned int bottom_gutter_was_visible :1;
-  unsigned int left_gutter_was_visible :1;
-  unsigned int right_gutter_was_visible :1;
-
   /* redisplay flags */
   unsigned int buffers_changed :1;
   unsigned int clip_changed :1;
@@ -581,13 +577,13 @@
    : 0)
 
 #define FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT(f) \
-  FRAME_THEORETICAL_TOOLBAR_SIZE (f, TOP_TOOLBAR)
+  FRAME_THEORETICAL_TOOLBAR_SIZE (f, TOP_EDGE)
 #define FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT(f) \
-  FRAME_THEORETICAL_TOOLBAR_SIZE (f, BOTTOM_TOOLBAR)
+  FRAME_THEORETICAL_TOOLBAR_SIZE (f, BOTTOM_EDGE)
 #define FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH(f) \
-  FRAME_THEORETICAL_TOOLBAR_SIZE (f, LEFT_TOOLBAR)
+  FRAME_THEORETICAL_TOOLBAR_SIZE (f, LEFT_EDGE)
 #define FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH(f) \
-  FRAME_THEORETICAL_TOOLBAR_SIZE (f, RIGHT_TOOLBAR)
+  FRAME_THEORETICAL_TOOLBAR_SIZE (f, RIGHT_EDGE)
 
 #define FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH(f, pos)		\
   (FRAME_RAW_THEORETICAL_TOOLBAR_VISIBLE (f, pos)		\
@@ -595,13 +591,13 @@
    : 0)
 
 #define FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH(f) \
-  FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, TOP_TOOLBAR)
+  FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, TOP_EDGE)
 #define FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH(f) \
-  FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, BOTTOM_TOOLBAR)
+  FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, BOTTOM_EDGE)
 #define FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH(f) \
-  FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, LEFT_TOOLBAR)
+  FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, LEFT_EDGE)
 #define FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH(f) \
-  FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, RIGHT_TOOLBAR)
+  FRAME_THEORETICAL_TOOLBAR_BORDER_WIDTH (f, RIGHT_EDGE)
 
 /* This returns the window-local value rather than the frame-local value;
    that tells you about what's actually visible rather than what should
@@ -670,40 +666,40 @@
    2 * FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, pos))
 
 #define FRAME_REAL_TOP_TOOLBAR_HEIGHT(f) \
-  FRAME_REAL_TOOLBAR_SIZE (f, TOP_TOOLBAR)
+  FRAME_REAL_TOOLBAR_SIZE (f, TOP_EDGE)
 #define FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT(f) \
-  FRAME_REAL_TOOLBAR_SIZE (f, BOTTOM_TOOLBAR)
+  FRAME_REAL_TOOLBAR_SIZE (f, BOTTOM_EDGE)
 #define FRAME_REAL_LEFT_TOOLBAR_WIDTH(f) \
-  FRAME_REAL_TOOLBAR_SIZE (f, LEFT_TOOLBAR)
+  FRAME_REAL_TOOLBAR_SIZE (f, LEFT_EDGE)
 #define FRAME_REAL_RIGHT_TOOLBAR_WIDTH(f) \
-  FRAME_REAL_TOOLBAR_SIZE (f, RIGHT_TOOLBAR)
+  FRAME_REAL_TOOLBAR_SIZE (f, RIGHT_EDGE)
 
 #define FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH(f) \
-  FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, TOP_TOOLBAR)
+  FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, TOP_EDGE)
 #define FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH(f) \
-  FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, BOTTOM_TOOLBAR)
+  FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, BOTTOM_EDGE)
 #define FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH(f) \
-  FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, LEFT_TOOLBAR)
+  FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, LEFT_EDGE)
 #define FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH(f) \
-  FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, RIGHT_TOOLBAR)
+  FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, RIGHT_EDGE)
 
 #define FRAME_REAL_TOP_TOOLBAR_VISIBLE(f) \
-  FRAME_REAL_TOOLBAR_VISIBLE (f, TOP_TOOLBAR)
+  FRAME_REAL_TOOLBAR_VISIBLE (f, TOP_EDGE)
 #define FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE(f) \
-  FRAME_REAL_TOOLBAR_VISIBLE (f, BOTTOM_TOOLBAR)
+  FRAME_REAL_TOOLBAR_VISIBLE (f, BOTTOM_EDGE)
 #define FRAME_REAL_LEFT_TOOLBAR_VISIBLE(f) \
-  FRAME_REAL_TOOLBAR_VISIBLE (f, LEFT_TOOLBAR)
+  FRAME_REAL_TOOLBAR_VISIBLE (f, LEFT_EDGE)
 #define FRAME_REAL_RIGHT_TOOLBAR_VISIBLE(f) \
-  FRAME_REAL_TOOLBAR_VISIBLE (f, RIGHT_TOOLBAR)
+  FRAME_REAL_TOOLBAR_VISIBLE (f, RIGHT_EDGE)
 
 #define FRAME_REAL_TOP_TOOLBAR_BOUNDS(f) \
-  FRAME_REAL_TOOLBAR_BOUNDS (f, TOP_TOOLBAR)
+  FRAME_REAL_TOOLBAR_BOUNDS (f, TOP_EDGE)
 #define FRAME_REAL_BOTTOM_TOOLBAR_BOUNDS(f) \
-  FRAME_REAL_TOOLBAR_BOUNDS (f, BOTTOM_TOOLBAR)
+  FRAME_REAL_TOOLBAR_BOUNDS (f, BOTTOM_EDGE)
 #define FRAME_REAL_LEFT_TOOLBAR_BOUNDS(f) \
-  FRAME_REAL_TOOLBAR_BOUNDS (f, LEFT_TOOLBAR)
+  FRAME_REAL_TOOLBAR_BOUNDS (f, LEFT_EDGE)
 #define FRAME_REAL_RIGHT_TOOLBAR_BOUNDS(f) \
-  FRAME_REAL_TOOLBAR_BOUNDS (f, RIGHT_TOOLBAR)
+  FRAME_REAL_TOOLBAR_BOUNDS (f, RIGHT_EDGE)
 
 /************************************************************************/
 /*         frame dimensions defined using toolbars and gutters          */
--- a/src/frame.h	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/frame.h	Thu Feb 25 04:45:13 2010 -0600
@@ -161,4 +161,18 @@
 
 void init_frame (void);
 
+enum edge_pos
+{
+  TOP_EDGE,
+  BOTTOM_EDGE,
+  LEFT_EDGE,
+  RIGHT_EDGE,
+  NUM_EDGES
+};
+
+/* Iterate over all possible edge positions */
+#define EDGE_POS_LOOP(var)				\
+  for (var = (enum edge_pos) 0; var < NUM_EDGES;	\
+       var = (enum edge_pos) (var + 1))
+
 #endif /* INCLUDED_frame_h_ */
--- a/src/gutter.c	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/gutter.c	Thu Feb 25 04:45:13 2010 -0600
@@ -36,10 +36,10 @@
 #include "window.h"
 #include "gutter.h"
 
-Lisp_Object Vgutter[4];
-Lisp_Object Vgutter_size[4];
-Lisp_Object Vgutter_visible_p[4];
-Lisp_Object Vgutter_border_width[4];
+Lisp_Object Vgutter[NUM_EDGES];
+Lisp_Object Vgutter_size[NUM_EDGES];
+Lisp_Object Vgutter_visible_p[NUM_EDGES];
+Lisp_Object Vgutter_border_width[NUM_EDGES];
 
 Lisp_Object Vdefault_gutter, Vdefault_gutter_visible_p;
 Lisp_Object Vdefault_gutter_width, Vdefault_gutter_height;
@@ -52,46 +52,7 @@
 Lisp_Object Qdefault_gutter_position_changed_hook;
 
 static void
-update_gutter_geometry (struct frame *f, enum gutter_pos pos);
-
-#define SET_GUTTER_WAS_VISIBLE_FLAG(frame, pos, flag)	\
-  do {							\
-    switch (pos)					\
-      {							\
-      case TOP_GUTTER:					\
-	(frame)->top_gutter_was_visible = flag;		\
-	break;						\
-      case BOTTOM_GUTTER:				\
-	(frame)->bottom_gutter_was_visible = flag;	\
-	break;						\
-      case LEFT_GUTTER:					\
-	(frame)->left_gutter_was_visible = flag;	\
-	break;						\
-      case RIGHT_GUTTER:				\
-	(frame)->right_gutter_was_visible = flag;	\
-	break;						\
-      default:						\
-	ABORT ();					\
-      }							\
-  } while (0)
-
-static int gutter_was_visible (struct frame* frame, enum gutter_pos pos)
-{
-  switch (pos)
-    {
-    case TOP_GUTTER:
-      return frame->top_gutter_was_visible;
-    case BOTTOM_GUTTER:
-      return frame->bottom_gutter_was_visible;
-    case LEFT_GUTTER:
-      return frame->left_gutter_was_visible;
-    case RIGHT_GUTTER:
-      return frame->right_gutter_was_visible;
-    default:
-      ABORT ();
-	return 0;	/* To keep the compiler happy */
-    }
-}
+update_gutter_geometry (struct frame *f, enum edge_pos pos);
 
 #if 0
 static Lisp_Object
@@ -172,7 +133,7 @@
    if it is not the window nearest the gutter. Instead we predetermine
    the nearest window and then use that.*/
 static void
-get_gutter_coords (struct frame *f, enum gutter_pos pos, int *x, int *y,
+get_gutter_coords (struct frame *f, enum edge_pos pos, int *x, int *y,
 		   int *width, int *height)
 {
   struct window
@@ -181,7 +142,7 @@
      right. */
   switch (pos)
     {
-    case TOP_GUTTER:
+    case TOP_EDGE:
       *x = FRAME_LEFT_BORDER_END (f);
       *y = FRAME_TOP_BORDER_END (f);
       *width = FRAME_RIGHT_BORDER_START (f)
@@ -189,7 +150,7 @@
       *height = FRAME_TOP_GUTTER_BOUNDS (f);
       break;
 
-    case BOTTOM_GUTTER:
+    case BOTTOM_EDGE:
       *x = FRAME_LEFT_BORDER_END (f);
       *y = WINDOW_BOTTOM (bot);
       *width = FRAME_RIGHT_BORDER_START (f)
@@ -197,7 +158,7 @@
       *height = FRAME_BOTTOM_GUTTER_BOUNDS (f);
       break;
 
-    case LEFT_GUTTER:
+    case LEFT_EDGE:
       *x = FRAME_LEFT_BORDER_END (f);
       *y = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f);
       *width = FRAME_LEFT_GUTTER_BOUNDS (f);
@@ -205,7 +166,7 @@
 	- (FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f));
       break;
 
-    case RIGHT_GUTTER:
+    case RIGHT_EDGE:
       *x = FRAME_RIGHT_BORDER_START (f)
 	- FRAME_RIGHT_GUTTER_BOUNDS (f);
       *y = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f);
@@ -230,8 +191,8 @@
 int display_boxes_in_gutter_p (struct frame *f, struct display_box* db,
 			       struct display_glyph_area* dga)
 {
-  enum gutter_pos pos;
-  GUTTER_POS_LOOP (pos)
+  enum edge_pos pos;
+  EDGE_POS_LOOP (pos)
     {
       if (FRAME_GUTTER_VISIBLE (f, pos))
 	{
@@ -257,7 +218,7 @@
 /* Convert the gutter specifier into something we can actually
    display. */
 static Lisp_Object construct_window_gutter_spec (struct window* w,
-						 enum gutter_pos pos)
+						 enum edge_pos pos)
 {
   Lisp_Object rest, *args;
   int nargs = 0;
@@ -289,14 +250,14 @@
    what height will accommodate all lines. This is useless on left and
    right gutters as we always have a maximal number of lines. */
 static int
-calculate_gutter_size_from_display_lines (enum gutter_pos pos,
+calculate_gutter_size_from_display_lines (enum edge_pos pos,
 					  display_line_dynarr* ddla)
 {
   int size = 0;
   struct display_line *dl;
 
   /* For top and bottom the calculation is easy. */
-  if (pos == TOP_GUTTER || pos == BOTTOM_GUTTER)
+  if (pos == TOP_EDGE || pos == BOTTOM_EDGE)
     {
       /* grab coordinates of last line  */
       if (Dynarr_length (ddla))
@@ -333,7 +294,7 @@
 }
 
 static Lisp_Object
-calculate_gutter_size (struct window *w, enum gutter_pos pos)
+calculate_gutter_size (struct window *w, enum edge_pos pos)
 {
   struct frame* f = XFRAME (WINDOW_FRAME (w));
   display_line_dynarr *ddla;
@@ -379,7 +340,7 @@
 }
 
 static void
-output_gutter (struct frame *f, enum gutter_pos pos, int force)
+output_gutter (struct frame *f, enum edge_pos pos, int force)
 {
   Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
   struct device *d = XDEVICE (f->device);
@@ -426,9 +387,9 @@
     {
 #ifdef DEBUG_GUTTERS
       stderr_out ("gutter redisplay [%s %dx%d@%d+%d] triggered by %s,\n",
-	      pos == TOP_GUTTER ? "TOP" :
-	      pos == BOTTOM_GUTTER ? "BOTTOM" :
-	      pos == LEFT_GUTTER ? "LEFT" : "RIGHT",
+	      pos == TOP_EDGE ? "TOP" :
+	      pos == BOTTOM_EDGE ? "BOTTOM" :
+	      pos == LEFT_EDGE ? "LEFT" : "RIGHT",
 	      width, height, x, y, force ? "force" :
 	      f->faces_changed ? "f->faces_changed" :
 	      f->frame_changed ? "f->frame_changed" :
@@ -512,7 +473,7 @@
 }
 
 static void
-clear_gutter (struct frame *f, enum gutter_pos pos)
+clear_gutter (struct frame *f, enum edge_pos pos)
 {
   int x, y, width, height;
   Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
@@ -520,7 +481,7 @@
 						    Vwidget_face);
   get_gutter_coords (f, pos, &x, &y, &width, &height);
 
-  SET_GUTTER_WAS_VISIBLE_FLAG (f, pos, 0);
+  f->gutter_was_visible[pos] = 0;
 
   redisplay_clear_region (window, findex, x, y, width, height);
 }
@@ -537,8 +498,8 @@
 void
 mark_gutters (struct frame *f)
 {
-  enum gutter_pos pos;
-  GUTTER_POS_LOOP (pos)
+  enum edge_pos pos;
+  EDGE_POS_LOOP (pos)
     {
       if (f->current_display_lines[pos])
 	mark_redisplay_structs (f->current_display_lines[pos]);
@@ -564,11 +525,11 @@
   FRAME_LOOP_NO_BREAK (frmcons, devcons, concons)
     {
       struct frame *f = XFRAME (XCAR (frmcons));
-      enum gutter_pos pos;
+      enum edge_pos pos;
       Lisp_Object window = FRAME_LAST_NONMINIBUF_WINDOW (f);
       struct window* w = XWINDOW (window);
 
-      GUTTER_POS_LOOP (pos)
+      EDGE_POS_LOOP (pos)
 	{
 	  if (EQ (WINDOW_GUTTER (w, pos), obj))
 	    {
@@ -581,7 +542,7 @@
 /* We have to change the gutter geometry separately to the gutter
    update since it needs to occur outside of redisplay proper. */
 static void
-update_gutter_geometry (struct frame *f, enum gutter_pos pos)
+update_gutter_geometry (struct frame *f, enum edge_pos pos)
 {
   /* If the gutter geometry has changed then re-layout the
      frame. If we are in display there is almost no point in doing
@@ -607,13 +568,13 @@
       || f->frame_layout_changed
       || f->windows_structure_changed)
     {
-      enum gutter_pos pos;
+      enum edge_pos pos;
 
       /* If the gutter geometry has changed then re-layout the
 	 frame. If we are in display there is almost no point in doing
 	 anything else since the frame size changes will be delayed
 	 until we are out of redisplay proper. */
-      GUTTER_POS_LOOP (pos)
+      EDGE_POS_LOOP (pos)
 	{
 	  update_gutter_geometry (f, pos);
 	}
@@ -629,7 +590,7 @@
       f->windows_changed || f->windows_structure_changed ||
       f->extents_changed || f->frame_layout_changed)
     {
-      enum gutter_pos pos;
+      enum edge_pos pos;
 
       /* We don't actually care about these when outputting the gutter
 	 so locally disable them. */
@@ -639,12 +600,12 @@
       f->buffers_changed = 0;
 
       /* and output */
-      GUTTER_POS_LOOP (pos)
+      EDGE_POS_LOOP (pos)
 	{
 	  if (FRAME_GUTTER_VISIBLE (f, pos))
 	      output_gutter (f, pos, 0);
 
-	  else if (gutter_was_visible (f, pos))
+	  else if (f->gutter_was_visible[pos])
 	      clear_gutter (f, pos);
 	}
 
@@ -657,8 +618,8 @@
 void
 reset_gutter_display_lines (struct frame* f)
 {
-  enum gutter_pos pos;
-  GUTTER_POS_LOOP (pos)
+  enum edge_pos pos;
+  EDGE_POS_LOOP (pos)
     {
       if (f->current_display_lines[pos])
 	Dynarr_reset (f->current_display_lines[pos]);
@@ -666,7 +627,7 @@
 }
 
 static void
-redraw_exposed_gutter (struct frame *f, enum gutter_pos pos, int x, int y,
+redraw_exposed_gutter (struct frame *f, enum edge_pos pos, int x, int y,
 		       int width, int height)
 {
   int g_x, g_y, g_width, g_height;
@@ -697,10 +658,10 @@
 redraw_exposed_gutters (struct frame *f, int x, int y, int width,
 			int height)
 {
-  enum gutter_pos pos;
+  enum edge_pos pos;
 
   /* We are already inside the critical section -- our caller did that. */
-  GUTTER_POS_LOOP (pos)
+  EDGE_POS_LOOP (pos)
     {
       if (FRAME_GUTTER_VISIBLE (f, pos))
 	redraw_exposed_gutter (f, pos, x, y, width, height);
@@ -710,8 +671,8 @@
 void
 free_frame_gutters (struct frame *f)
 {
-  enum gutter_pos pos;
-  GUTTER_POS_LOOP (pos)
+  enum edge_pos pos;
+  EDGE_POS_LOOP (pos)
     {
       if (f->current_display_lines[pos])
 	{
@@ -726,16 +687,16 @@
     }
 }
 
-static enum gutter_pos
+static enum edge_pos
 decode_gutter_position (Lisp_Object position)
 {
-  if (EQ (position, Qtop))    return TOP_GUTTER;
-  if (EQ (position, Qbottom)) return BOTTOM_GUTTER;
-  if (EQ (position, Qleft))   return LEFT_GUTTER;
-  if (EQ (position, Qright))  return RIGHT_GUTTER;
+  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 gutter position", position);
 
-  RETURN_NOT_REACHED (TOP_GUTTER);
+  RETURN_NOT_REACHED (TOP_EDGE);
 }
 
 DEFUN ("set-default-gutter-position", Fset_default_gutter_position, 1, 1, 0, /*
@@ -745,8 +706,8 @@
 */
        (position))
 {
-  enum gutter_pos cur = decode_gutter_position (Vdefault_gutter_position);
-  enum gutter_pos new_ = decode_gutter_position (position);
+  enum edge_pos cur = decode_gutter_position (Vdefault_gutter_position);
+  enum edge_pos new_ = decode_gutter_position (position);
 
   if (cur != new_)
     {
@@ -760,7 +721,7 @@
       set_specifier_fallback (Vgutter[new_], Vdefault_gutter);
       set_specifier_fallback (Vgutter_size[cur], list1 (Fcons (Qnil, Qzero)));
       set_specifier_fallback (Vgutter_size[new_],
-			      new_ == TOP_GUTTER || new_ == BOTTOM_GUTTER
+			      new_ == TOP_EDGE || new_ == BOTTOM_EDGE
 			      ? Vdefault_gutter_height
 			      : Vdefault_gutter_width);
       set_specifier_fallback (Vgutter_border_width[cur],
@@ -797,7 +758,7 @@
        (pos, locale))
 {
   int x, y, width, height;
-  enum gutter_pos p = TOP_GUTTER;
+  enum edge_pos p = TOP_EDGE;
   struct frame *f = decode_frame (FW_FRAME (locale));
 
   if (NILP (pos))
@@ -818,7 +779,7 @@
        (pos, locale))
 {
   int x, y, width, height;
-  enum gutter_pos p = TOP_GUTTER;
+  enum edge_pos p = TOP_EDGE;
   struct frame *f = decode_frame (FW_FRAME (locale));
 
   if (NILP (pos))
@@ -880,26 +841,26 @@
   specifier caching changes
 */
 static void
-recompute_overlaying_specifier (Lisp_Object real_one[4])
+recompute_overlaying_specifier (Lisp_Object real_one[NUM_EDGES])
 {
-  enum gutter_pos pos = decode_gutter_position (Vdefault_gutter_position);
+  enum edge_pos pos = decode_gutter_position (Vdefault_gutter_position);
   Fset_specifier_dirty_flag (real_one[pos]);
 }
 
 static void gutter_specs_changed (Lisp_Object specifier, struct window *w,
-				  Lisp_Object oldval, enum gutter_pos pos);
+				  Lisp_Object oldval, enum edge_pos pos);
 
 static void
 gutter_specs_changed_1 (Lisp_Object arg)
 {
   gutter_specs_changed (X1ST (arg), XWINDOW (X2ND (arg)),
-			X3RD (arg), (enum gutter_pos) XINT (X4TH (arg)));
+			X3RD (arg), (enum edge_pos) XINT (X4TH (arg)));
   free_list (arg);
 }
 
 static void
 gutter_specs_changed (Lisp_Object specifier, struct window *w,
-		      Lisp_Object oldval, enum gutter_pos pos)
+		      Lisp_Object oldval, enum edge_pos pos)
 {
   if (in_display)
     register_post_redisplay_action (gutter_specs_changed_1,
@@ -926,28 +887,28 @@
 top_gutter_specs_changed (Lisp_Object specifier, struct window *w,
 			  Lisp_Object oldval)
 {
-  gutter_specs_changed (specifier, w, oldval, TOP_GUTTER);
+  gutter_specs_changed (specifier, w, oldval, TOP_EDGE);
 }
 
 static void
 bottom_gutter_specs_changed (Lisp_Object specifier, struct window *w,
 			     Lisp_Object oldval)
 {
-  gutter_specs_changed (specifier, w, oldval, BOTTOM_GUTTER);
+  gutter_specs_changed (specifier, w, oldval, BOTTOM_EDGE);
 }
 
 static void
 left_gutter_specs_changed (Lisp_Object specifier, struct window *w,
 			   Lisp_Object oldval)
 {
-  gutter_specs_changed (specifier, w, oldval, LEFT_GUTTER);
+  gutter_specs_changed (specifier, w, oldval, LEFT_EDGE);
 }
 
 static void
 right_gutter_specs_changed (Lisp_Object specifier, struct window *w,
 			    Lisp_Object oldval)
 {
-  gutter_specs_changed (specifier, w, oldval, RIGHT_GUTTER);
+  gutter_specs_changed (specifier, w, oldval, RIGHT_EDGE);
 }
 
 static void
@@ -980,8 +941,8 @@
 					   oldval));
   else
     {
-      enum gutter_pos pos;
-      GUTTER_POS_LOOP (pos)
+      enum edge_pos pos;
+      EDGE_POS_LOOP (pos)
 	{
 	  w->real_gutter_size[pos] = w->gutter_size[pos];
 	  if (EQ (w->real_gutter_size[pos], Qautodetect)
@@ -1152,12 +1113,12 @@
 void
 init_frame_gutters (struct frame *f)
 {
-  enum gutter_pos pos;
+  enum edge_pos pos;
   struct window* w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
   /* We are here as far in frame creation so cached specifiers are
      already recomputed, and possibly modified by resource
      initialization. We need to recalculate autodetected gutters. */
-  GUTTER_POS_LOOP (pos)
+  EDGE_POS_LOOP (pos)
     {
       w->real_gutter[pos] = construct_window_gutter_spec (w, pos);
       w->real_gutter_size[pos] = w->gutter_size[pos];
@@ -1171,7 +1132,7 @@
     }
 
   /* Keep a record of the current sizes of things. */
-  GUTTER_POS_LOOP (pos)
+  EDGE_POS_LOOP (pos)
     {
       f->current_gutter_bounds[pos] = FRAME_GUTTER_BOUNDS (f, pos);
     }
@@ -1279,19 +1240,19 @@
 			 0, 0, 1);
 
   DEFVAR_SPECIFIER ("top-gutter",
-		    &Vgutter[TOP_GUTTER] /*
+		    &Vgutter[TOP_EDGE] /*
 Specifier for the gutter at the top of the frame.
 Use `set-specifier' to change this.
 See `default-gutter' for a description of a valid gutter instantiator.
 */ );
-  Vgutter[TOP_GUTTER] = Fmake_specifier (Qgutter);
-  set_specifier_caching (Vgutter[TOP_GUTTER],
-			 offsetof (struct window, gutter[TOP_GUTTER]),
+  Vgutter[TOP_EDGE] = Fmake_specifier (Qgutter);
+  set_specifier_caching (Vgutter[TOP_EDGE],
+			 offsetof (struct window, gutter[TOP_EDGE]),
 			 top_gutter_specs_changed,
 			 0, 0, 1);
 
   DEFVAR_SPECIFIER ("bottom-gutter",
-		    &Vgutter[BOTTOM_GUTTER] /*
+		    &Vgutter[BOTTOM_EDGE] /*
 Specifier for the gutter at the bottom of the frame.
 Use `set-specifier' to change this.
 See `default-gutter' for a description of a valid gutter instantiator.
@@ -1301,14 +1262,14 @@
 `bottom-gutter-height') is 0; thus, a bottom gutter will not be
 displayed even if you provide a value for `bottom-gutter'.
 */ );
-  Vgutter[BOTTOM_GUTTER] = Fmake_specifier (Qgutter);
-  set_specifier_caching (Vgutter[BOTTOM_GUTTER],
-			 offsetof (struct window, gutter[BOTTOM_GUTTER]),
+  Vgutter[BOTTOM_EDGE] = Fmake_specifier (Qgutter);
+  set_specifier_caching (Vgutter[BOTTOM_EDGE],
+			 offsetof (struct window, gutter[BOTTOM_EDGE]),
 			 bottom_gutter_specs_changed,
 			 0, 0, 1);
 
   DEFVAR_SPECIFIER ("left-gutter",
-		    &Vgutter[LEFT_GUTTER] /*
+		    &Vgutter[LEFT_EDGE] /*
 Specifier for the gutter at the left edge of the frame.
 Use `set-specifier' to change this.
 See `default-gutter' for a description of a valid gutter instantiator.
@@ -1318,14 +1279,14 @@
 `left-gutter-width') is 0; thus, a left gutter will not be
 displayed even if you provide a value for `left-gutter'.
 */ );
-  Vgutter[LEFT_GUTTER] = Fmake_specifier (Qgutter);
-  set_specifier_caching (Vgutter[LEFT_GUTTER],
-			 offsetof (struct window, gutter[LEFT_GUTTER]),
+  Vgutter[LEFT_EDGE] = Fmake_specifier (Qgutter);
+  set_specifier_caching (Vgutter[LEFT_EDGE],
+			 offsetof (struct window, gutter[LEFT_EDGE]),
 			 left_gutter_specs_changed,
 			 0, 0, 1);
 
   DEFVAR_SPECIFIER ("right-gutter",
-		    &Vgutter[RIGHT_GUTTER] /*
+		    &Vgutter[RIGHT_EDGE] /*
 Specifier for the gutter at the right edge of the frame.
 Use `set-specifier' to change this.
 See `default-gutter' for a description of a valid gutter instantiator.
@@ -1335,9 +1296,9 @@
 `right-gutter-width') is 0; thus, a right gutter will not be
 displayed even if you provide a value for `right-gutter'.
 */ );
-  Vgutter[RIGHT_GUTTER] = Fmake_specifier (Qgutter);
-  set_specifier_caching (Vgutter[RIGHT_GUTTER],
-			 offsetof (struct window, gutter[RIGHT_GUTTER]),
+  Vgutter[RIGHT_EDGE] = Fmake_specifier (Qgutter);
+  set_specifier_caching (Vgutter[RIGHT_EDGE],
+			 offsetof (struct window, gutter[RIGHT_EDGE]),
 			 right_gutter_specs_changed,
 			 0, 0, 1);
 
@@ -1345,10 +1306,10 @@
      changed with `set-default-gutter-position'. */
   fb = list1 (Fcons (Qnil, Qnil));
   set_specifier_fallback (Vdefault_gutter, fb);
-  set_specifier_fallback (Vgutter[TOP_GUTTER], Vdefault_gutter);
-  set_specifier_fallback (Vgutter[BOTTOM_GUTTER], fb);
-  set_specifier_fallback (Vgutter[LEFT_GUTTER],   fb);
-  set_specifier_fallback (Vgutter[RIGHT_GUTTER],  fb);
+  set_specifier_fallback (Vgutter[TOP_EDGE], Vdefault_gutter);
+  set_specifier_fallback (Vgutter[BOTTOM_EDGE], fb);
+  set_specifier_fallback (Vgutter[LEFT_EDGE],   fb);
+  set_specifier_fallback (Vgutter[RIGHT_EDGE],  fb);
 
   DEFVAR_SPECIFIER ("default-gutter-height", &Vdefault_gutter_height /*
 *Height of the default gutter, if it's oriented horizontally.
@@ -1394,51 +1355,51 @@
 			 0, 0, 1);
 
   DEFVAR_SPECIFIER ("top-gutter-height",
-		    &Vgutter_size[TOP_GUTTER] /*
+		    &Vgutter_size[TOP_EDGE] /*
 *Height of the top gutter.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-height' for more information.
 */ );
-  Vgutter_size[TOP_GUTTER] = Fmake_specifier (Qgutter_size);
-  set_specifier_caching (Vgutter_size[TOP_GUTTER],
-			 offsetof (struct window, gutter_size[TOP_GUTTER]),
+  Vgutter_size[TOP_EDGE] = Fmake_specifier (Qgutter_size);
+  set_specifier_caching (Vgutter_size[TOP_EDGE],
+			 offsetof (struct window, gutter_size[TOP_EDGE]),
 			 gutter_geometry_changed_in_window, 0, 0, 1);
 
   DEFVAR_SPECIFIER ("bottom-gutter-height",
-		    &Vgutter_size[BOTTOM_GUTTER] /*
+		    &Vgutter_size[BOTTOM_EDGE] /*
 *Height of the bottom gutter.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-height' for more information.
 */ );
-  Vgutter_size[BOTTOM_GUTTER] = Fmake_specifier (Qgutter_size);
-  set_specifier_caching (Vgutter_size[BOTTOM_GUTTER],
-			 offsetof (struct window, gutter_size[BOTTOM_GUTTER]),
+  Vgutter_size[BOTTOM_EDGE] = Fmake_specifier (Qgutter_size);
+  set_specifier_caching (Vgutter_size[BOTTOM_EDGE],
+			 offsetof (struct window, gutter_size[BOTTOM_EDGE]),
 			 gutter_geometry_changed_in_window, 0, 0, 1);
 
   DEFVAR_SPECIFIER ("left-gutter-width",
-		    &Vgutter_size[LEFT_GUTTER] /*
+		    &Vgutter_size[LEFT_EDGE] /*
 *Width of left gutter.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-height' for more information.
 */ );
-  Vgutter_size[LEFT_GUTTER] = Fmake_specifier (Qgutter_size);
-  set_specifier_caching (Vgutter_size[LEFT_GUTTER],
-			 offsetof (struct window, gutter_size[LEFT_GUTTER]),
+  Vgutter_size[LEFT_EDGE] = Fmake_specifier (Qgutter_size);
+  set_specifier_caching (Vgutter_size[LEFT_EDGE],
+			 offsetof (struct window, gutter_size[LEFT_EDGE]),
 			 gutter_geometry_changed_in_window, 0, 0, 1);
 
   DEFVAR_SPECIFIER ("right-gutter-width",
-		    &Vgutter_size[RIGHT_GUTTER] /*
+		    &Vgutter_size[RIGHT_EDGE] /*
 *Width of right gutter.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-height' for more information.
 */ );
-  Vgutter_size[RIGHT_GUTTER] = Fmake_specifier (Qgutter_size);
-  set_specifier_caching (Vgutter_size[RIGHT_GUTTER],
-			 offsetof (struct window, gutter_size[RIGHT_GUTTER]),
+  Vgutter_size[RIGHT_EDGE] = Fmake_specifier (Qgutter_size);
+  set_specifier_caching (Vgutter_size[RIGHT_EDGE],
+			 offsetof (struct window, gutter_size[RIGHT_EDGE]),
 			 gutter_geometry_changed_in_window, 0, 0, 1);
 
   fb = Qnil;
@@ -1475,11 +1436,11 @@
   if (!NILP (fb))
     set_specifier_fallback (Vdefault_gutter_width, fb);
 
-  set_specifier_fallback (Vgutter_size[TOP_GUTTER], Vdefault_gutter_height);
+  set_specifier_fallback (Vgutter_size[TOP_EDGE], Vdefault_gutter_height);
   fb = list1 (Fcons (Qnil, Qzero));
-  set_specifier_fallback (Vgutter_size[BOTTOM_GUTTER], fb);
-  set_specifier_fallback (Vgutter_size[LEFT_GUTTER],   fb);
-  set_specifier_fallback (Vgutter_size[RIGHT_GUTTER],  fb);
+  set_specifier_fallback (Vgutter_size[BOTTOM_EDGE], fb);
+  set_specifier_fallback (Vgutter_size[LEFT_EDGE],   fb);
+  set_specifier_fallback (Vgutter_size[RIGHT_EDGE],  fb);
 
   DEFVAR_SPECIFIER ("default-gutter-border-width",
 		    &Vdefault_gutter_border_width /*
@@ -1502,55 +1463,55 @@
 			 0, 0, 0);
 
   DEFVAR_SPECIFIER ("top-gutter-border-width",
-		    &Vgutter_border_width[TOP_GUTTER] /*
+		    &Vgutter_border_width[TOP_EDGE] /*
 *Border width of the top gutter.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-height' for more information.
 */ );
-  Vgutter_border_width[TOP_GUTTER] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vgutter_border_width[TOP_GUTTER],
+  Vgutter_border_width[TOP_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vgutter_border_width[TOP_EDGE],
 			 offsetof (struct window,
-				   gutter_border_width[TOP_GUTTER]),
+				   gutter_border_width[TOP_EDGE]),
 			 gutter_geometry_changed_in_window, 0, 0, 0);
 
   DEFVAR_SPECIFIER ("bottom-gutter-border-width",
-		    &Vgutter_border_width[BOTTOM_GUTTER] /*
+		    &Vgutter_border_width[BOTTOM_EDGE] /*
 *Border width of the bottom gutter.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-height' for more information.
 */ );
-  Vgutter_border_width[BOTTOM_GUTTER] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vgutter_border_width[BOTTOM_GUTTER],
+  Vgutter_border_width[BOTTOM_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vgutter_border_width[BOTTOM_EDGE],
 			 offsetof (struct window,
-				   gutter_border_width[BOTTOM_GUTTER]),
+				   gutter_border_width[BOTTOM_EDGE]),
 			 gutter_geometry_changed_in_window, 0, 0, 0);
 
   DEFVAR_SPECIFIER ("left-gutter-border-width",
-		    &Vgutter_border_width[LEFT_GUTTER] /*
+		    &Vgutter_border_width[LEFT_EDGE] /*
 *Border width of left gutter.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-height' for more information.
 */ );
-  Vgutter_border_width[LEFT_GUTTER] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vgutter_border_width[LEFT_GUTTER],
+  Vgutter_border_width[LEFT_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vgutter_border_width[LEFT_EDGE],
 			 offsetof (struct window,
-				   gutter_border_width[LEFT_GUTTER]),
+				   gutter_border_width[LEFT_EDGE]),
 			 gutter_geometry_changed_in_window, 0, 0, 0);
 
   DEFVAR_SPECIFIER ("right-gutter-border-width",
-		    &Vgutter_border_width[RIGHT_GUTTER] /*
+		    &Vgutter_border_width[RIGHT_EDGE] /*
 *Border width of right gutter.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-height' for more information.
 */ );
-  Vgutter_border_width[RIGHT_GUTTER] = Fmake_specifier (Qnatnum);
-  set_specifier_caching (Vgutter_border_width[RIGHT_GUTTER],
+  Vgutter_border_width[RIGHT_EDGE] = Fmake_specifier (Qnatnum);
+  set_specifier_caching (Vgutter_border_width[RIGHT_EDGE],
 			 offsetof (struct window,
-				   gutter_border_width[RIGHT_GUTTER]),
+				   gutter_border_width[RIGHT_EDGE]),
 			 gutter_geometry_changed_in_window, 0, 0, 0);
 
   fb = Qnil;
@@ -1567,11 +1528,11 @@
   if (!NILP (fb))
     set_specifier_fallback (Vdefault_gutter_border_width, fb);
 
-  set_specifier_fallback (Vgutter_border_width[TOP_GUTTER], Vdefault_gutter_border_width);
+  set_specifier_fallback (Vgutter_border_width[TOP_EDGE], Vdefault_gutter_border_width);
   fb = list1 (Fcons (Qnil, Qzero));
-  set_specifier_fallback (Vgutter_border_width[BOTTOM_GUTTER], fb);
-  set_specifier_fallback (Vgutter_border_width[LEFT_GUTTER],   fb);
-  set_specifier_fallback (Vgutter_border_width[RIGHT_GUTTER],  fb);
+  set_specifier_fallback (Vgutter_border_width[BOTTOM_EDGE], fb);
+  set_specifier_fallback (Vgutter_border_width[LEFT_EDGE],   fb);
+  set_specifier_fallback (Vgutter_border_width[RIGHT_EDGE],  fb);
 
   DEFVAR_SPECIFIER ("default-gutter-visible-p", &Vdefault_gutter_visible_p /*
 *Whether the default gutter is visible.
@@ -1596,64 +1557,64 @@
 			 0, 0, 0);
 
   DEFVAR_SPECIFIER ("top-gutter-visible-p",
-		    &Vgutter_visible_p[TOP_GUTTER] /*
+		    &Vgutter_visible_p[TOP_EDGE] /*
 *Whether the top gutter is visible.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-visible-p' for more information.
 */ );
-  Vgutter_visible_p[TOP_GUTTER] = Fmake_specifier (Qgutter_visible);
-  set_specifier_caching (Vgutter_visible_p[TOP_GUTTER],
+  Vgutter_visible_p[TOP_EDGE] = Fmake_specifier (Qgutter_visible);
+  set_specifier_caching (Vgutter_visible_p[TOP_EDGE],
 			 offsetof (struct window,
-				   gutter_visible_p[TOP_GUTTER]),
+				   gutter_visible_p[TOP_EDGE]),
 			 top_gutter_specs_changed, 0, 0, 0);
 
   DEFVAR_SPECIFIER ("bottom-gutter-visible-p",
-		    &Vgutter_visible_p[BOTTOM_GUTTER] /*
+		    &Vgutter_visible_p[BOTTOM_EDGE] /*
 *Whether the bottom gutter is visible.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-visible-p' for more information.
 */ );
-  Vgutter_visible_p[BOTTOM_GUTTER] = Fmake_specifier (Qgutter_visible);
-  set_specifier_caching (Vgutter_visible_p[BOTTOM_GUTTER],
+  Vgutter_visible_p[BOTTOM_EDGE] = Fmake_specifier (Qgutter_visible);
+  set_specifier_caching (Vgutter_visible_p[BOTTOM_EDGE],
 			 offsetof (struct window,
-				   gutter_visible_p[BOTTOM_GUTTER]),
+				   gutter_visible_p[BOTTOM_EDGE]),
 			 bottom_gutter_specs_changed, 0, 0, 0);
 
   DEFVAR_SPECIFIER ("left-gutter-visible-p",
-		    &Vgutter_visible_p[LEFT_GUTTER] /*
+		    &Vgutter_visible_p[LEFT_EDGE] /*
 *Whether the left gutter is visible.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-visible-p' for more information.
 */ );
-  Vgutter_visible_p[LEFT_GUTTER] = Fmake_specifier (Qgutter_visible);
-  set_specifier_caching (Vgutter_visible_p[LEFT_GUTTER],
+  Vgutter_visible_p[LEFT_EDGE] = Fmake_specifier (Qgutter_visible);
+  set_specifier_caching (Vgutter_visible_p[LEFT_EDGE],
 			 offsetof (struct window,
-				   gutter_visible_p[LEFT_GUTTER]),
+				   gutter_visible_p[LEFT_EDGE]),
 			 left_gutter_specs_changed, 0, 0, 0);
 
   DEFVAR_SPECIFIER ("right-gutter-visible-p",
-		    &Vgutter_visible_p[RIGHT_GUTTER] /*
+		    &Vgutter_visible_p[RIGHT_EDGE] /*
 *Whether the right gutter is visible.
 This is a specifier; use `set-specifier' to change it.
 
 See `default-gutter-visible-p' for more information.
 */ );
-  Vgutter_visible_p[RIGHT_GUTTER] = Fmake_specifier (Qgutter_visible);
-  set_specifier_caching (Vgutter_visible_p[RIGHT_GUTTER],
+  Vgutter_visible_p[RIGHT_EDGE] = Fmake_specifier (Qgutter_visible);
+  set_specifier_caching (Vgutter_visible_p[RIGHT_EDGE],
 			 offsetof (struct window,
-				   gutter_visible_p[RIGHT_GUTTER]),
+				   gutter_visible_p[RIGHT_EDGE]),
 			 right_gutter_specs_changed, 0, 0, 0);
 
   /* initially, top inherits from default; this can be
      changed with `set-default-gutter-position'. */
   fb = list1 (Fcons (Qnil, Qt));
   set_specifier_fallback (Vdefault_gutter_visible_p, fb);
-  set_specifier_fallback (Vgutter_visible_p[TOP_GUTTER],
+  set_specifier_fallback (Vgutter_visible_p[TOP_EDGE],
 			  Vdefault_gutter_visible_p);
-  set_specifier_fallback (Vgutter_visible_p[BOTTOM_GUTTER], fb);
-  set_specifier_fallback (Vgutter_visible_p[LEFT_GUTTER],   fb);
-  set_specifier_fallback (Vgutter_visible_p[RIGHT_GUTTER],  fb);
+  set_specifier_fallback (Vgutter_visible_p[BOTTOM_EDGE], fb);
+  set_specifier_fallback (Vgutter_visible_p[LEFT_EDGE],   fb);
+  set_specifier_fallback (Vgutter_visible_p[RIGHT_EDGE],  fb);
 }
--- a/src/gutter.h	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/gutter.h	Thu Feb 25 04:45:13 2010 -0600
@@ -1,5 +1,6 @@
 /* Define general gutter support.
    Copyright (C) 1999 Andy Piper.
+   Copyright (C) 2010 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -36,18 +37,6 @@
 #define DEFAULT_GUTTER_WIDTH		40
 #define DEFAULT_GUTTER_BORDER_WIDTH	2
 
-enum gutter_pos
-{
-  TOP_GUTTER     = 0,
-  BOTTOM_GUTTER  = 1,
-  LEFT_GUTTER    = 2,
-  RIGHT_GUTTER   = 3
-};
-
-/* Iterate over all possible gutter positions */
-#define GUTTER_POS_LOOP(var) \
-  for (var = (enum gutter_pos) 0; var < 4; var = (enum gutter_pos) (var + 1))
-
 extern Lisp_Object Qgutter;
 
 extern Lisp_Object Vgutter_size[4];
@@ -97,13 +86,13 @@
 
 /* these macros predicate size on position and type of window */
 #define WINDOW_REAL_TOP_GUTTER_BOUNDS(w)	\
-   WINDOW_REAL_GUTTER_BOUNDS (w,TOP_GUTTER)
+   WINDOW_REAL_GUTTER_BOUNDS (w,TOP_EDGE)
 #define WINDOW_REAL_BOTTOM_GUTTER_BOUNDS(w)	\
-   WINDOW_REAL_GUTTER_BOUNDS (w,BOTTOM_GUTTER)
+   WINDOW_REAL_GUTTER_BOUNDS (w,BOTTOM_EDGE)
 #define WINDOW_REAL_LEFT_GUTTER_BOUNDS(w)	\
-   WINDOW_REAL_GUTTER_BOUNDS (w,LEFT_GUTTER)
+   WINDOW_REAL_GUTTER_BOUNDS (w,LEFT_EDGE)
 #define WINDOW_REAL_RIGHT_GUTTER_BOUNDS(w)	\
-   WINDOW_REAL_GUTTER_BOUNDS (w,RIGHT_GUTTER)
+   WINDOW_REAL_GUTTER_BOUNDS (w,RIGHT_EDGE)
 
 #define FRAME_GUTTER_VISIBLE(f, pos) \
    WINDOW_REAL_GUTTER_VISIBLE (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), pos)
@@ -119,12 +108,12 @@
 
 /* these macros predicate size on position and type of window */
 #define FRAME_TOP_GUTTER_BOUNDS(f) \
-   WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), TOP_GUTTER)
+   WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), TOP_EDGE)
 #define FRAME_BOTTOM_GUTTER_BOUNDS(f) \
-   WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), BOTTOM_GUTTER)
+   WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), BOTTOM_EDGE)
 #define FRAME_LEFT_GUTTER_BOUNDS(f) \
-   WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), LEFT_GUTTER)
+   WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), LEFT_EDGE)
 #define FRAME_RIGHT_GUTTER_BOUNDS(f) \
-   WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), RIGHT_GUTTER)
+   WINDOW_REAL_GUTTER_BOUNDS (XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)), RIGHT_EDGE)
 
 #endif /* INCLUDED_gutter_h_ */
--- a/src/lisp.h	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/lisp.h	Thu Feb 25 04:45:13 2010 -0600
@@ -1544,16 +1544,6 @@
   RUN_HOOKS_UNTIL_FAILURE
 };
 
-#ifdef HAVE_TOOLBARS
-enum toolbar_pos
-{
-  TOP_TOOLBAR,
-  BOTTOM_TOOLBAR,
-  LEFT_TOOLBAR,
-  RIGHT_TOOLBAR
-};
-#endif
-
 enum edge_style
 {
   EDGE_ETCHED_IN,
--- a/src/native-gtk-toolbar.c	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/native-gtk-toolbar.c	Thu Feb 25 04:45:13 2010 -0600
@@ -1,5 +1,6 @@
 /* toolbar implementation -- GTK interface.
    Copyright (C) 2000 Aaron Lehmann
+   Copyright (C) 2010 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -32,29 +33,8 @@
 #include "toolbar.h"
 #include "window.h"
 
-#define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag)			\
-  do {									\
-    switch (pos)							\
-      {									\
-      case TOP_TOOLBAR:							\
-	(frame)->top_toolbar_was_visible = flag;			\
-	break;								\
-      case BOTTOM_TOOLBAR:						\
-	(frame)->bottom_toolbar_was_visible = flag;			\
-	break;								\
-      case LEFT_TOOLBAR:						\
-	(frame)->left_toolbar_was_visible = flag;			\
-	break;								\
-      case RIGHT_TOOLBAR:						\
-	(frame)->right_toolbar_was_visible = flag;			\
-	break;								\
-      default:								\
-	ABORT ();							\
-      }									\
-  } while (0)
-
 static void
-gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos);
+gtk_clear_toolbar (struct frame *f, enum edge_pos pos);
 
 static void
 gtk_toolbar_callback (GtkWidget *UNUSED (w), gpointer user_data)
@@ -66,7 +46,7 @@
 
 
 static void
-gtk_output_toolbar (struct frame *f, enum toolbar_pos pos)
+gtk_output_toolbar (struct frame *f, enum edge_pos pos)
 {
   GtkWidget *toolbar;
   Lisp_Object button, window, glyph, instance;
@@ -114,7 +94,7 @@
   {
     gtk_clear_toolbar (f, pos);
     FRAME_GTK_TOOLBAR_WIDGET (f)[pos] = toolbar =
-      gtk_toolbar_new (((pos == TOP_TOOLBAR) || (pos == BOTTOM_TOOLBAR)) ?
+      gtk_toolbar_new (((pos == TOP_EDGE) || (pos == BOTTOM_EDGE)) ?
 		       GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL,
 		       GTK_TOOLBAR_BOTH);
   }
@@ -193,7 +173,7 @@
 }
 
 static void
-gtk_clear_toolbar (struct frame *f, enum toolbar_pos pos)
+gtk_clear_toolbar (struct frame *f, enum edge_pos pos)
 {
   FRAME_GTK_TOOLBAR_CHECKSUM (f, pos) = 0;
   SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 0);
@@ -204,25 +184,15 @@
 static void
 gtk_output_frame_toolbars (struct frame *f)
 {
-  if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
-    gtk_output_toolbar (f, TOP_TOOLBAR);
-  else if (f->top_toolbar_was_visible)
-    gtk_clear_toolbar (f, TOP_TOOLBAR);
-
-  if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
-    gtk_output_toolbar (f, BOTTOM_TOOLBAR);
-  else if (f->bottom_toolbar_was_visible)
-    gtk_clear_toolbar (f, LEFT_TOOLBAR);
+  enum edge_pos pos;
 
-  if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
-    gtk_output_toolbar (f, LEFT_TOOLBAR);
-  else if (f->left_toolbar_was_visible)
-    gtk_clear_toolbar (f, LEFT_TOOLBAR);
-
-  if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
-    gtk_output_toolbar (f, RIGHT_TOOLBAR);
-  else if (f->right_toolbar_was_visible)
-    gtk_clear_toolbar (f, RIGHT_TOOLBAR);
+  EDGE_POS_LOOP (pos)
+    {
+      if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
+	gtk_output_toolbar (f, pos);
+      else if (f->toolbar_was_visible[pos])
+	gtk_clear_toolbar (f, pos);
+    }
 }
 
 static void
--- a/src/toolbar-msw.c	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/toolbar-msw.c	Thu Feb 25 04:45:13 2010 -0600
@@ -1,7 +1,7 @@
 /* toolbar implementation -- mswindows interface.
    Copyright (C) 1995 Board of Trustees, University of Illinois.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1995, 1996, 2002 Ben Wing.
+   Copyright (C) 1995, 1996, 2002, 2010 Ben Wing.
    Copyright (C) 1996 Chuck Thompson.
    Copyright (C) 1998 Andy Piper.
 
@@ -52,39 +52,18 @@
 #define TOOLBAR_ITEM_ID_BITS(x) (((x) & 0x3FFF) | 0x4000)
 #define TOOLBAR_ID_BIAS 16
 #define TOOLBAR_HANDLE(f,p) \
-GetDlgItem(FRAME_MSWINDOWS_HANDLE(f), TOOLBAR_ID_BIAS + p)
+GetDlgItem (FRAME_MSWINDOWS_HANDLE (f), TOOLBAR_ID_BIAS + p)
 
 #define MSWINDOWS_BUTTON_SHADOW_THICKNESS 2
 #define MSWINDOWS_BLANK_SIZE 5
 #define MSWINDOWS_MINIMUM_TOOLBAR_SIZE 8
 
 static void
-mswindows_move_toolbar (struct frame *f, enum toolbar_pos pos);
-
-#define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag)			\
-  do {									\
-    switch (pos)							\
-      {									\
-      case TOP_TOOLBAR:							\
-	(frame)->top_toolbar_was_visible = flag;			\
-	break;								\
-      case BOTTOM_TOOLBAR:						\
-	(frame)->bottom_toolbar_was_visible = flag;			\
-	break;								\
-      case LEFT_TOOLBAR:						\
-	(frame)->left_toolbar_was_visible = flag;			\
-	break;								\
-      case RIGHT_TOOLBAR:						\
-	(frame)->right_toolbar_was_visible = flag;			\
-	break;								\
-      default:								\
-	ABORT ();							\
-      }									\
-  } while (0)
+mswindows_move_toolbar (struct frame *f, enum edge_pos pos);
 
 static int
 allocate_toolbar_item_id (struct frame *f, struct toolbar_button *button,
-			  enum toolbar_pos UNUSED (pos))
+			  enum edge_pos UNUSED (pos))
 {
   /* hmm what do we generate an id based on */
   int id = TOOLBAR_ITEM_ID_BITS (internal_hash (button->callback, 0));
@@ -97,7 +76,7 @@
 }
 
 static void
-mswindows_clear_toolbar (struct frame *f, enum toolbar_pos pos,
+mswindows_clear_toolbar (struct frame *f, enum edge_pos pos,
 			 int UNUSED (thickness_change))
 {
   HIMAGELIST ilist = NULL;
@@ -123,11 +102,11 @@
       qxeSendMessage (toolbarwnd, TB_GETIMAGELIST, 0, (LONG) &ilist);
       if (ilist)
 	{
-	  ImageList_Destroy(ilist);
+	  ImageList_Destroy (ilist);
 	}
       qxeSendMessage (toolbarwnd, TB_SETIMAGELIST, 0, (LPARAM)NULL);
 
-      ShowWindow(toolbarwnd, SW_HIDE);
+      ShowWindow (toolbarwnd, SW_HIDE);
     }
 
   FRAME_MSWINDOWS_TOOLBAR_CHECKSUM (f, pos) = 0;
@@ -135,7 +114,7 @@
 }
 
 static void
-mswindows_output_toolbar (struct frame *f, enum toolbar_pos pos)
+mswindows_output_toolbar (struct frame *f, enum edge_pos pos)
 {
   int x, y, bar_width, bar_height, vert;
   int width=-1, height=-1, bmwidth=0, bmheight=0, maxbmwidth, maxbmheight;
@@ -208,7 +187,7 @@
 
       struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
       checksum = HASH5 (checksum, 
-			internal_hash (get_toolbar_button_glyph(w, tb), 0),
+			internal_hash (get_toolbar_button_glyph (w, tb), 0),
 			internal_hash (tb->callback, 0),
 			width,
 			LISP_HASH (w->toolbar_buttons_captioned_p));
@@ -217,7 +196,7 @@
     }
 
   /* only rebuild if something has changed */
-  if (!toolbarwnd || FRAME_MSWINDOWS_TOOLBAR_CHECKSUM(f,pos)!=checksum)
+  if (!toolbarwnd || FRAME_MSWINDOWS_TOOLBAR_CHECKSUM (f,pos)!=checksum)
     {
       /* remove the old one */
       mswindows_clear_toolbar (f, pos, 0);
@@ -401,7 +380,7 @@
 
       /* finally populate with images */
       if (qxeSendMessage (toolbarwnd, TB_BUTTONSTRUCTSIZE,
-			  (WPARAM)sizeof(TBBUTTON), (LPARAM)0) == -1) 
+			  (WPARAM)sizeof (TBBUTTON), (LPARAM)0) == -1) 
 	{
 	  mswindows_clear_toolbar (f, pos, 0);
 	  gui_error ("couldn't set button structure size", Qunbound);
@@ -446,7 +425,7 @@
       else
 	{
 	  RECT tmp;
-	  qxeSendMessage (toolbarwnd, TB_SETROWS, MAKEWPARAM(1, FALSE), 
+	  qxeSendMessage (toolbarwnd, TB_SETROWS, MAKEWPARAM (1, FALSE), 
 			  (LPARAM)&tmp);
 	}
 
@@ -475,10 +454,10 @@
 }
 
 static void
-mswindows_move_toolbar (struct frame *f, enum toolbar_pos pos)
+mswindows_move_toolbar (struct frame *f, enum edge_pos pos)
 {
   int bar_x, bar_y, bar_width, bar_height, vert;
-  HWND toolbarwnd = TOOLBAR_HANDLE(f,pos);
+  HWND toolbarwnd = TOOLBAR_HANDLE (f,pos);
 
   if (toolbarwnd)
     {
@@ -490,19 +469,19 @@
 	 by Windows and by XEmacs. */
       switch (pos)
 	{
-	case TOP_TOOLBAR:
+	case TOP_EDGE:
 	  bar_x--; bar_y-=2;
 	  bar_width+=3; bar_height+=3;
 	  break;
-	case LEFT_TOOLBAR:
+	case LEFT_EDGE:
 	  bar_x--; bar_y-=2;
 	  bar_height++; bar_width++;
 	  break;
-	case BOTTOM_TOOLBAR:
+	case BOTTOM_EDGE:
 	  bar_y-=2; 
 	  bar_width+=4; bar_height+=4;
 	  break;
-	case RIGHT_TOOLBAR:
+	case RIGHT_EDGE:
 	  bar_y-=2; bar_x++;
 	  bar_width++; bar_height++;
 	  break;
@@ -517,19 +496,14 @@
 				   int UNUSED (x), int UNUSED (y),
 				   int UNUSED (width), int UNUSED (height))
 {
+  enum edge_pos pos;
   assert (FRAME_MSWINDOWS_P (f));
 
-  if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
-    mswindows_move_toolbar (f, TOP_TOOLBAR);
-
-  if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
-    mswindows_move_toolbar (f, BOTTOM_TOOLBAR);
-
-  if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
-    mswindows_move_toolbar (f, LEFT_TOOLBAR);
-
-  if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
-    mswindows_move_toolbar (f, RIGHT_TOOLBAR);
+  EDGE_POS_LOOP (pos)
+    {
+      if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
+	mswindows_move_toolbar (f, pos);
+    }
 }
 
 static void
@@ -542,41 +516,33 @@
 static void
 mswindows_initialize_frame_toolbars (struct frame *UNUSED (f))
 {
-
 }
 
 static void
 mswindows_output_frame_toolbars (struct frame *f)
 {
+  enum edge_pos pos;
   assert (FRAME_MSWINDOWS_P (f));
 
-  if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
-    mswindows_output_toolbar (f, TOP_TOOLBAR);
-  if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
-    mswindows_output_toolbar (f, BOTTOM_TOOLBAR);
-  if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
-    mswindows_output_toolbar (f, LEFT_TOOLBAR);
-  if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
-    mswindows_output_toolbar (f, RIGHT_TOOLBAR);
+  EDGE_POS_LOOP (pos)
+    {
+      if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
+	mswindows_output_toolbar (f, pos);
+    }
 }
 
 static void
 mswindows_clear_frame_toolbars (struct frame *f)
 {
+  enum edge_pos pos;
   assert (FRAME_MSWINDOWS_P (f));
 
-  if (f->top_toolbar_was_visible
-      && !FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
-    mswindows_clear_toolbar (f, TOP_TOOLBAR, 0);
-  if (f->bottom_toolbar_was_visible
-      && !FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
-    mswindows_clear_toolbar (f, BOTTOM_TOOLBAR, 0);
-  if (f->left_toolbar_was_visible 
-      && !FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
-    mswindows_clear_toolbar (f, LEFT_TOOLBAR, 0);
-  if (f->right_toolbar_was_visible 
-      && !FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
-    mswindows_clear_toolbar (f, RIGHT_TOOLBAR, 0);
+  EDGE_POS_LOOP (pos)
+    {
+      if (f->toolbar_was_visible[pos]
+	  && !FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
+	mswindows_clear_toolbar (f, pos, 0);
+    }
 }
 
 static void
@@ -584,15 +550,15 @@
 {
   HWND twnd=NULL;
 #define DELETE_TOOLBAR(pos)				\
-  mswindows_clear_toolbar(f, pos, 0);			\
-  if ((twnd=GetDlgItem(FRAME_MSWINDOWS_HANDLE(f),	\
+  mswindows_clear_toolbar (f, pos, 0);			\
+  if ((twnd=GetDlgItem (FRAME_MSWINDOWS_HANDLE (f),	\
 		       TOOLBAR_ID_BIAS + pos)))		\
-      DestroyWindow(twnd)
+      DestroyWindow (twnd)
 
-  DELETE_TOOLBAR(TOP_TOOLBAR);
-  DELETE_TOOLBAR(BOTTOM_TOOLBAR);
-  DELETE_TOOLBAR(LEFT_TOOLBAR);
-  DELETE_TOOLBAR(RIGHT_TOOLBAR);
+  DELETE_TOOLBAR (TOP_EDGE);
+  DELETE_TOOLBAR (BOTTOM_EDGE);
+  DELETE_TOOLBAR (LEFT_EDGE);
+  DELETE_TOOLBAR (RIGHT_EDGE);
 #undef DELETE_TOOLBAR
 }
 
--- a/src/toolbar-xlike.c	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/toolbar-xlike.c	Thu Feb 25 04:45:13 2010 -0600
@@ -38,14 +38,14 @@
 
 /* Only a very few things need to differ based on the toolkit used.
 **
-** Some of the routines used assert(FRAME_yyy_P(f)) checks, this is
+** Some of the routines used assert (FRAME_yyy_P(f)) checks, this is
 ** now abstracted into __INTERNAL_APPROPRIATENESS_CHECK().  When we
 ** add new window systems that use this code, we should either add a
 ** new case here, or just remove the checks completely.
 **
 ** At least for X & GTK redraw_frame_toolbars() might end up getting
 ** called before we are completely initialized.  To avoid this, we use
-** the __INTERNAL_MAPPED_P(f) macro, that should return 0 if we should
+** the __INTERNAL_MAPPED_P (f) macro, that should return 0 if we should
 ** not draw the toolbars yet.  When we add new window systems that use
 ** this code, we should add a new case here, if they need it.
 **
@@ -85,7 +85,7 @@
   Lisp_Object  window = FRAME_LAST_NONMINIBUF_WINDOW (f);
   struct window *w = XWINDOW (window);
   int shadow_thickness;
-  int def_shadow_thickness = XINT (Fspecifier_instance(Vtoolbar_shadow_thickness, window, Qnil, Qnil));
+  int def_shadow_thickness = XINT (Fspecifier_instance (Vtoolbar_shadow_thickness, window, Qnil, Qnil));
   face_index toolbar_findex;
 
   if (tb->vertical)
@@ -103,7 +103,7 @@
 
   toolbar_findex = get_builtin_face_cache_index (w, Vtoolbar_face);
 
-  /* Blank toolbar buttons that should be 3d will have EQ(tb->up_glyph, Qt)
+  /* Blank toolbar buttons that should be 3d will have EQ (tb->up_glyph, Qt)
   ** Blank toolbar buttons that should be flat will have NILP (tb->up_glyph)
   **
   ** Real toolbar buttons will check tb->enabled && tb->down
@@ -143,7 +143,7 @@
       MAYBE_DEVMETH (d, bevel_area,
 		     (w, toolbar_findex, sx + x_adj,
 		      sy + y_adj, swidth + width_adj,
-		      sheight + height_adj, abs(shadow_thickness),
+		      sheight + height_adj, abs (shadow_thickness),
 		      EDGE_ALL, (shadow_thickness < 0) ? EDGE_BEVEL_IN
 						       : EDGE_BEVEL_OUT));
     }
@@ -370,7 +370,7 @@
   return (size);
 }
 
-#define XLIKE_OUTPUT_BUTTONS_LOOP(left)				\
+#define XLIKE_OUTPUT_BUTTONS_LOOP(left)					\
   do {									\
     while (!NILP (button))						\
       {									\
@@ -436,29 +436,8 @@
       }									\
   } while (0)
 
-#define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag)			\
-  do {									\
-    switch (pos)							\
-      {									\
-      case TOP_TOOLBAR:							\
-	(frame)->top_toolbar_was_visible = flag;			\
-	break;								\
-      case BOTTOM_TOOLBAR:						\
-	(frame)->bottom_toolbar_was_visible = flag;			\
-	break;								\
-      case LEFT_TOOLBAR:						\
-	(frame)->left_toolbar_was_visible = flag;			\
-	break;								\
-      case RIGHT_TOOLBAR:						\
-	(frame)->right_toolbar_was_visible = flag;			\
-	break;								\
-      default:								\
-	ABORT ();							\
-      }									\
-  } while (0)
-
 static void
-xlike_output_toolbar (struct frame *f, enum toolbar_pos pos)
+xlike_output_toolbar (struct frame *f, enum edge_pos pos)
 {
   int x, y, bar_width, bar_height, vert;
   int max_pixpos, right_size, right_start, blank_size;
@@ -582,7 +561,7 @@
 }
 
 static void
-xlike_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change)
+xlike_clear_toolbar (struct frame *f, enum edge_pos pos, int thickness_change)
 {
   Lisp_Object frame;
   int x, y, width, height, vert;
@@ -594,7 +573,7 @@
      to clear any excess toolbar if the size shrinks. */
   if (thickness_change < 0)
     {
-      if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR)
+      if (pos == LEFT_EDGE || pos == RIGHT_EDGE)
 	{
 	  x = x + width + thickness_change;
 	  width = -thickness_change;
@@ -616,42 +595,32 @@
 void
 xlike_output_frame_toolbars (struct frame *f)
 {
-  __INTERNAL_APPROPRIATENESS_CHECK(f);
-
-  if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
-    xlike_output_toolbar (f, TOP_TOOLBAR);
+  enum edge_pos pos;
+  __INTERNAL_APPROPRIATENESS_CHECK (f);
 
-  if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
-    xlike_output_toolbar (f, BOTTOM_TOOLBAR);
-
-  if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
-    xlike_output_toolbar (f, LEFT_TOOLBAR);
-
-  if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
-    xlike_output_toolbar (f, RIGHT_TOOLBAR);
+  EDGE_POS_LOOP (pos)
+    {
+      if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
+	xlike_output_toolbar (f, pos);
+    }
 }
 
 void
 xlike_clear_frame_toolbars (struct frame *f)
 {
-  __INTERNAL_APPROPRIATENESS_CHECK(f);
+  enum edge_pos pos;
+  __INTERNAL_APPROPRIATENESS_CHECK (f);
 
-  if (f->top_toolbar_was_visible
-      && !FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
-    xlike_clear_toolbar (f, TOP_TOOLBAR, 0);
-  if (f->bottom_toolbar_was_visible
-      && !FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
-    xlike_clear_toolbar (f, BOTTOM_TOOLBAR, 0);
-  if (f->left_toolbar_was_visible 
-      && !FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
-    xlike_clear_toolbar (f, LEFT_TOOLBAR, 0);
-  if (f->right_toolbar_was_visible 
-       && !FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
-    xlike_clear_toolbar (f, RIGHT_TOOLBAR, 0);
+  EDGE_POS_LOOP (pos)
+    {
+      if (f->toolbar_was_visible[pos]
+	  && !FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
+	xlike_clear_toolbar (f, pos, 0);
+    }
 }
 
 static void
-xlike_redraw_exposed_toolbar (struct frame *f, enum toolbar_pos pos, int x, int y,
+xlike_redraw_exposed_toolbar (struct frame *f, enum edge_pos pos, int x, int y,
 			    int width, int height)
 {
   int bar_x, bar_y, bar_width, bar_height, vert;
@@ -701,19 +670,14 @@
 xlike_redraw_exposed_toolbars (struct frame *f, int x, int y, int width,
 				int height)
 {
-  __INTERNAL_APPROPRIATENESS_CHECK(f);
-
-  if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
-    xlike_redraw_exposed_toolbar (f, TOP_TOOLBAR, x, y, width, height);
+  enum edge_pos pos;
+  __INTERNAL_APPROPRIATENESS_CHECK (f);
 
-  if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
-    xlike_redraw_exposed_toolbar (f, BOTTOM_TOOLBAR, x, y, width, height);
-
-  if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
-    xlike_redraw_exposed_toolbar (f, LEFT_TOOLBAR, x, y, width, height);
-
-  if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
-    xlike_redraw_exposed_toolbar (f, RIGHT_TOOLBAR, x, y, width, height);
+  EDGE_POS_LOOP (pos)
+    {
+      if (FRAME_REAL_TOOLBAR_VISIBLE (f, pos))
+	xlike_redraw_exposed_toolbar (f, pos, x, y, width, height);
+    }
 }
 
 void
@@ -724,7 +688,7 @@
      particular before we have actually mapped it.  That routine can
      call this one.  So, we need to make sure that the frame is
      actually ready before we try and draw all over it. */
-  if (__INTERNAL_MAPPED_P(f))
+  if (__INTERNAL_MAPPED_P (f))
     xlike_redraw_exposed_toolbars (f, 0, 0, FRAME_PIXWIDTH (f),
 				    FRAME_PIXHEIGHT (f));
 }
--- 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 /*
--- a/src/toolbar.h	Thu Feb 25 04:10:52 2010 -0600
+++ b/src/toolbar.h	Thu Feb 25 04:45:13 2010 -0600
@@ -1,6 +1,6 @@
 /* Define general toolbar support.
    Copyright (C) 1995 Board of Trustees, University of Illinois.
-   Copyright (C) 1995, 1996 Ben Wing.
+   Copyright (C) 1995, 1996, 2010 Ben Wing.
    Copyright (C) 1996 Chuck Thompson.
 
 This file is part of XEmacs.
@@ -33,6 +33,11 @@
   ((frame)->toolbar_buttons[pos])
 #define FRAME_CURRENT_TOOLBAR_SIZE(frame, pos)	\
   ((frame)->current_toolbar_size[pos])
+#define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag)	\
+  do {							\
+    (frame)->toolbar_was_visible[pos] = flag;		\
+  } while (0)
+
 #define DEVICE_SUPPORTS_TOOLBARS_P(d)		\
   HAS_DEVMETH_P (d, output_frame_toolbars)
 
@@ -76,7 +81,7 @@
 #define CHECK_TOOLBAR_BUTTON(x) CHECK_RECORD (x, toolbar_button)
 #define CONCHECK_TOOLBAR_BUTTON(x) CONCHECK_RECORD (x, toolbar_button)
 
-void get_toolbar_coords (struct frame *f, enum toolbar_pos pos, int *x,
+void get_toolbar_coords (struct frame *f, enum edge_pos pos, int *x,
 			 int *y, int *width, int *height, int *vert,
 			 int for_layout);
 Lisp_Object toolbar_button_at_pixpos (struct frame *f, int x_coord,
@@ -106,7 +111,7 @@
 void free_frame_toolbars (struct frame *f);
 Lisp_Object get_toolbar_button_glyph (struct window *w,
 				      struct toolbar_button *tb);
-void mark_frame_toolbar_buttons_dirty (struct frame *f, enum toolbar_pos pos);
+void mark_frame_toolbar_buttons_dirty (struct frame *f, enum edge_pos pos);
 
 #endif /* HAVE_TOOLBARS */