/[emacs]/emacs/src/xmenu.c
ViewVC logotype

Diff of /emacs/src/xmenu.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.256 by jhd, Fri Aug 27 16:57:36 2004 UTC revision 1.257 by jhd, Mon Aug 30 19:42:53 2004 UTC
# Line 1701  digest_single_submenu (start, end, top_l Line 1701  digest_single_submenu (start, end, top_l
1701                  save_wv->next = wv;                  save_wv->next = wv;
1702                else                else
1703                  first_wv->contents = wv;                  first_wv->contents = wv;
1704                wv->name = pane_string;                wv->lname = pane_name;
1705                /* Ignore the @ that means "separate pane".                /* Set value to 1 so update_submenu_strings can handle '@'  */
1706                   This is a kludge, but this isn't worth more time.  */                wv->value = (char *)1;
               if (!NILP (prefix) && wv->name[0] == '@')  
                 wv->name++;  
               wv->value = 0;  
1707                wv->enabled = 1;                wv->enabled = 1;
1708                wv->button_type = BUTTON_TYPE_NONE;                wv->button_type = BUTTON_TYPE_NONE;
1709                wv->help = Qnil;                wv->help = Qnil;
# Line 1749  digest_single_submenu (start, end, top_l Line 1746  digest_single_submenu (start, end, top_l
1746            else            else
1747              save_wv->contents = wv;              save_wv->contents = wv;
1748    
1749            wv->name = (char *) SDATA (item_name);            wv->lname = item_name;
1750            if (!NILP (descrip))            if (!NILP (descrip))
1751              wv->key = (char *) SDATA (descrip);              wv->lkey = descrip;
1752            wv->value = 0;            wv->value = 0;
1753            /* The EMACS_INT cast avoids a warning.  There's no problem            /* The EMACS_INT cast avoids a warning.  There's no problem
1754               as long as pointers have enough bits to hold small integers.  */               as long as pointers have enough bits to hold small integers.  */
# Line 1790  digest_single_submenu (start, end, top_l Line 1787  digest_single_submenu (start, end, top_l
1787    
1788    return first_wv;    return first_wv;
1789  }  }
1790    
1791    /* Walk through thw widget_value tree starting at FIRST_WV and update
1792       the char * pointers from the corresponding lisp values.
1793       We do this after building the whole tree, since GC may happen while the
1794       tree is constructed, and small strings are relocated.  So we must wait
1795       until no GC can happen before storing pointers into lisp values.  */
1796    static void
1797    update_submenu_strings (first_wv)
1798         widget_value *first_wv;
1799    {
1800      widget_value *wv;
1801    
1802      for (wv = first_wv; wv; wv = wv->next)
1803        {
1804          if (wv->lname && ! NILP (wv->lname))
1805            {
1806              wv->name = SDATA (wv->lname);
1807    
1808              /* Ignore the @ that means "separate pane".
1809                 This is a kludge, but this isn't worth more time.  */
1810              if (wv->value == (char *)1)
1811                {
1812                  if (wv->name[0] == '@')
1813                    wv->name++;
1814                  wv->value = 0;
1815                }
1816            }
1817    
1818          if (wv->lkey && ! NILP (wv->lkey))
1819            wv->key = SDATA (wv->lkey);
1820    
1821          if (wv->contents)
1822            update_submenu_strings (wv->contents);
1823        }
1824    }
1825    
1826    
1827  /* Recompute all the widgets of frame F, when the menu bar has been  /* Recompute all the widgets of frame F, when the menu bar has been
1828     changed.  Value is non-zero if widgets were updated.  */     changed.  Value is non-zero if widgets were updated.  */
# Line 1930  set_frame_menubar (f, first_time, deep_p Line 1963  set_frame_menubar (f, first_time, deep_p
1963        FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));        FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
1964    
1965        items = FRAME_MENU_BAR_ITEMS (f);        items = FRAME_MENU_BAR_ITEMS (f);
       inhibit_garbage_collection ();  
1966    
1967        /* Save the frame's previous menu bar contents data.  */        /* Save the frame's previous menu bar contents data.  */
1968        if (previous_menu_items_used)        if (previous_menu_items_used)
# Line 2023  set_frame_menubar (f, first_time, deep_p Line 2055  set_frame_menubar (f, first_time, deep_p
2055            Lisp_Object string;            Lisp_Object string;
2056            string = XVECTOR (items)->contents[i + 1];            string = XVECTOR (items)->contents[i + 1];
2057            if (NILP (string))            if (NILP (string))
2058              break;              break;
2059            wv->name = (char *) SDATA (string);            wv->name = (char *) SDATA (ENCODE_MENU_STRING (string));
2060            wv = wv->next;            update_submenu_strings (wv->contents);
2061              wv = wv->next;
2062          }          }
2063    
2064        f->menu_bar_vector = menu_items;        f->menu_bar_vector = menu_items;
# Line 2055  set_frame_menubar (f, first_time, deep_p Line 2088  set_frame_menubar (f, first_time, deep_p
2088              break;              break;
2089    
2090            wv = xmalloc_widget_value ();            wv = xmalloc_widget_value ();
2091            wv->name = (char *) SDATA (string);            wv->name = (char *) SDATA (ENCODE_MENU_STRING (string));
2092            wv->value = 0;            wv->value = 0;
2093            wv->enabled = 1;            wv->enabled = 1;
2094            wv->button_type = BUTTON_TYPE_NONE;            wv->button_type = BUTTON_TYPE_NONE;

Legend:
Removed from v.1.256  
changed lines
  Added in v.1.257

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26