emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xmenu.c


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/src/xmenu.c
Date: Tue, 04 Feb 2003 09:03:55 -0500

Index: emacs/src/xmenu.c
diff -c emacs/src/xmenu.c:1.242 emacs/src/xmenu.c:1.243
*** emacs/src/xmenu.c:1.242     Sun Jan 19 16:50:02 2003
--- emacs/src/xmenu.c   Tue Feb  4 09:03:17 2003
***************
*** 487,493 ****
  
  /* This is a subroutine of single_keymap_panes that handles one
     keymap entry.
!    KEY is a key in a keymap and ITEM is its binding. 
     PENDING_MAPS_PTR points to a list of keymaps waiting to be made into
     separate panes.
     If NOTREAL is nonzero, only check for equivalent key bindings, don't
--- 487,493 ----
  
  /* This is a subroutine of single_keymap_panes that handles one
     keymap entry.
!    KEY is a key in a keymap and ITEM is its binding.
     PENDING_MAPS_PTR points to a list of keymaps waiting to be made into
     separate panes.
     If NOTREAL is nonzero, only check for equivalent key bindings, don't
***************
*** 508,514 ****
    Lisp_Object map, item_string, enabled;
    struct gcpro gcpro1, gcpro2;
    int res;
!   
    /* Parse the menu item and leave the result in item_properties.  */
    GCPRO2 (key, item);
    res = parse_menu_item (item, notreal, 0);
--- 508,514 ----
    Lisp_Object map, item_string, enabled;
    struct gcpro gcpro1, gcpro2;
    int res;
! 
    /* Parse the menu item and leave the result in item_properties.  */
    GCPRO2 (key, item);
    res = parse_menu_item (item, notreal, 0);
***************
*** 517,523 ****
      return;                   /* Not a menu item.  */
  
    map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP];
!   
    if (notreal)
      {
        /* We don't want to make a menu, just traverse the keymaps to
--- 517,523 ----
      return;                   /* Not a menu item.  */
  
    map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP];
! 
    if (notreal)
      {
        /* We don't want to make a menu, just traverse the keymaps to
***************
*** 528,534 ****
      }
  
    enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE];
!   item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; 
  
    if (!NILP (map) && SREF (item_string, 0) == '@')
      {
--- 528,534 ----
      }
  
    enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE];
!   item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
  
    if (!NILP (map) && SREF (item_string, 0) == '@')
      {
***************
*** 601,607 ****
        item_string = concat2 (prefix, item_string);
    }
  #endif /* not HAVE_BOXES */
!  
  #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
    if (!NILP(map))
      /* Indicate visually that this is a submenu.  */
--- 601,607 ----
        item_string = concat2 (prefix, item_string);
    }
  #endif /* not HAVE_BOXES */
! 
  #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
    if (!NILP(map))
      /* Indicate visually that this is a submenu.  */
***************
*** 696,702 ****
    int dummy;
  
    BLOCK_INPUT;
!           
    XQueryPointer (FRAME_X_DISPLAY (f),
                   DefaultRootWindow (FRAME_X_DISPLAY (f)),
  
--- 696,702 ----
    int dummy;
  
    BLOCK_INPUT;
! 
    XQueryPointer (FRAME_X_DISPLAY (f),
                   DefaultRootWindow (FRAME_X_DISPLAY (f)),
  
***************
*** 835,841 ****
                x = make_number (cur_x);
                y = make_number (cur_y);
              }
!           
  #else /* not HAVE_X_WINDOWS */
          Lisp_Object bar_window;
          enum scroll_bar_part part;
--- 835,841 ----
                x = make_number (cur_x);
                y = make_number (cur_y);
              }
! 
  #else /* not HAVE_X_WINDOWS */
          Lisp_Object bar_window;
          enum scroll_bar_part part;
***************
*** 957,963 ****
  
        keymaps = 0;
      }
!   
    unbind_to (specpdl_count, Qnil);
  
    if (NILP (position))
--- 957,963 ----
  
        keymaps = 0;
      }
! 
    unbind_to (specpdl_count, Qnil);
  
    if (NILP (position))
***************
*** 1146,1152 ****
            && dpyinfo->display == event.xbutton.display)
          {
            dpyinfo->grabbed &= ~(1 << event.xbutton.button);
! #ifdef USE_MOTIF /* Pretending that the event came from a 
                      Btn1Down seems the only way to convince Motif to
                      activate its callbacks; setting the XmNmenuPost
                      isn't working. address@hidden  */
--- 1146,1152 ----
            && dpyinfo->display == event.xbutton.display)
          {
            dpyinfo->grabbed &= ~(1 << event.xbutton.button);
! #ifdef USE_MOTIF /* Pretending that the event came from a
                      Btn1Down seems the only way to convince Motif to
                      activate its callbacks; setting the XmNmenuPost
                      isn't working. address@hidden  */
***************
*** 1167,1173 ****
            if (!IsModifierKey (keysym))
              popup_activated_flag = 0;
          }
!       
        x_dispatch_event (&event, event.xany.display);
      }
  }
--- 1167,1173 ----
            if (!IsModifierKey (keysym))
              popup_activated_flag = 0;
          }
! 
        x_dispatch_event (&event, event.xany.display);
      }
  }
***************
*** 1203,1209 ****
     The reason for saving the button event until here, instead of
     passing it to the toolkit right away, is that we can safely
     execute Lisp code.  */
!    
  void
  x_activate_menubar (f)
       FRAME_PTR f;
--- 1203,1209 ----
     The reason for saving the button event until here, instead of
     passing it to the toolkit right away, is that we can safely
     execute Lisp code.  */
! 
  void
  x_activate_menubar (f)
       FRAME_PTR f;
***************
*** 1211,1221 ****
    if (!f->output_data.x->saved_menu_event->type)
      return;
  
! #ifdef USE_GTK  
    if (! xg_win_to_widget (f->output_data.x->saved_menu_event->xany.window))
      return;
  #endif
!   
    set_frame_menubar (f, 0, 1);
    BLOCK_INPUT;
  #ifdef USE_GTK
--- 1211,1221 ----
    if (!f->output_data.x->saved_menu_event->type)
      return;
  
! #ifdef USE_GTK
    if (! xg_win_to_widget (f->output_data.x->saved_menu_event->xany.window))
      return;
  #endif
! 
    set_frame_menubar (f, 0, 1);
    BLOCK_INPUT;
  #ifdef USE_GTK
***************
*** 1230,1236 ****
    if (f->output_data.x->saved_menu_event->type == ButtonRelease)
      pending_menu_activation = 1;
  #endif
!   
    /* Ignore this if we get it a second time.  */
    f->output_data.x->saved_menu_event->type = 0;
  }
--- 1230,1236 ----
    if (f->output_data.x->saved_menu_event->type == ButtonRelease)
      pending_menu_activation = 1;
  #endif
! 
    /* Ignore this if we get it a second time.  */
    f->output_data.x->saved_menu_event->type = 0;
  }
***************
*** 1298,1304 ****
      }
    else
      {
!       /* WIDGET is the popup menu.  It's parent is the frame's 
         widget.  See which frame that is.  */
        xt_or_gtk_widget frame_widget = XtParent (widget);
        Lisp_Object tail;
--- 1298,1304 ----
      }
    else
      {
!       /* WIDGET is the popup menu.  It's parent is the frame's
         widget.  See which frame that is.  */
        xt_or_gtk_widget frame_widget = XtParent (widget);
        Lisp_Object tail;
***************
*** 1330,1336 ****
  {
    xg_menu_item_cb_data *cb_data;
    Lisp_Object help;
!   
    cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (widget),
                                                         XG_ITEM_DATA);
    if (! cb_data) return;
--- 1330,1336 ----
  {
    xg_menu_item_cb_data *cb_data;
    Lisp_Object help;
! 
    cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (widget),
                                                         XG_ITEM_DATA);
    if (! cb_data) return;
***************
*** 1356,1362 ****
    widget_value *wv = (widget_value *) call_data;
  
    help = wv ? wv->help : Qnil;
!   
    /* Determine the frame for the help event.  */
    f = menubar_id_to_frame (id);
  
--- 1356,1362 ----
    widget_value *wv = (widget_value *) call_data;
  
    help = wv ? wv->help : Qnil;
! 
    /* Determine the frame for the help event.  */
    f = menubar_id_to_frame (id);
  
***************
*** 1620,1626 ****
    first_wv = wv;
    save_wv = 0;
    prev_wv = 0;
!  
    /* Loop over all panes and items made by the preceding call
       to parse_single_submenu and construct a tree of widget_value objects.
       Ignore the panes and items used by previous calls to
--- 1620,1626 ----
    first_wv = wv;
    save_wv = 0;
    prev_wv = 0;
! 
    /* Loop over all panes and items made by the preceding call
       to parse_single_submenu and construct a tree of widget_value objects.
       Ignore the panes and items used by previous calls to
***************
*** 1653,1662 ****
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
          char *pane_string;
!         
          pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
          prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
!         
  #ifndef HAVE_MULTILINGUAL_MENU
          if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
            {
--- 1653,1662 ----
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
          char *pane_string;
! 
          pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
          prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
! 
  #ifndef HAVE_MULTILINGUAL_MENU
          if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
            {
***************
*** 1700,1706 ****
          /* Create a new item within current pane.  */
          Lisp_Object item_name, enable, descrip, def, type, selected;
          Lisp_Object help;
!         
          item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
          enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
          descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
--- 1700,1706 ----
          /* Create a new item within current pane.  */
          Lisp_Object item_name, enable, descrip, def, type, selected;
          Lisp_Object help;
! 
          item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
          enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
          descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
***************
*** 1715,1721 ****
              item_name = ENCODE_SYSTEM (item_name);
              AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
            }
!         
            if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
            {
              descrip = ENCODE_SYSTEM (descrip);
--- 1715,1721 ----
              item_name = ENCODE_SYSTEM (item_name);
              AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
            }
! 
            if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
            {
              descrip = ENCODE_SYSTEM (descrip);
***************
*** 1724,1730 ****
  #endif /* not HAVE_MULTILINGUAL_MENU */
  
          wv = xmalloc_widget_value ();
!         if (prev_wv) 
            prev_wv->next = wv;
          else
            save_wv->contents = wv;
--- 1724,1730 ----
  #endif /* not HAVE_MULTILINGUAL_MENU */
  
          wv = xmalloc_widget_value ();
!         if (prev_wv)
            prev_wv->next = wv;
          else
            save_wv->contents = wv;
***************
*** 1737,1743 ****
             as long as pointers have enough bits to hold small integers.  */
          wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0);
          wv->enabled = !NILP (enable);
!         
          if (NILP (type))
            wv->button_type = BUTTON_TYPE_NONE;
          else if (EQ (type, QCradio))
--- 1737,1743 ----
             as long as pointers have enough bits to hold small integers.  */
          wv->call_data = (!NILP (def) ? (void *) (EMACS_INT) i : 0);
          wv->enabled = !NILP (enable);
! 
          if (NILP (type))
            wv->button_type = BUTTON_TYPE_NONE;
          else if (EQ (type, QCradio))
***************
*** 1783,1789 ****
  #else
    struct x_output *x = f->output_data.x;
    int columns, rows;
!   
    if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
      return 0;
  
--- 1783,1789 ----
  #else
    struct x_output *x = f->output_data.x;
    int columns, rows;
! 
    if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
      return 0;
  
***************
*** 1847,1853 ****
      f->output_data.x->id = next_menubar_widget_id++;
    id = f->output_data.x->id;
  #endif
!   
    if (! menubar_widget)
      deep_p = 1;
    else if (pending_menu_activation && !deep_p)
--- 1847,1853 ----
      f->output_data.x->id = next_menubar_widget_id++;
    id = f->output_data.x->id;
  #endif
! 
    if (! menubar_widget)
      deep_p = 1;
    else if (pending_menu_activation && !deep_p)
***************
*** 1895,1901 ****
  
        /* Run the Lucid hook.  */
        safe_run_hooks (Qactivate_menubar_hook);
!       
        /* If it has changed current-menubar from previous value,
         really recompute the menubar from the value.  */
        if (! NILP (Vlucid_menu_bar_dirty_flag))
--- 1895,1901 ----
  
        /* Run the Lucid hook.  */
        safe_run_hooks (Qactivate_menubar_hook);
! 
        /* If it has changed current-menubar from previous value,
         really recompute the menubar from the value.  */
        if (! NILP (Vlucid_menu_bar_dirty_flag))
***************
*** 1960,1966 ****
          menu_items_n_panes = submenu_n_panes[i];
          wv = digest_single_submenu (submenu_start[i], submenu_end[i],
                                      submenu_top_level_items[i]);
!         if (prev_wv) 
            prev_wv->next = wv;
          else
            first_wv->contents = wv;
--- 1960,1966 ----
          menu_items_n_panes = submenu_n_panes[i];
          wv = digest_single_submenu (submenu_start[i], submenu_end[i],
                                      submenu_top_level_items[i]);
!         if (prev_wv)
            prev_wv->next = wv;
          else
            first_wv->contents = wv;
***************
*** 2039,2045 ****
             This value just has to be different from small integers.  */
          wv->call_data = (void *) (EMACS_INT) (-1);
  
!         if (prev_wv) 
            prev_wv->next = wv;
          else
            first_wv->contents = wv;
--- 2039,2045 ----
             This value just has to be different from small integers.  */
          wv->call_data = (void *) (EMACS_INT) (-1);
  
!         if (prev_wv)
            prev_wv->next = wv;
          else
            first_wv->contents = wv;
***************
*** 2073,2081 ****
    else
      {
        GtkWidget *wvbox = f->output_data.x->vbox_widget;
!       
        menubar_widget
!         = xg_create_widget ("menubar", "menubar", f, first_wv, 
                              G_CALLBACK (menubar_selection_callback),
                              G_CALLBACK (popup_deactivate_callback),
                              G_CALLBACK (menu_highlight_callback));
--- 2073,2081 ----
    else
      {
        GtkWidget *wvbox = f->output_data.x->vbox_widget;
! 
        menubar_widget
!         = xg_create_widget ("menubar", "menubar", f, first_wv,
                              G_CALLBACK (menubar_selection_callback),
                              G_CALLBACK (popup_deactivate_callback),
                              G_CALLBACK (menu_highlight_callback));
***************
*** 2083,2089 ****
        f->output_data.x->menubar_widget = menubar_widget;
      }
  
!   
  #else /* not USE_GTK */
    if (menubar_widget)
      {
--- 2083,2089 ----
        f->output_data.x->menubar_widget = menubar_widget;
      }
  
! 
  #else /* not USE_GTK */
    if (menubar_widget)
      {
***************
*** 2099,2105 ****
      }
    else
      {
!       menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, 
                                         f->output_data.x->column_widget,
                                         0,
                                         popup_activate_callback,
--- 2099,2105 ----
      }
    else
      {
!       menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv,
                                         f->output_data.x->column_widget,
                                         0,
                                         popup_activate_callback,
***************
*** 2110,2116 ****
      }
  
    {
!     int menubar_size 
        = (f->output_data.x->menubar_widget
         ? (f->output_data.x->menubar_widget->core.height
            + f->output_data.x->menubar_widget->core.border_width)
--- 2110,2116 ----
      }
  
    {
!     int menubar_size
        = (f->output_data.x->menubar_widget
         ? (f->output_data.x->menubar_widget->core.height
            + f->output_data.x->menubar_widget->core.border_width)
***************
*** 2132,2138 ****
      f->output_data.x->menubar_height = menubar_size;
    }
  #endif /* not USE_GTK */
!   
    free_menubar_widget_value_tree (first_wv);
    update_frame_menubar (f);
  
--- 2132,2138 ----
      f->output_data.x->menubar_height = menubar_size;
    }
  #endif /* not USE_GTK */
! 
    free_menubar_widget_value_tree (first_wv);
    update_frame_menubar (f);
  
***************
*** 2173,2179 ****
    menubar_widget = f->output_data.x->menubar_widget;
  
    f->output_data.x->menubar_height = 0;
!   
    if (menubar_widget)
      {
  #ifdef USE_MOTIF
--- 2173,2179 ----
    menubar_widget = f->output_data.x->menubar_widget;
  
    f->output_data.x->menubar_height = 0;
! 
    if (menubar_widget)
      {
  #ifdef USE_MOTIF
***************
*** 2187,2200 ****
         is switched off, which fixes the shell position.  */
        Position x0, y0, x1, y1;
  #endif
!       
        BLOCK_INPUT;
  
  #ifdef USE_MOTIF
        if (f->output_data.x->widget)
        XtVaGetValues (f->output_data.x->widget, XtNx, &x0, XtNy, &y0, NULL);
  #endif
!       
        lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id);
        f->output_data.x->menubar_widget = NULL;
  
--- 2187,2200 ----
         is switched off, which fixes the shell position.  */
        Position x0, y0, x1, y1;
  #endif
! 
        BLOCK_INPUT;
  
  #ifdef USE_MOTIF
        if (f->output_data.x->widget)
        XtVaGetValues (f->output_data.x->widget, XtNx, &x0, XtNy, &y0, NULL);
  #endif
! 
        lw_destroy_all_widgets ((LWLIB_ID) f->output_data.x->id);
        f->output_data.x->menubar_widget = NULL;
  
***************
*** 2206,2212 ****
            XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
        }
  #endif
!       
        UNBLOCK_INPUT;
      }
  }
--- 2206,2212 ----
            XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
        }
  #endif
! 
        UNBLOCK_INPUT;
      }
  }
***************
*** 2300,2306 ****
                             G_CALLBACK (popup_deactivate_callback),
                             G_CALLBACK (menu_highlight_callback));
    xg_crazy_callback_abort = 0;
!   
    for (i = 0; i < 5; i++)
      if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
        break;
--- 2300,2306 ----
                             G_CALLBACK (popup_deactivate_callback),
                             G_CALLBACK (menu_highlight_callback));
    xg_crazy_callback_abort = 0;
! 
    for (i = 0; i < 5; i++)
      if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
        break;
***************
*** 2321,2327 ****
    /* Display the menu.  */
    gtk_widget_show_all (menu);
    gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0);
!   
    xg_did_tearoff = 0;
    /* Set this to one.  popup_widget_loop increases it by one, so it becomes
       two.  show_help_echo uses this to detect popup menus.  */
--- 2321,2327 ----
    /* Display the menu.  */
    gtk_widget_show_all (menu);
    gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0);
! 
    xg_did_tearoff = 0;
    /* Set this to one.  popup_widget_loop increases it by one, so it becomes
       two.  show_help_echo uses this to detect popup menus.  */
***************
*** 2333,2339 ****
      xg_keep_popup (menu, xg_did_tearoff);
    else
      gtk_widget_destroy (menu);
!     
    /* Must reset this manually because the button release event is not passed
       to Emacs event loop. */
    FRAME_X_DISPLAY_INFO (f)->grabbed = 0;
--- 2333,2339 ----
      xg_keep_popup (menu, xg_did_tearoff);
    else
      gtk_widget_destroy (menu);
! 
    /* Must reset this manually because the button release event is not passed
       to Emacs event loop. */
    FRAME_X_DISPLAY_INFO (f)->grabbed = 0;
***************
*** 2425,2431 ****
       that it is unnecessary--that the menu has already disappeared.
       Nowadays the menu disappears ok, all right, but
       we need to delete the widgets or multiple ones will pile up.  */
!   lw_destroy_all_widgets (menu_id); 
  }
  
  #endif /* not USE_GTK */
--- 2425,2431 ----
       that it is unnecessary--that the menu has already disappeared.
       Nowadays the menu disappears ok, all right, but
       we need to delete the widgets or multiple ones will pile up.  */
!   lw_destroy_all_widgets (menu_id);
  }
  
  #endif /* not USE_GTK */
***************
*** 2468,2474 ****
    wv->help =Qnil;
    first_wv = wv;
    first_pane = 1;
!  
    /* Loop over all panes and items, filling in the tree.  */
    i = 0;
    while (i < menu_items_used)
--- 2468,2474 ----
    wv->help =Qnil;
    first_wv = wv;
    first_pane = 1;
! 
    /* Loop over all panes and items, filling in the tree.  */
    i = 0;
    while (i < menu_items_used)
***************
*** 2500,2509 ****
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
          char *pane_string;
!         
          pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
          prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
!         
  #ifndef HAVE_MULTILINGUAL_MENU
          if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
            {
--- 2500,2509 ----
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
          char *pane_string;
! 
          pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
          prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
! 
  #ifndef HAVE_MULTILINGUAL_MENU
          if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
            {
***************
*** 2564,2581 ****
              item_name = ENCODE_SYSTEM (item_name);
              AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
            }
!         
            if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
            {
              descrip = ENCODE_SYSTEM (descrip);
              AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
            }
  #endif /* not HAVE_MULTILINGUAL_MENU */
!  
          wv = xmalloc_widget_value ();
!         if (prev_wv) 
            prev_wv->next = wv;
!         else 
            save_wv->contents = wv;
          wv->name = (char *) SDATA (item_name);
          if (!NILP (descrip))
--- 2564,2581 ----
              item_name = ENCODE_SYSTEM (item_name);
              AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
            }
! 
            if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
            {
              descrip = ENCODE_SYSTEM (descrip);
              AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
            }
  #endif /* not HAVE_MULTILINGUAL_MENU */
! 
          wv = xmalloc_widget_value ();
!         if (prev_wv)
            prev_wv->next = wv;
!         else
            save_wv->contents = wv;
          wv->name = (char *) SDATA (item_name);
          if (!NILP (descrip))
***************
*** 2629,2635 ****
        if (STRING_MULTIBYTE (title))
        title = ENCODE_SYSTEM (title);
  #endif
!       
        wv_title->name = (char *) SDATA (title);
        wv_title->enabled = TRUE;
        wv_title->button_type = BUTTON_TYPE_NONE;
--- 2629,2635 ----
        if (STRING_MULTIBYTE (title))
        title = ENCODE_SYSTEM (title);
  #endif
! 
        wv_title->name = (char *) SDATA (title);
        wv_title->enabled = TRUE;
        wv_title->button_type = BUTTON_TYPE_NONE;
***************
*** 2741,2747 ****
  
        /* Process events that apply to the menu.  */
        popup_widget_loop ();
!   
        gtk_widget_destroy (menu);
      }
  }
--- 2741,2747 ----
  
        /* Process events that apply to the menu.  */
        popup_widget_loop ();
! 
        gtk_widget_destroy (menu);
      }
  }
***************
*** 2807,2813 ****
    {
      int count = SPECPDL_INDEX ();
      int fact = 4 * sizeof (LWLIB_ID);
!     
      /* xdialog_show_unwind is responsible for popping the dialog box down.  */
      record_unwind_protect (xdialog_show_unwind,
                             Fcons (make_number (dialog_id >> (fact)),
--- 2807,2813 ----
    {
      int count = SPECPDL_INDEX ();
      int fact = 4 * sizeof (LWLIB_ID);
! 
      /* xdialog_show_unwind is responsible for popping the dialog box down.  */
      record_unwind_protect (xdialog_show_unwind,
                             Fcons (make_number (dialog_id >> (fact)),
***************
*** 2858,2864 ****
      pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
      prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
      pane_string = (NILP (pane_name)
!                  ? "" : (char *) SDATA (pane_name));  
      prev_wv = xmalloc_widget_value ();
      prev_wv->value = pane_string;
      if (keymaps && !NILP (prefix))
--- 2858,2864 ----
      pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
      prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
      pane_string = (NILP (pane_name)
!                  ? "" : (char *) SDATA (pane_name));
      prev_wv = xmalloc_widget_value ();
      prev_wv->value = pane_string;
      if (keymaps && !NILP (prefix))
***************
*** 2867,2885 ****
      prev_wv->name = "message";
      prev_wv->help = Qnil;
      first_wv = prev_wv;
!  
      /* Loop over all panes and items, filling in the tree.  */
      i = MENU_ITEMS_PANE_LENGTH;
      while (i < menu_items_used)
        {
!       
        /* Create a new item within current pane.  */
        Lisp_Object item_name, enable, descrip;
        item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
        enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
        descrip
          = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
!       
        if (NILP (item_name))
          {
            free_menubar_widget_value_tree (first_wv);
--- 2867,2885 ----
      prev_wv->name = "message";
      prev_wv->help = Qnil;
      first_wv = prev_wv;
! 
      /* Loop over all panes and items, filling in the tree.  */
      i = MENU_ITEMS_PANE_LENGTH;
      while (i < menu_items_used)
        {
! 
        /* Create a new item within current pane.  */
        Lisp_Object item_name, enable, descrip;
        item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
        enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
        descrip
          = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
! 
        if (NILP (item_name))
          {
            free_menubar_widget_value_tree (first_wv);
***************
*** 2950,2956 ****
  
    /* Free the widget_value objects we used to specify the contents.  */
    free_menubar_widget_value_tree (first_wv);
!   
    /* Find the selected item, and its pane, to return
       the proper value.  */
    if (menu_item_selection != 0)
--- 2950,2956 ----
  
    /* Free the widget_value objects we used to specify the contents.  */
    free_menubar_widget_value_tree (first_wv);
! 
    /* Find the selected item, and its pane, to return
       the proper value.  */
    if (menu_item_selection != 0)
***************
*** 3009,3015 ****
  
     PANE is the pane number, and ITEM is the menu item number in
     the menu (currently not used).
!    
     This cannot be done with generating a HELP_EVENT because
     XMenuActivate contains a loop that doesn't let Emacs process
     keyboard events.  */
--- 3009,3015 ----
  
     PANE is the pane number, and ITEM is the menu item number in
     the menu (currently not used).
! 
     This cannot be done with generating a HELP_EVENT because
     XMenuActivate contains a loop that doesn't let Emacs process
     keyboard events.  */
***************
*** 3023,3029 ****
    Lisp_Object *first_item;
    Lisp_Object pane_name;
    Lisp_Object menu_object;
!  
    first_item = XVECTOR (menu_items)->contents;
    if (EQ (first_item[0], Qt))
      pane_name = first_item[MENU_ITEMS_PANE_NAME];
--- 3023,3029 ----
    Lisp_Object *first_item;
    Lisp_Object pane_name;
    Lisp_Object menu_object;
! 
    first_item = XVECTOR (menu_items)->contents;
    if (EQ (first_item[0], Qt))
      pane_name = first_item[MENU_ITEMS_PANE_NAME];
***************
*** 3032,3038 ****
      pane_name = empty_string;
    else
      pane_name = first_item[MENU_ITEMS_ITEM_NAME];
!  
    /* (menu-item MENU-NAME PANE-NUMBER)  */
    menu_object = Fcons (Qmenu_item,
                       Fcons (pane_name,
--- 3032,3038 ----
      pane_name = empty_string;
    else
      pane_name = first_item[MENU_ITEMS_ITEM_NAME];
! 
    /* (menu-item MENU-NAME PANE-NUMBER)  */
    menu_object = Fcons (Qmenu_item,
                       Fcons (pane_name,
***************
*** 3040,3046 ****
    show_help_echo (help_string ? build_string (help_string) : Qnil,
                  Qnil, menu_object, make_number (item), 1);
  }
!   
  
  static Lisp_Object
  xmenu_show (f, x, y, for_click, keymaps, title, error)
--- 3040,3046 ----
    show_help_echo (help_string ? build_string (help_string) : Qnil,
                  Qnil, menu_object, make_number (item), 1);
  }
! 
  
  static Lisp_Object
  xmenu_show (f, x, y, for_click, keymaps, title, error)
***************
*** 3051,3057 ****
       Lisp_Object title;
       char **error;
  {
!   Window root;                
    XMenu *menu;
    int pane, selidx, lpane, status;
    Lisp_Object entry, pane_prefix;
--- 3051,3057 ----
       Lisp_Object title;
       char **error;
  {
!   Window root;
    XMenu *menu;
    int pane, selidx, lpane, status;
    Lisp_Object entry, pane_prefix;
***************
*** 3118,3124 ****
    /* Adjust coordinates to be root-window-relative.  */
    x += f->output_data.x->left_pos;
    y += f->output_data.x->top_pos;
!  
    /* Create all the necessary panes and their items.  */
    i = 0;
    while (i < menu_items_used)
--- 3118,3124 ----
    /* Adjust coordinates to be root-window-relative.  */
    x += f->output_data.x->left_pos;
    y += f->output_data.x->top_pos;
! 
    /* Create all the necessary panes and their items.  */
    i = 0;
    while (i < menu_items_used)
***************
*** 3183,3189 ****
            = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
          help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
          help_string = STRINGP (help) ? SDATA (help) : NULL;
!         
          if (!NILP (descrip))
            {
              int gap = maxwidth - SBYTES (item_name);
--- 3183,3189 ----
            = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
          help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
          help_string = STRINGP (help) ? SDATA (help) : NULL;
! 
          if (!NILP (descrip))
            {
              int gap = maxwidth - SBYTES (item_name);
***************
*** 3347,3353 ****
    Vmenu_updating_frame = Qnil;
  
  #ifdef USE_X_TOOLKIT
!   widget_id_tick = (1<<16);   
    next_menubar_widget_id = 1;
  #endif
  
--- 3347,3353 ----
    Vmenu_updating_frame = Qnil;
  
  #ifdef USE_X_TOOLKIT
!   widget_id_tick = (1<<16);
    next_menubar_widget_id = 1;
  #endif
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]