XEmacs 21.4.9 "Informed Management".
[chise/xemacs-chise.git.1] / src / toolbar-x.c
index 5b0fb72..0e5a731 100644 (file)
@@ -23,6 +23,8 @@ Boston, MA 02111-1307, USA.  */
 
 /* Synched up with: Not in FSF. */
 
+/* This file Mule-ized (more like Mule-verified) by Ben Wing, 7-8-00. */
+
 #include <config.h>
 #include "lisp.h"
 
@@ -109,7 +111,7 @@ x_output_toolbar_button (struct frame *f, Lisp_Object button)
   GC top_shadow_gc, bottom_shadow_gc, background_gc;
   Lisp_Object instance, frame, window, glyph;
   struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
-  struct Lisp_Image_Instance *p;
+  Lisp_Image_Instance *p;
   struct window *w;
   int vertical = tb->vertical;
   int border_width = tb->border_width;
@@ -296,9 +298,9 @@ x_get_button_size (struct frame *f, Lisp_Object window,
        return XINT (f->toolbar_size[pos]);
 
       if (vert)
-       size = glyph_height (glyph, Vdefault_face, 0, window);
+       size = glyph_height (glyph, window);
       else
-       size = glyph_width (glyph, Vdefault_face, 0, window);
+       size = glyph_width (glyph, window);
     }
 
   if (!size)
@@ -346,7 +348,8 @@ x_get_button_size (struct frame *f, Lisp_Object window,
            || tb->y != y                                               \
            || tb->width != width                                       \
            || tb->height != height                                     \
-           || tb->dirty)                                               \
+           || tb->dirty                                                \
+           || f->clear) /* This is clearly necessary. */               \
          {                                                             \
            if (width && height)                                        \
              {                                                         \
@@ -555,22 +558,30 @@ x_output_frame_toolbars (struct frame *f)
 
   if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
     x_output_toolbar (f, TOP_TOOLBAR);
-  else if (f->top_toolbar_was_visible)
-    x_clear_toolbar (f, TOP_TOOLBAR, 0);
-
   if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
     x_output_toolbar (f, BOTTOM_TOOLBAR);
-  else if (f->bottom_toolbar_was_visible)
-    x_clear_toolbar (f, BOTTOM_TOOLBAR, 0);
-
   if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
     x_output_toolbar (f, LEFT_TOOLBAR);
-  else if (f->left_toolbar_was_visible)
-    x_clear_toolbar (f, LEFT_TOOLBAR, 0);
-
   if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
     x_output_toolbar (f, RIGHT_TOOLBAR);
-  else if (f->right_toolbar_was_visible)
+}
+
+static void
+x_clear_frame_toolbars (struct frame *f)
+{
+  assert (FRAME_X_P (f));
+
+  if (f->top_toolbar_was_visible
+      && !FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
+    x_clear_toolbar (f, TOP_TOOLBAR, 0);
+  if (f->bottom_toolbar_was_visible
+      && !FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
+    x_clear_toolbar (f, BOTTOM_TOOLBAR, 0);
+  if (f->left_toolbar_was_visible 
+      && !FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
+    x_clear_toolbar (f, LEFT_TOOLBAR, 0);
+  if (f->right_toolbar_was_visible 
+      && !FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
     x_clear_toolbar (f, RIGHT_TOOLBAR, 0);
 }
 
@@ -791,6 +802,7 @@ void
 console_type_create_toolbar_x (void)
 {
   CONSOLE_HAS_METHOD (x, output_frame_toolbars);
+  CONSOLE_HAS_METHOD (x, clear_frame_toolbars);
   CONSOLE_HAS_METHOD (x, initialize_frame_toolbars);
   CONSOLE_HAS_METHOD (x, free_frame_toolbars);
   CONSOLE_HAS_METHOD (x, output_toolbar_button);