1 /* Implements an elisp-programmable menubar -- Win32
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
4 Copyright (C) 1997 Kirill M. Katsnelson <kkm@kis.ru>
6 This file is part of XEmacs.
8 XEmacs is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with XEmacs; see the file COPYING. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* Synched up with: Not in FSF. */
26 Initially written by kkm 12/24/97,
27 peeking into and copying stuff from menubar-x.c
30 /* Algorithm for handling menus is as follows. When window's menubar
31 * is created, current-menubar is not traversed in depth. Rather, only
32 * top level items, both items and pulldowns, are added to the
33 * menubar. Each pulldown is initially empty. When a pulldown is
34 * selected and about to open, corresponding element of
35 * current-menubar is found, and the newly open pulldown is
36 * populated. This is made again in the same non-recursive manner.
38 * This algorithm uses hash tables to find out element of the menu
39 * descriptor list given menu handle. The key is an opaque ptr data
40 * type, keeping menu handle, and the value is a list of strings
41 * representing the path from the root of the menu to the item
42 * descriptor. Each frame has an associated hash table.
44 * Leaf items are assigned a unique id based on item's hash. When an
45 * item is selected, Windows sends back the id. Unfortunately, only
46 * low 16 bit of the ID are sent, and there's no way to get the 32-bit
47 * value. Yes, Win32 is just a different set of bugs than X! Aside
48 * from this blame, another hashing mechanism is required to map menu
49 * ids to commands (which are actually Lisp_Object's). This mapping is
50 * performed in the same hash table, as the lifetime of both maps is
51 * exactly the same. This is unambigous, as menu handles are
52 * represented by lisp opaques, while command ids are by lisp
53 * integers. The additional advantage for this is that command forms
54 * are automatically GC-protected, which is important because these
55 * may be transient forms generated by :filter functions.
57 * The hash table is not allowed to grow too much; it is pruned
58 * whenever this is safe to do. This is done by re-creating the menu
59 * bar, and clearing and refilling the hash table from scratch.
61 * Popup menus are handled identically to pulldowns. A static hash
62 * table is used for popup menus, and lookup is made not in
63 * current-menubar but in a lisp form supplied to the `popup'
66 * Another Windows weirdness is that there's no way to tell that a
67 * popup has been dismissed without making selection. We need to know
68 * that to cleanup the popup menu hash table, but this is not honestly
69 * doable using *documented* sequence of messages. Sticking to
70 * particular knowledge is bad because this may break in Windows NT
71 * 5.0, or Windows 98, or other future version. Instead, I allow the
72 * hash tables to hang around, and not clear them, unless WM_COMMAND is
73 * received. This is worthy some memory but more safe. Hacks welcome,
84 #include "console-msw.h"
91 #include "menubar-msw.h"
96 #define REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH 0
98 #define EMPTY_ITEM_ID ((UINT)LISP_TO_VOID (Qunbound))
99 #define EMPTY_ITEM_NAME "(empty)"
101 /* Current menu (bar or popup) descriptor. gcpro'ed */
102 static Lisp_Object current_menudesc;
104 /* Current menubar or popup hash table. gcpro'ed */
105 static Lisp_Object current_hash_table;
107 /* This is used to allocate unique ids to menu items.
108 Items ids are in MENU_ITEM_ID_MIN to MENU_ITEM_ID_MAX.
109 Allocation checks that the item is not already in
110 the TOP_LEVEL_MENU */
112 /* #### defines go to gui-msw.h, as the range is shared with toolbars
113 (If only toolbars will be implemented as common controls) */
114 #define MENU_ITEM_ID_MIN 0x8000
115 #define MENU_ITEM_ID_MAX 0xFFFF
116 #define MENU_ITEM_ID_BITS(x) (((x) & 0x7FFF) | 0x8000)
117 static HMENU top_level_menu;
119 #define MAX_MENUITEM_LENGTH 128
122 * This returns Windows-style menu item string:
123 * "Left Flush\tRight Flush"
126 displayable_menu_item (struct gui_item* pgui_item, int bar_p)
128 /* We construct the name in a static buffer. That's fine, because
129 menu items longer than 128 chars are probably programming errors,
130 and better be caught than displayed! */
132 static char buf[MAX_MENUITEM_LENGTH+2];
136 /* Left flush part of the string */
137 ll = gui_item_display_flush_left (pgui_item, buf, MAX_MENUITEM_LENGTH);
139 /* Escape '&' as '&&' */
141 while ((ptr=memchr (ptr, '&', ll-(ptr-buf))) != NULL)
143 if (ll+2 >= MAX_MENUITEM_LENGTH)
144 signal_simple_error ("Menu item produces too long displayable string",
146 memmove (ptr+1, ptr, (ll-(ptr-buf))+1);
151 /* Replace XEmacs accelerator '%_' with Windows accelerator '&' */
153 while ((ptr=memchr (ptr, '%', ll-(ptr-buf))) != NULL)
158 memmove (ptr+1, ptr+2, ll-(ptr-buf+2));
164 /* Right flush part, unless we're at the top-level where it's not allowed */
167 assert (MAX_MENUITEM_LENGTH > ll + 1);
168 lr = gui_item_display_flush_right (pgui_item, buf + ll + 1,
169 MAX_MENUITEM_LENGTH - ll - 1);
178 * hmenu_to_lisp_object() returns an opaque ptr given menu handle.
181 hmenu_to_lisp_object (HMENU hmenu)
183 return make_opaque_ptr (hmenu);
187 * Allocation tries a hash based on item's path and name first. This
188 * almost guarantees that the same item will override its old value in
189 * the hash table rather than abandon it.
192 allocate_menu_item_id (Lisp_Object path, Lisp_Object name, Lisp_Object suffix)
194 UINT id = MENU_ITEM_ID_BITS (HASH3 (internal_hash (path, 0),
195 internal_hash (name, 0),
196 internal_hash (suffix, 0)));
198 id = MENU_ITEM_ID_BITS (id + 1);
199 } while (GetMenuState (top_level_menu, id, MF_BYCOMMAND) != 0xFFFFFFFF);
200 return make_int (id);
204 create_empty_popup_menu (void)
206 return CreatePopupMenu ();
210 empty_menu (HMENU menu, int add_empty_p)
212 while (DeleteMenu (menu, 0, MF_BYPOSITION));
214 AppendMenu (menu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME);
218 * The idea of checksumming is that we must hash minimal object
219 * which is necessarily changes when the item changes. For separator
220 * this is a constant, for grey strings and submenus these are hashes
221 * of names, since submenus are unpopulated until opened so always
222 * equal otherwise. For items, this is a full hash value of a callback,
223 * because a callback may me a form which can be changed only somewhere
227 checksum_menu_item (Lisp_Object item)
231 /* Separator or unselectable text - hash as a string + 13 */
232 if (separator_string_p (XSTRING_DATA (item)))
235 return internal_hash (item, 0) + 13;
237 else if (CONSP (item))
239 /* Submenu - hash by its string name + 0 */
240 return internal_hash (XCAR(item), 0);
242 else if (VECTORP (item))
244 /* An ordinary item - hash its name and callback form. */
245 return HASH2 (internal_hash (XVECTOR_DATA(item)[0], 0),
246 internal_hash (XVECTOR_DATA(item)[1], 0));
249 /* An error - will be caught later */
254 populate_menu_add_item (HMENU menu, Lisp_Object path,
255 Lisp_Object hash_tab, Lisp_Object item,
256 int flush_right, int bar_p)
258 MENUITEMINFO item_info;
260 item_info.cbSize = sizeof (item_info);
261 item_info.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID;
262 item_info.fState = 0;
268 /* Separator or unselectable text */
269 if (separator_string_p (XSTRING_DATA (item)))
270 item_info.fType = MFT_SEPARATOR;
273 item_info.fType = MFT_STRING;
274 item_info.fState = MFS_DISABLED;
275 item_info.dwTypeData = XSTRING_DATA (item);
278 else if (CONSP (item))
282 struct gui_item gui_item;
285 gui_item_init (&gui_item);
286 GCPRO_GUI_ITEM (&gui_item);
288 menu_parse_submenu_keywords (item, &gui_item);
290 if (!STRINGP (gui_item.name))
291 signal_simple_error ("Menu name (first element) must be a string", item);
293 if (!gui_item_included_p (&gui_item, Vmenubar_configuration))
296 if (!gui_item_active_p (&gui_item))
297 item_info.fState = MFS_GRAYED;
298 /* Temptation is to put 'else' right here. Although, the
299 displayed item won't have an arrow indicating that it is a
300 popup. So we go ahead a little bit more and create a popup */
301 submenu = create_empty_popup_menu();
303 item_info.fMask |= MIIM_SUBMENU;
304 item_info.dwTypeData = displayable_menu_item (&gui_item, bar_p);
305 item_info.hSubMenu = submenu;
307 if (!(item_info.fState & MFS_GRAYED))
309 /* Now add the full submenu path as a value to the hash table,
310 keyed by menu handle */
312 /* list1 cannot GC */
313 path = list1 (gui_item.name);
318 arg[1] = list1 (gui_item.name);
319 /* Fappend gcpro'es its arg */
320 path = Fappend (2, arg);
323 /* Fputhash GCPRO'es PATH */
324 Fputhash (hmenu_to_lisp_object (submenu), path, hash_tab);
326 UNGCPRO; /* gui_item */
328 else if (VECTORP (item))
330 /* An ordinary item */
331 Lisp_Object style, id;
332 struct gui_item gui_item;
335 gui_item_init (&gui_item);
336 GCPRO_GUI_ITEM (&gui_item);
338 gui_parse_item_keywords (item, &gui_item);
340 if (!gui_item_included_p (&gui_item, Vmenubar_configuration))
343 if (!gui_item_active_p (&gui_item))
344 item_info.fState = MFS_GRAYED;
346 style = (NILP (gui_item.selected) || NILP (Feval (gui_item.selected))
347 ? Qnil : gui_item.style);
349 if (EQ (style, Qradio))
351 item_info.fType |= MFT_RADIOCHECK;
352 item_info.fState |= MFS_CHECKED;
354 else if (EQ (style, Qtoggle))
356 item_info.fState |= MFS_CHECKED;
359 id = allocate_menu_item_id (path, gui_item.name,
361 Fputhash (id, gui_item.callback, hash_tab);
363 item_info.wID = (UINT) XINT(id);
364 item_info.fType |= MFT_STRING;
365 item_info.dwTypeData = displayable_menu_item (&gui_item, bar_p);
367 UNGCPRO; /* gui_item */
371 signal_simple_error ("Malformed menu item descriptor", item);
375 item_info.fType |= MFT_RIGHTJUSTIFY;
377 InsertMenuItem (menu, UINT_MAX, TRUE, &item_info);
381 * This function is called from populate_menu and checksum_menu.
382 * When called to populate, MENU is a menu handle, PATH is a
383 * list of strings representing menu path from root to this submenu,
384 * DESCRIPTOR is a menu descriptor, HASH_TAB is a hash table associated
385 * with root menu, BAR_P indicates whether this called for a menubar or
386 * a popup, and POPULATE_P is non-zero. Return value must be ignored.
387 * When called to checksum, DESCRIPTOR has the same meaning, POPULATE_P
388 * is zero, PATH must be Qnil, and the rest of parameters is ignored.
389 * Return value is the menu checksum.
392 populate_or_checksum_helper (HMENU menu, Lisp_Object path, Lisp_Object desc,
393 Lisp_Object hash_tab, int bar_p, int populate_p)
395 Lisp_Object item_desc;
396 int deep_p, flush_right;
398 unsigned long checksum;
399 struct gui_item gui_item;
401 gui_item_init (&gui_item);
402 GCPRO_GUI_ITEM (&gui_item);
404 /* We are sometimes called with the menubar unchanged, and with changed
405 right flush. We have to update the menubar in this case,
406 so account for the compliance setting in the hash value */
407 checksum = REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH;
409 /* Will initially contain only "(empty)" */
411 empty_menu (menu, 1);
413 /* PATH set to nil indicates top-level popup or menubar */
414 deep_p = !NILP (path);
416 /* Fetch keywords prepending the item list */
417 desc = menu_parse_submenu_keywords (desc, &gui_item);
419 /* Check that menu name is specified when expected */
420 if (NILP (gui_item.name) && deep_p)
421 signal_simple_error ("Menu must have a name", desc);
423 /* Apply filter if specified */
424 if (!NILP (gui_item.filter))
425 desc = call1 (gui_item.filter, desc);
427 /* Loop thru the desc's CDR and add items for each entry */
429 EXTERNAL_LIST_LOOP (item_desc, desc)
431 if (NILP (XCAR (item_desc)))
433 /* Do not flush right menubar items when MS style compliant */
434 if (bar_p && !REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH)
437 checksum = HASH2 (checksum, LISP_HASH (Qnil));
440 populate_menu_add_item (menu, path, hash_tab,
441 XCAR (item_desc), flush_right, bar_p);
443 checksum = HASH2 (checksum,
444 checksum_menu_item (XCAR (item_desc)));
449 /* Remove the "(empty)" item, if there are other ones */
450 if (GetMenuItemCount (menu) > 1)
451 RemoveMenu (menu, EMPTY_ITEM_ID, MF_BYCOMMAND);
453 /* Add the header to the popup, if told so. The same as in X - an
454 insensitive item, and a separator (Seems to me, there were
455 two separators in X... In Windows this looks ugly, anyways. */
456 if (!bar_p && !deep_p && popup_menu_titles && !NILP(gui_item.name))
458 CHECK_STRING (gui_item.name);
459 InsertMenu (menu, 0, MF_BYPOSITION | MF_STRING | MF_DISABLED,
460 0, XSTRING_DATA(gui_item.name));
461 InsertMenu (menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
462 SetMenuDefaultItem (menu, 0, MF_BYPOSITION);
465 UNGCPRO; /* gui_item */
470 populate_menu (HMENU menu, Lisp_Object path, Lisp_Object desc,
471 Lisp_Object hash_tab, int bar_p)
473 populate_or_checksum_helper (menu, path, desc, hash_tab, bar_p, 1);
477 checksum_menu (Lisp_Object desc)
479 return populate_or_checksum_helper (NULL, Qnil, desc, Qunbound, 0, 0);
483 update_frame_menubar_maybe (struct frame* f)
485 HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
486 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
487 Lisp_Object desc = (!NILP (w->menubar_visible_p)
488 ? symbol_value_in_buffer (Qcurrent_menubar, w->buffer)
491 top_level_menu = menubar;
493 if (NILP (desc) && menubar != NULL)
495 /* Menubar has gone */
496 FRAME_MSWINDOWS_MENU_HASH_TABLE(f) = Qnil;
497 SetMenu (FRAME_MSWINDOWS_HANDLE (f), NULL);
498 DestroyMenu (menubar);
499 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
503 if (!NILP (desc) && menubar == NULL)
505 /* Menubar has appeared */
506 menubar = CreateMenu ();
512 /* We did not have the bar and are not going to */
516 /* Now we bail out if the menubar has not changed */
517 if (FRAME_MSWINDOWS_MENU_CHECKSUM(f) == checksum_menu (desc))
521 /* Come with empty hash table */
522 if (NILP (FRAME_MSWINDOWS_MENU_HASH_TABLE(f)))
523 FRAME_MSWINDOWS_MENU_HASH_TABLE(f) =
524 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL);
526 Fclrhash (FRAME_MSWINDOWS_MENU_HASH_TABLE(f));
528 Fputhash (hmenu_to_lisp_object (menubar), Qnil,
529 FRAME_MSWINDOWS_MENU_HASH_TABLE(f));
530 populate_menu (menubar, Qnil, desc,
531 FRAME_MSWINDOWS_MENU_HASH_TABLE(f), 1);
532 SetMenu (FRAME_MSWINDOWS_HANDLE (f), menubar);
533 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
535 FRAME_MSWINDOWS_MENU_CHECKSUM(f) = checksum_menu (desc);
539 prune_menubar (struct frame *f)
541 HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
542 Lisp_Object desc = current_frame_menubar (f);
546 /* #### If a filter function has set desc to Qnil, this abort()
547 triggers. To resolve, we must prevent filters explicitly from
548 mangling with the active menu. In apply_filter probably?
549 Is copy-tree on the whole menu too expensive? */
554 /* We do the trick by removing all items and re-populating top level */
555 empty_menu (menubar, 0);
557 assert (HASH_TABLEP (FRAME_MSWINDOWS_MENU_HASH_TABLE(f)));
558 Fclrhash (FRAME_MSWINDOWS_MENU_HASH_TABLE(f));
560 Fputhash (hmenu_to_lisp_object (menubar), Qnil,
561 FRAME_MSWINDOWS_MENU_HASH_TABLE(f));
562 populate_menu (menubar, Qnil, desc,
563 FRAME_MSWINDOWS_MENU_HASH_TABLE(f), 1);
567 * This is called when cleanup is possible. It is better not to
568 * clean things up at all than do it too early!
571 menu_cleanup (struct frame *f)
573 /* This function can GC */
574 current_menudesc = Qnil;
575 current_hash_table = Qnil;
580 /*------------------------------------------------------------------------*/
581 /* Message handlers */
582 /*------------------------------------------------------------------------*/
584 unsafe_handle_wm_initmenupopup_1 (HMENU menu, struct frame* f)
586 /* This function can call lisp, beat dogs and stick chewing gum to
589 Lisp_Object path, desc;
592 /* Find which guy is going to explode */
593 path = Fgethash (hmenu_to_lisp_object (menu), current_hash_table, Qunbound);
594 assert (!UNBOUNDP (path));
596 /* Allow to continue in a debugger after assert - not so fatal */
598 error ("internal menu error");
601 /* Now find a desc chunk for it. If none, then probably menu open
602 hook has played too much games around stuff */
603 desc = Fmenu_find_real_submenu (current_menudesc, path);
605 signal_simple_error ("This menu does not exist any more", path);
608 /* DESC may be generated by filter, so we have to gcpro it */
610 populate_menu (menu, path, desc, current_hash_table, 0);
616 unsafe_handle_wm_initmenu_1 (struct frame* f)
618 /* This function can call lisp */
620 /* NOTE: This is called for the bar only, WM_INITMENU
621 for popups is filtered out */
623 /* #### - this menubar update mechanism is expensively anti-social and
624 the activate-menubar-hook is now mostly obsolete. */
626 /* We simply ignore return value. In any case, we construct the bar
628 run_hook (Qactivate_menubar_hook);
630 update_frame_menubar_maybe (f);
632 current_menudesc = current_frame_menubar (f);
633 current_hash_table = FRAME_MSWINDOWS_MENU_HASH_TABLE(f);
634 assert (HASH_TABLEP (current_hash_table));
640 * Return value is Qt if we have dispatched the command,
641 * or Qnil if id has not been mapped to a callback.
642 * Window procedure may try other targets to route the
643 * command if we return nil
646 mswindows_handle_wm_command (struct frame* f, WORD id)
648 /* Try to map the command id through the proper hash table */
649 Lisp_Object data, fn, arg, frame;
652 if (NILP (current_hash_table))
655 data = Fgethash (make_int (id), current_hash_table, Qunbound);
663 /* Need to gcpro because the hash table may get destroyed by
664 menu_cleanup(), and will not gcpro the data any more */
668 /* Ok, this is our one. Enqueue it. */
669 get_gui_callback (data, &fn, &arg);
670 XSETFRAME (frame, f);
671 /* this used to call mswindows_enqueue_misc_user_event but that
672 breaks customize because the misc_event gets eval'ed in some
673 cicumstances. Don't change it back unless you can fix the
674 customize problem also.*/
675 enqueue_misc_user_event (frame, fn, arg);
676 mswindows_enqueue_magic_event (NULL, XM_BUMPQUEUE);
683 /*------------------------------------------------------------------------*/
684 /* Message handling proxies */
685 /*------------------------------------------------------------------------*/
687 static HMENU wm_initmenu_menu;
688 static struct frame* wm_initmenu_frame;
691 unsafe_handle_wm_initmenupopup (Lisp_Object u_n_u_s_e_d)
693 return unsafe_handle_wm_initmenupopup_1 (wm_initmenu_menu, wm_initmenu_frame);
697 unsafe_handle_wm_initmenu (Lisp_Object u_n_u_s_e_d)
699 return unsafe_handle_wm_initmenu_1 (wm_initmenu_frame);
703 mswindows_handle_wm_initmenupopup (HMENU hmenu, struct frame* frm)
705 /* We cannot pass hmenu as a lisp object. Use static var */
706 wm_initmenu_menu = hmenu;
707 wm_initmenu_frame = frm;
708 return mswindows_protect_modal_loop (unsafe_handle_wm_initmenupopup, Qnil);
712 mswindows_handle_wm_initmenu (HMENU hmenu, struct frame* f)
714 /* Handle only frame menubar, ignore if from popup or system menu */
715 if (GetMenu (FRAME_MSWINDOWS_HANDLE(f)) == hmenu)
717 wm_initmenu_frame = f;
718 return mswindows_protect_modal_loop (unsafe_handle_wm_initmenu, Qnil);
724 /*------------------------------------------------------------------------*/
726 /*------------------------------------------------------------------------*/
729 mswindows_update_frame_menubars (struct frame* f)
731 update_frame_menubar_maybe (f);
735 mswindows_free_frame_menubars (struct frame* f)
737 FRAME_MSWINDOWS_MENU_HASH_TABLE(f) = Qnil;
741 mswindows_popup_menu (Lisp_Object menu_desc, Lisp_Object event)
743 struct frame *f = selected_frame ();
744 struct Lisp_Event *eev = NULL;
751 CHECK_LIVE_EVENT (event);
752 eev = XEVENT (event);
753 if (eev->event_type != button_press_event
754 && eev->event_type != button_release_event)
755 wrong_type_argument (Qmouse_event_p, event);
757 else if (!NILP (Vthis_command_keys))
759 /* if an event wasn't passed, use the last event of the event sequence
760 currently being executed, if that event is a mouse event */
761 eev = XEVENT (Vthis_command_keys); /* last event first */
762 if (eev->event_type != button_press_event
763 && eev->event_type != button_release_event)
767 /* Default is to put the menu at the point (10, 10) in frame */
770 pt.x = eev->event.button.x;
771 pt.y = eev->event.button.y;
772 ClientToScreen (FRAME_MSWINDOWS_HANDLE (f), &pt);
777 if (SYMBOLP (menu_desc))
778 menu_desc = Fsymbol_value (menu_desc);
779 CHECK_CONS (menu_desc);
780 CHECK_STRING (XCAR (menu_desc));
782 current_menudesc = menu_desc;
784 make_lisp_hash_table (10, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL);
785 menu = create_empty_popup_menu();
786 Fputhash (hmenu_to_lisp_object (menu), Qnil, current_hash_table);
787 top_level_menu = menu;
789 /* see comments in menubar-x.c */
791 zmacs_region_stays = 1;
793 ok = TrackPopupMenu (menu,
794 TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
796 FRAME_MSWINDOWS_HANDLE (f), NULL);
800 /* Signal a signal if caught by Track...() modal loop */
801 mswindows_unmodalize_signal_maybe ();
803 /* This is probably the only real reason for failure */
806 signal_simple_error ("Cannot track popup menu while in menu",
812 /*------------------------------------------------------------------------*/
814 /*------------------------------------------------------------------------*/
816 syms_of_menubar_mswindows (void)
821 console_type_create_menubar_mswindows (void)
823 CONSOLE_HAS_METHOD (mswindows, update_frame_menubars);
824 CONSOLE_HAS_METHOD (mswindows, free_frame_menubars);
825 CONSOLE_HAS_METHOD (mswindows, popup_menu);
829 vars_of_menubar_mswindows (void)
831 current_menudesc = Qnil;
832 current_hash_table = Qnil;
834 staticpro (¤t_menudesc);
835 staticpro (¤t_hash_table);