*** ChangeLog.orig Mon May 12 17:12:58 1997 --- ChangeLog Fri May 23 13:31:00 1997 *************** *** 1,3 **** --- 1,28 ---- + Fri May 23 13:25:40 1997 Nico Francois + + * w32menu.c (single_keymap_panes): Fixed problem with 'descrip' lisp + object not being protected properly (GCPRO). + (get_single_keymap_event): Fixed problem with 'descrip' lisp object + not being protected properly (GCPRO). + + Fri May 16 19:08:34 1997 Nico Francois + + * w32menu.c (name_is_separator): New function. Will check if + a menu item name is a separator. An empty name or a name consting + only of dashes ('-') is considered a separator. Previously only + names with exactly two dashes ("--") where considered separators, + but some packages use more than two dashes when they want to add a + separator to a menu (vc-hooks.el for example). + + Mon May 12 16:57:32 1997 Nico Francois + + * w32menu.c (list_of_panes): If a pane's name is empty ("") items + are now placed in the main popup instead of a blank-named submenu. + This seems to be an undocumented feature of x-popup-menu. + (list_of_items): New argument HMENU. If NULL the function will + work as before. If non-NULL the function will add items to the + specified menu. + Wed May 07 23:52:59 1997 Michael Welsh Duggan * w32menu.c (get_frame_menubar_event): Check for the possibility *** w32menu.c.orig Mon May 12 16:12:14 1997 --- w32menu.c Fri May 23 13:26:42 1997 *************** *** 125,130 **** --- 125,149 ---- lpmm->menu_items_allocated = lpmm->menu_items_used = 0; } + /* Is this item a separator? */ + static int + name_is_separator (name) + Lisp_Object name; + { + int isseparator = (((char *)XSTRING (name)->data)[0] == 0); + + if (!isseparator) + { + /* Check if name string consists of only dashes ('-') */ + char *string = (char *)XSTRING (name)->data; + while (*string == '-') string++; + isseparator = (*string == 0); + } + + return isseparator; + } + + /* Indicate boundary between left and right. */ static void *************** *** 152,160 **** UINT fuFlags; Lisp_Object out_string; ! if (NILP (name) ! || ((char *) XSTRING (name)->data)[0] == 0 ! || strcmp ((char *) XSTRING (name)->data, "--") == 0) fuFlags = MF_SEPARATOR; else { --- 171,177 ---- UINT fuFlags; Lisp_Object out_string; ! if (NILP (name) || name_is_separator (name)) fuFlags = MF_SEPARATOR; else { *************** *** 396,402 **** Lisp_Object pending_maps; Lisp_Object tail, item, item1, item_string, table; HMENU hmenu; ! struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; if (!notreal) { --- 413,419 ---- Lisp_Object pending_maps; Lisp_Object tail, item, item1, item_string, table; HMENU hmenu; ! struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; if (!notreal) { *************** *** 447,453 **** GCPRO4 (keymap, pending_maps, def, prefix); def = menu_item_equiv_key (item_string, item1, &descrip); ! enabled = menu_item_enabled_p (def, notreal); UNGCPRO; --- 464,475 ---- GCPRO4 (keymap, pending_maps, def, prefix); def = menu_item_equiv_key (item_string, item1, &descrip); ! { ! struct gcpro gcpro1; ! GCPRO1 (descrip); ! enabled = menu_item_enabled_p (def, notreal); ! UNGCPRO; ! } UNGCPRO; *************** *** 465,471 **** { Lisp_Object submap; ! GCPRO4 (keymap, pending_maps, item, item_string); submap = get_keymap_1 (def, 0, 1); --- 487,493 ---- { Lisp_Object submap; ! GCPRO5 (keymap, pending_maps, item, item_string, descrip); submap = get_keymap_1 (def, 0, 1); *************** *** 531,541 **** aside from that, must protect whatever might be a string. Since there's no GCPRO5, we refetch item_string instead of protecting it. */ ! GCPRO4 (keymap, pending_maps, def, descrip); descrip = def = Qnil; def = menu_item_equiv_key (item_string, item1, &descrip); ! enabled = menu_item_enabled_p (def, notreal); UNGCPRO; --- 553,568 ---- aside from that, must protect whatever might be a string. Since there's no GCPRO5, we refetch item_string instead of protecting it. */ ! GCPRO3 (keymap, pending_maps, def); descrip = def = Qnil; def = menu_item_equiv_key (item_string, item1, &descrip); ! { ! struct gcpro gcpro1; ! GCPRO1 (descrip); ! enabled = menu_item_enabled_p (def, notreal); ! UNGCPRO; ! } UNGCPRO; *************** *** 549,555 **** { Lisp_Object submap; ! GCPRO4 (keymap, pending_maps, descrip, item_string); submap = get_keymap_1 (def, 0, 1); --- 576,582 ---- { Lisp_Object submap; ! GCPRO5 (keymap, pending_maps, descrip, item_string, descrip); submap = get_keymap_1 (def, 0, 1); *************** *** 649,659 **** pane_data = Fcdr (elt); CHECK_CONS (pane_data, 0); ! new_hmenu = list_of_items (lpmm, pane_data); ! if (new_hmenu == NULL) goto error; ! AppendMenu (hmenu, MF_POPUP, (UINT)new_hmenu, ! (char *) XSTRING (pane_name)->data); } } else --- 676,693 ---- pane_data = Fcdr (elt); CHECK_CONS (pane_data, 0); ! if (XSTRING (pane_name)->data[0] == 0) ! { ! list_of_items (hmenu, lpmm, pane_data); ! } ! else ! { ! new_hmenu = list_of_items (NULL, lpmm, pane_data); ! if (new_hmenu == NULL) goto error; ! AppendMenu (hmenu, MF_POPUP, (UINT)new_hmenu, ! (char *) XSTRING (pane_name)->data); ! } } } else *************** *** 665,671 **** CHECK_STRING (pane_name, 0); pane_data = Fcdr (elt); CHECK_CONS (pane_data, 0); ! hmenu = list_of_items (lpmm, pane_data); } return (hmenu); --- 699,705 ---- CHECK_STRING (pane_name, 0); pane_data = Fcdr (elt); CHECK_CONS (pane_data, 0); ! hmenu = list_of_items (NULL, lpmm, pane_data); } return (hmenu); *************** *** 678,692 **** /* Push the items in a single pane defined by the alist PANE. */ static HMENU ! list_of_items (lpmm, pane) menu_map * lpmm; Lisp_Object pane; { Lisp_Object tail, item, item1; - HMENU hmenu; ! hmenu = CreatePopupMenu (); ! if (hmenu == NULL) return NULL; for (tail = pane; !NILP (tail); tail = Fcdr (tail)) { --- 712,729 ---- /* Push the items in a single pane defined by the alist PANE. */ static HMENU ! list_of_items (hmenu, lpmm, pane) ! HMENU hmenu; menu_map * lpmm; Lisp_Object pane; { Lisp_Object tail, item, item1; ! if (hmenu == NULL) ! { ! hmenu = CreatePopupMenu (); ! if (hmenu == NULL) return NULL; ! } for (tail = pane; !NILP (tail); tail = Fcdr (tail)) { *************** *** 805,811 **** { Lisp_Object pending_maps; Lisp_Object tail, item, item1, item_string, table; ! struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; pending_maps = Qnil; --- 842,848 ---- { Lisp_Object pending_maps; Lisp_Object tail, item, item1, item_string, table; ! struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; pending_maps = Qnil; *************** *** 863,869 **** { Lisp_Object submap; ! GCPRO4 (keymap, pending_maps, item, item_string); submap = get_keymap_1 (def, 0, 1); --- 900,906 ---- { Lisp_Object submap; ! GCPRO5 (keymap, pending_maps, item, item_string, descrip); submap = get_keymap_1 (def, 0, 1); *************** *** 922,928 **** aside from that, must protect whatever might be a string. Since there's no GCPRO5, we refetch item_string instead of protecting it. */ ! GCPRO4 (keymap, pending_maps, def, descrip); descrip = def = Qnil; def = menu_item_equiv_key (item_string, item1, &descrip); --- 959,965 ---- aside from that, must protect whatever might be a string. Since there's no GCPRO5, we refetch item_string instead of protecting it. */ ! GCPRO3 (keymap, pending_maps, def); descrip = def = Qnil; def = menu_item_equiv_key (item_string, item1, &descrip); *************** *** 939,945 **** { Lisp_Object submap; ! GCPRO4 (keymap, pending_maps, descrip, item_string); submap = get_keymap_1 (def, 0, 1); --- 976,982 ---- { Lisp_Object submap; ! GCPRO5 (keymap, pending_maps, descrip, item_string, descrip); submap = get_keymap_1 (def, 0, 1); *************** *** 1705,1712 **** enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; // descrip = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; ! if (((char *) XSTRING (item_name)->data)[0] == 0 ! || strcmp ((char *) XSTRING (item_name)->data, "--") == 0) fuFlags = MF_SEPARATOR; else if (NILP (enable) || !XUINT (enable)) fuFlags = MF_STRING | MF_GRAYED; --- 1742,1748 ---- enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; // descrip = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; ! if (name_is_separator (item_name)) fuFlags = MF_SEPARATOR; else if (NILP (enable) || !XUINT (enable)) fuFlags = MF_STRING | MF_GRAYED;