(compile_pattern_1): If representation of STRING
[bpt/emacs.git] / src / xmenu.c
index 819f81e..77a367a 100644 (file)
@@ -763,10 +763,14 @@ The menu items come from key bindings that have a menu string as well as\n\
 a definition; actually, the \"definition\" in such a key binding looks like\n\
 \(STRING . REAL-DEFINITION).  To give the menu a title, put a string into\n\
 the keymap as a top-level element.\n\n\
+If REAL-DEFINITION is nil, that puts a nonselectable string in the menu.\n\
+Otherwise, REAL-DEFINITION should be a valid key binding definition.\n\
+\n\
 You can also use a list of keymaps as MENU.\n\
   Then each keymap makes a separate pane.\n\
 When MENU is a keymap or a list of keymaps, the return value\n\
 is a list of events.\n\n\
+\n\
 Alternatively, you can specify a menu of multiple panes\n\
   with a list of the form (TITLE PANE1 PANE2...),\n\
 where each pane is a list of form (TITLE ITEM1 ITEM2...).\n\
@@ -856,8 +860,10 @@ cached information about equivalent key sequences.")
          CHECK_LIVE_WINDOW (window, 0);
          f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
 
-         xpos = (FONT_WIDTH (f->output_data.x->font) * XWINDOW (window)->left);
-         ypos = (f->output_data.x->line_height * XWINDOW (window)->top);
+         xpos = (FONT_WIDTH (f->output_data.x->font)
+                 * XFASTINT (XWINDOW (window)->left));
+         ypos = (f->output_data.x->line_height
+                 * XFASTINT (XWINDOW (window)->top));
        }
       else
        /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME,
@@ -1667,6 +1673,11 @@ set_frame_menubar (f, first_time, deep_p)
        = (Lisp_Object *) alloca (previous_menu_items_used
                                  * sizeof (Lisp_Object));
 
+      /* If we are making a new widget, its contents are empty,
+        do always reinitialize them.  */
+      if (! menubar_widget)
+       previous_menu_items_used = 0;
+
       buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer;
       specbind (Qinhibit_quit, Qt);
       /* Don't let the debugger step into this code
@@ -1733,7 +1744,7 @@ set_frame_menubar (f, first_time, deep_p)
 
       for (i = 0; i < previous_menu_items_used; i++)
        if (menu_items_used == i
-           || (previous_items[i] != XVECTOR (menu_items)->contents[i]))
+           || (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i])))
          break;
       if (i == menu_items_used && i == previous_menu_items_used && i != 0)
        {
@@ -1880,6 +1891,8 @@ free_frame_menubar (f)
   int id;
 
   menubar_widget = f->output_data.x->menubar_widget;
+
+  f->output_data.x->menubar_height = 0;
   
   if (menubar_widget)
     {
@@ -2546,7 +2559,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
                  j++;
                  continue;
                }
-             width = XSTRING (item)->size;
+             width = XSTRING (item)->size_byte;
              if (width > maxwidth)
                maxwidth = width;
 
@@ -2569,7 +2582,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
            = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
          if (!NILP (descrip))
            {
-             int gap = maxwidth - XSTRING (item_name)->size;
+             int gap = maxwidth - XSTRING (item_name)->size_byte;
 #ifdef C_ALLOCA
              Lisp_Object spacer;
              spacer = Fmake_string (make_number (gap), make_number (' '));
@@ -2581,14 +2594,14 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
                 to reduce gc needs.  */
              item_data
                = (unsigned char *) alloca (maxwidth
-                                           + XSTRING (descrip)->size + 1);
+                                           + XSTRING (descrip)->size_byte + 1);
              bcopy (XSTRING (item_name)->data, item_data,
-                    XSTRING (item_name)->size);
+                    XSTRING (item_name)->size_byte);
              for (j = XSTRING (item_name)->size; j < maxwidth; j++)
                item_data[j] = ' ';
              bcopy (XSTRING (descrip)->data, item_data + j,
-                    XSTRING (descrip)->size);
-             item_data[j + XSTRING (descrip)->size] = 0;
+                    XSTRING (descrip)->size_byte);
+             item_data[j + XSTRING (descrip)->size_byte] = 0;
 #endif
            }
          else