Mercurial > hg > xemacs-beta
comparison src/menubar-msw.c @ 380:8626e4521993 r21-2-5
Import from CVS: tag r21-2-5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:07:10 +0200 |
parents | 6240c7796c7a |
children | 064ab7fed2e0 |
comparison
equal
deleted
inserted
replaced
379:76b7d63099ad | 380:8626e4521993 |
---|---|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 Boston, MA 02111-1307, USA. */ | 21 Boston, MA 02111-1307, USA. */ |
22 | 22 |
23 /* Synched up with: Not in FSF. */ | 23 /* Synched up with: Not in FSF. */ |
24 | 24 |
25 /* Autorship: | 25 /* Author: |
26 Initially written by kkm 12/24/97, | 26 Initially written by kkm 12/24/97, |
27 peeking into and copying stuff from menubar-x.c | 27 peeking into and copying stuff from menubar-x.c |
28 */ | 28 */ |
29 | 29 |
30 /* Algotirhm for handling menus is as follows. When window's menubar | 30 /* Algorithm for handling menus is as follows. When window's menubar |
31 * is created, current-menubar is not traversed in depth. Rather, only | 31 * is created, current-menubar is not traversed in depth. Rather, only |
32 * top level items, both items and pulldowns, are added to the | 32 * top level items, both items and pulldowns, are added to the |
33 * menubar. Each pulldown is initially empty. When a pulldown is | 33 * menubar. Each pulldown is initially empty. When a pulldown is |
34 * selected and about to open, corresponding element of | 34 * selected and about to open, corresponding element of |
35 * current-menubar is found, and the newly open pulldown is | 35 * current-menubar is found, and the newly open pulldown is |
37 * | 37 * |
38 * This algorithm uses hash tables to find out element of the menu | 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 | 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 | 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 | 41 * representing the path from the root of the menu to the item |
42 * descriptor. Each frame has an associated hashtable. | 42 * descriptor. Each frame has an associated hash table. |
43 * | 43 * |
44 * Leaf items are assigned a unique id based on item's hash. When an | 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 | 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 | 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 | 47 * value. Yes, Win32 is just a different set of bugs than X! Aside |
48 * from this blame, another hasing mechanism is required to map menu | 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 | 49 * ids to commands (which are actually Lisp_Object's). This mapping is |
50 * performed in the same hashtable, as the lifetime of both maps is | 50 * performed in the same hash table, as the lifetime of both maps is |
51 * exactly the same. This is unabmigous, as menu handles are | 51 * exactly the same. This is unambigous, as menu handles are |
52 * represented by lisp opaques, while command ids are by lisp | 52 * represented by lisp opaques, while command ids are by lisp |
53 * integers. The additional advantage for this is that command forms | 53 * integers. The additional advantage for this is that command forms |
54 * are automatically GC-protected, which is important because these | 54 * are automatically GC-protected, which is important because these |
55 * may be transient forms generated by :filter functions. | 55 * may be transient forms generated by :filter functions. |
56 * | 56 * |
57 * The hashtable is not allowed to grow too much; it is pruned | 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 | 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. | 59 * bar, and clearing and refilling the hash table from scratch. |
60 * | 60 * |
61 * Popup menus are handled identially to pulldowns. A static hash | 61 * Popup menus are handled identically to pulldowns. A static hash |
62 * table is used for popup menus, and lookup is made not in | 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' | 63 * current-menubar but in a lisp form supplied to the `popup' |
64 * function. | 64 * function. |
65 * | 65 * |
66 * Another Windows weirdness is that there's no way to tell that a | 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 | 67 * popup has been dismissed without making selection. We need to know |
68 * that to cleanup the popup menu hashtable, but this is not honestly | 68 * that to cleanup the popup menu hash table, but this is not honestly |
69 * doable using *documented* sequence of messages. Sticking to | 69 * doable using *documented* sequence of messages. Sticking to |
70 * particular knowledge is bad because this may break in Windows NT | 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 | 71 * 5.0, or Windows 98, or other future version. Instead, I allow the |
72 * hashtables to hang around, and not clear them, unless WM_COMMAND is | 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, | 73 * received. This is worthy some memory but more safe. Hacks welcome, |
74 * anyways! | 74 * anyways! |
75 * | 75 * |
76 */ | 76 */ |
77 | 77 |
99 #define EMPTY_ITEM_NAME "(empty)" | 99 #define EMPTY_ITEM_NAME "(empty)" |
100 | 100 |
101 /* Current menu (bar or popup) descriptor. gcpro'ed */ | 101 /* Current menu (bar or popup) descriptor. gcpro'ed */ |
102 static Lisp_Object current_menudesc; | 102 static Lisp_Object current_menudesc; |
103 | 103 |
104 /* Current menubar or popup hashtable. gcpro'ed */ | 104 /* Current menubar or popup hash table. gcpro'ed */ |
105 static Lisp_Object current_hashtable; | 105 static Lisp_Object current_hash_table; |
106 | 106 |
107 /* This is used to allocate unique ids to menu items. | 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. | 108 Items ids are in MENU_ITEM_ID_MIN to MENU_ITEM_ID_MAX. |
109 Allocation checks that the item is not already in | 109 Allocation checks that the item is not already in |
110 the TOP_LEVEL_MENU */ | 110 the TOP_LEVEL_MENU */ |
123 * "Left Flush\tRight Flush" | 123 * "Left Flush\tRight Flush" |
124 */ | 124 */ |
125 static char* | 125 static char* |
126 displayable_menu_item (struct gui_item* pgui_item, int bar_p) | 126 displayable_menu_item (struct gui_item* pgui_item, int bar_p) |
127 { | 127 { |
128 /* We construct the name in a static buffer. That's fine, beause | 128 /* We construct the name in a static buffer. That's fine, because |
129 menu items longer than 128 chars are probably programming errors, | 129 menu items longer than 128 chars are probably programming errors, |
130 and better be caught than displayed! */ | 130 and better be caught than displayed! */ |
131 | 131 |
132 static char buf[MAX_MENUITEM_LENGTH+2]; | 132 static char buf[MAX_MENUITEM_LENGTH+2]; |
133 unsigned int ll, lr; | 133 unsigned int ll, lr; |
158 } | 158 } |
159 | 159 |
160 /* | 160 /* |
161 * Allocation tries a hash based on item's path and name first. This | 161 * Allocation tries a hash based on item's path and name first. This |
162 * almost guarantees that the same item will override its old value in | 162 * almost guarantees that the same item will override its old value in |
163 * the hashtable rather than abandon it. | 163 * the hash table rather than abandon it. |
164 */ | 164 */ |
165 static Lisp_Object | 165 static Lisp_Object |
166 allocate_menu_item_id (Lisp_Object path, Lisp_Object name, Lisp_Object suffix) | 166 allocate_menu_item_id (Lisp_Object path, Lisp_Object name, Lisp_Object suffix) |
167 { | 167 { |
168 UINT id = MENU_ITEM_ID_BITS (HASH3 (internal_hash (path, 0), | 168 UINT id = MENU_ITEM_ID_BITS (HASH3 (internal_hash (path, 0), |
188 AppendMenu (menu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME); | 188 AppendMenu (menu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME); |
189 } | 189 } |
190 | 190 |
191 /* | 191 /* |
192 * The idea of checksumming is that we must hash minimal object | 192 * The idea of checksumming is that we must hash minimal object |
193 * which is neccessarily changes when the item changes. For separator | 193 * which is necessarily changes when the item changes. For separator |
194 * this is a constant, for grey strings and submenus these are hashes | 194 * this is a constant, for grey strings and submenus these are hashes |
195 * of names, since sumbenus are unpopulated until opened so always | 195 * of names, since submenus are unpopulated until opened so always |
196 * equal otherwise. For items, this is a full hash value of a callback, | 196 * equal otherwise. For items, this is a full hash value of a callback, |
197 * because a callback may me a form which can be changed only somewhere | 197 * because a callback may me a form which can be changed only somewhere |
198 * in depth. | 198 * in depth. |
199 */ | 199 */ |
200 static unsigned long | 200 static unsigned long |
353 | 353 |
354 /* | 354 /* |
355 * This function is called from populate_menu and checksum_menu. | 355 * This function is called from populate_menu and checksum_menu. |
356 * When called to populate, MENU is a menu handle, PATH is a | 356 * When called to populate, MENU is a menu handle, PATH is a |
357 * list of strings representing menu path from root to this submenu, | 357 * list of strings representing menu path from root to this submenu, |
358 * DESCRIPTOR is a menu descriptor, HASH_TAB is a hashtable associated | 358 * DESCRIPTOR is a menu descriptor, HASH_TAB is a hash table associated |
359 * with root menu, BAR_P indicates whether this called for a menubar or | 359 * with root menu, BAR_P indicates whether this called for a menubar or |
360 * a popup, and POPULATE_P is non-zero. Return value must be ignored. | 360 * a popup, and POPULATE_P is non-zero. Return value must be ignored. |
361 * When called to checksum, DESCRIPTOR has the same meaning, POPULATE_P | 361 * When called to checksum, DESCRIPTOR has the same meaning, POPULATE_P |
362 * is zero, PATH must be Qnil, and the rest of parameters is ignored. | 362 * is zero, PATH must be Qnil, and the rest of parameters is ignored. |
363 * Return value is the menu checksum. | 363 * Return value is the menu checksum. |
374 | 374 |
375 gui_item_init (&gui_item); | 375 gui_item_init (&gui_item); |
376 GCPRO_GUI_ITEM (&gui_item); | 376 GCPRO_GUI_ITEM (&gui_item); |
377 | 377 |
378 /* We are sometimes called with the menubar unchanged, and with changed | 378 /* We are sometimes called with the menubar unchanged, and with changed |
379 right flush. We have to update the menubar in ths case, | 379 right flush. We have to update the menubar in this case, |
380 so account for the compliance setting in the hash value */ | 380 so account for the compliance setting in the hash value */ |
381 checksum = REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH; | 381 checksum = REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH; |
382 | 382 |
383 /* Will initially contain only "(empty)" */ | 383 /* Will initially contain only "(empty)" */ |
384 if (populate_p) | 384 if (populate_p) |
402 flush_right = 0; | 402 flush_right = 0; |
403 EXTERNAL_LIST_LOOP (item_desc, desc) | 403 EXTERNAL_LIST_LOOP (item_desc, desc) |
404 { | 404 { |
405 if (NILP (XCAR (item_desc))) | 405 if (NILP (XCAR (item_desc))) |
406 { | 406 { |
407 /* Do not flush right menubar items when MS style compiant */ | 407 /* Do not flush right menubar items when MS style compliant */ |
408 if (bar_p && !REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH) | 408 if (bar_p && !REPLACE_ME_WITH_GLOBAL_VARIABLE_WHICH_CONTROLS_RIHGT_FLUSH) |
409 flush_right = 1; | 409 flush_right = 1; |
410 if (!populate_p) | 410 if (!populate_p) |
411 checksum = HASH2 (checksum, LISP_HASH (Qnil)); | 411 checksum = HASH2 (checksum, LISP_HASH (Qnil)); |
412 } | 412 } |
424 if (GetMenuItemCount (menu) > 1) | 424 if (GetMenuItemCount (menu) > 1) |
425 RemoveMenu (menu, EMPTY_ITEM_ID, MF_BYCOMMAND); | 425 RemoveMenu (menu, EMPTY_ITEM_ID, MF_BYCOMMAND); |
426 | 426 |
427 /* Add the header to the popup, if told so. The same as in X - an | 427 /* Add the header to the popup, if told so. The same as in X - an |
428 insensitive item, and a separator (Seems to me, there were | 428 insensitive item, and a separator (Seems to me, there were |
429 two separators in X... In Windows this looks ugly, anywats. */ | 429 two separators in X... In Windows this looks ugly, anyways. */ |
430 if (!bar_p && !deep_p && popup_menu_titles && !NILP(gui_item.name)) | 430 if (!bar_p && !deep_p && popup_menu_titles && !NILP(gui_item.name)) |
431 { | 431 { |
432 CHECK_STRING (gui_item.name); | 432 CHECK_STRING (gui_item.name); |
433 InsertMenu (menu, 0, MF_BYPOSITION | MF_STRING | MF_DISABLED, | 433 InsertMenu (menu, 0, MF_BYPOSITION | MF_STRING | MF_DISABLED, |
434 0, XSTRING_DATA(gui_item.name)); | 434 0, XSTRING_DATA(gui_item.name)); |
465 top_level_menu = menubar; | 465 top_level_menu = menubar; |
466 | 466 |
467 if (NILP (desc) && menubar != NULL) | 467 if (NILP (desc) && menubar != NULL) |
468 { | 468 { |
469 /* Menubar has gone */ | 469 /* Menubar has gone */ |
470 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil; | 470 FRAME_MSWINDOWS_MENU_HASH_TABLE(f) = Qnil; |
471 SetMenu (FRAME_MSWINDOWS_HANDLE (f), NULL); | 471 SetMenu (FRAME_MSWINDOWS_HANDLE (f), NULL); |
472 DestroyMenu (menubar); | 472 DestroyMenu (menubar); |
473 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f)); | 473 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f)); |
474 return; | 474 return; |
475 } | 475 } |
491 if (FRAME_MSWINDOWS_MENU_CHECKSUM(f) == checksum_menu (desc)) | 491 if (FRAME_MSWINDOWS_MENU_CHECKSUM(f) == checksum_menu (desc)) |
492 return; | 492 return; |
493 | 493 |
494 populate: | 494 populate: |
495 /* Come with empty hash table */ | 495 /* Come with empty hash table */ |
496 if (NILP (FRAME_MSWINDOWS_MENU_HASHTABLE(f))) | 496 if (NILP (FRAME_MSWINDOWS_MENU_HASH_TABLE(f))) |
497 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Fmake_hashtable (make_int (50), Qequal); | 497 FRAME_MSWINDOWS_MENU_HASH_TABLE(f) = |
498 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL); | |
498 else | 499 else |
499 Fclrhash (FRAME_MSWINDOWS_MENU_HASHTABLE(f)); | 500 Fclrhash (FRAME_MSWINDOWS_MENU_HASH_TABLE(f)); |
500 | 501 |
501 Fputhash (hmenu_to_lisp_object (menubar), Qnil, | 502 Fputhash (hmenu_to_lisp_object (menubar), Qnil, |
502 FRAME_MSWINDOWS_MENU_HASHTABLE(f)); | 503 FRAME_MSWINDOWS_MENU_HASH_TABLE(f)); |
503 populate_menu (menubar, Qnil, desc, | 504 populate_menu (menubar, Qnil, desc, |
504 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1); | 505 FRAME_MSWINDOWS_MENU_HASH_TABLE(f), 1); |
505 SetMenu (FRAME_MSWINDOWS_HANDLE (f), menubar); | 506 SetMenu (FRAME_MSWINDOWS_HANDLE (f), menubar); |
506 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f)); | 507 DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f)); |
507 | 508 |
508 FRAME_MSWINDOWS_MENU_CHECKSUM(f) = checksum_menu (desc); | 509 FRAME_MSWINDOWS_MENU_CHECKSUM(f) = checksum_menu (desc); |
509 } | 510 } |
515 Lisp_Object desc = current_frame_menubar (f); | 516 Lisp_Object desc = current_frame_menubar (f); |
516 if (menubar == NULL) | 517 if (menubar == NULL) |
517 return; | 518 return; |
518 | 519 |
519 /* #### If a filter function has set desc to Qnil, this abort() | 520 /* #### If a filter function has set desc to Qnil, this abort() |
520 triggers. To resolve, we must prevent filters explicitely from | 521 triggers. To resolve, we must prevent filters explicitly from |
521 mangling with the active menu. In apply_filter probably? | 522 mangling with the active menu. In apply_filter probably? |
522 Is copy-tree on the whole menu too expensive? */ | 523 Is copy-tree on the whole menu too expensive? */ |
523 if (NILP(desc)) | 524 if (NILP(desc)) |
524 /* abort(); */ | 525 /* abort(); */ |
525 return; | 526 return; |
526 | 527 |
527 /* We do the trick by removing all items and re-populating top level */ | 528 /* We do the trick by removing all items and re-populating top level */ |
528 empty_menu (menubar, 0); | 529 empty_menu (menubar, 0); |
529 | 530 |
530 assert (HASHTABLEP (FRAME_MSWINDOWS_MENU_HASHTABLE(f))); | 531 assert (HASH_TABLEP (FRAME_MSWINDOWS_MENU_HASH_TABLE(f))); |
531 Fclrhash (FRAME_MSWINDOWS_MENU_HASHTABLE(f)); | 532 Fclrhash (FRAME_MSWINDOWS_MENU_HASH_TABLE(f)); |
532 | 533 |
533 Fputhash (hmenu_to_lisp_object (menubar), Qnil, | 534 Fputhash (hmenu_to_lisp_object (menubar), Qnil, |
534 FRAME_MSWINDOWS_MENU_HASHTABLE(f)); | 535 FRAME_MSWINDOWS_MENU_HASH_TABLE(f)); |
535 populate_menu (menubar, Qnil, desc, | 536 populate_menu (menubar, Qnil, desc, |
536 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1); | 537 FRAME_MSWINDOWS_MENU_HASH_TABLE(f), 1); |
537 } | 538 } |
538 | 539 |
539 /* | 540 /* |
540 * This is called when cleanup is possible. It is better not to | 541 * This is called when cleanup is possible. It is better not to |
541 * clean things up at all than do it too earaly! | 542 * clean things up at all than do it too early! |
542 */ | 543 */ |
543 static void | 544 static void |
544 menu_cleanup (struct frame *f) | 545 menu_cleanup (struct frame *f) |
545 { | 546 { |
546 /* This function can GC */ | 547 /* This function can GC */ |
547 current_menudesc = Qnil; | 548 current_menudesc = Qnil; |
548 current_hashtable = Qnil; | 549 current_hash_table = Qnil; |
549 prune_menubar (f); | 550 prune_menubar (f); |
550 } | 551 } |
551 | 552 |
552 | 553 |
553 /*------------------------------------------------------------------------*/ | 554 /*------------------------------------------------------------------------*/ |
561 | 562 |
562 Lisp_Object path, desc; | 563 Lisp_Object path, desc; |
563 struct gcpro gcpro1; | 564 struct gcpro gcpro1; |
564 | 565 |
565 /* Find which guy is going to explode */ | 566 /* Find which guy is going to explode */ |
566 path = Fgethash (hmenu_to_lisp_object (menu), current_hashtable, Qunbound); | 567 path = Fgethash (hmenu_to_lisp_object (menu), current_hash_table, Qunbound); |
567 assert (!UNBOUNDP (path)); | 568 assert (!UNBOUNDP (path)); |
568 #ifdef DEBUG_XEMACS | 569 #ifdef DEBUG_XEMACS |
569 /* Allow to continue in a debugger after assert - not so fatal */ | 570 /* Allow to continue in a debugger after assert - not so fatal */ |
570 if (UNBOUNDP (path)) | 571 if (UNBOUNDP (path)) |
571 error ("internal menu error"); | 572 error ("internal menu error"); |
578 signal_simple_error ("This menu does not exist any more", path); | 579 signal_simple_error ("This menu does not exist any more", path); |
579 | 580 |
580 /* Now, stuff it */ | 581 /* Now, stuff it */ |
581 /* DESC may be generated by filter, so we have to gcpro it */ | 582 /* DESC may be generated by filter, so we have to gcpro it */ |
582 GCPRO1 (desc); | 583 GCPRO1 (desc); |
583 populate_menu (menu, path, desc, current_hashtable, 0); | 584 populate_menu (menu, path, desc, current_hash_table, 0); |
584 UNGCPRO; | 585 UNGCPRO; |
585 return Qt; | 586 return Qt; |
586 } | 587 } |
587 | 588 |
588 static Lisp_Object | 589 static Lisp_Object |
601 run_hook (Qactivate_menubar_hook); | 602 run_hook (Qactivate_menubar_hook); |
602 | 603 |
603 update_frame_menubar_maybe (f); | 604 update_frame_menubar_maybe (f); |
604 | 605 |
605 current_menudesc = current_frame_menubar (f); | 606 current_menudesc = current_frame_menubar (f); |
606 current_hashtable = FRAME_MSWINDOWS_MENU_HASHTABLE(f); | 607 current_hash_table = FRAME_MSWINDOWS_MENU_HASH_TABLE(f); |
607 assert (HASHTABLEP (current_hashtable)); | 608 assert (HASH_TABLEP (current_hash_table)); |
608 | 609 |
609 return Qt; | 610 return Qt; |
610 } | 611 } |
611 | 612 |
612 /* | 613 /* |
620 { | 621 { |
621 /* Try to map the command id through the proper hash table */ | 622 /* Try to map the command id through the proper hash table */ |
622 Lisp_Object data, fn, arg, frame; | 623 Lisp_Object data, fn, arg, frame; |
623 struct gcpro gcpro1; | 624 struct gcpro gcpro1; |
624 | 625 |
625 data = Fgethash (make_int (id), current_hashtable, Qunbound); | 626 data = Fgethash (make_int (id), current_hash_table, Qunbound); |
626 if (UNBOUNDP (data)) | 627 if (UNBOUNDP (data)) |
627 { | 628 { |
628 menu_cleanup (f); | 629 menu_cleanup (f); |
629 return Qnil; | 630 return Qnil; |
630 } | 631 } |
631 | 632 |
632 /* Need to gcpro because the hashtable may get destroyed by | 633 /* Need to gcpro because the hash table may get destroyed by |
633 menu_cleanup(), and will not gcpro the data any more */ | 634 menu_cleanup(), and will not gcpro the data any more */ |
634 GCPRO1 (data); | 635 GCPRO1 (data); |
635 menu_cleanup (f); | 636 menu_cleanup (f); |
636 | 637 |
637 /* Ok, this is our one. Enqueue it. */ | 638 /* Ok, this is our one. Enqueue it. */ |
701 } | 702 } |
702 | 703 |
703 static void | 704 static void |
704 mswindows_free_frame_menubars (struct frame* f) | 705 mswindows_free_frame_menubars (struct frame* f) |
705 { | 706 { |
706 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil; | 707 FRAME_MSWINDOWS_MENU_HASH_TABLE(f) = Qnil; |
707 } | 708 } |
708 | 709 |
709 static void | 710 static void |
710 mswindows_popup_menu (Lisp_Object menu_desc, Lisp_Object event) | 711 mswindows_popup_menu (Lisp_Object menu_desc, Lisp_Object event) |
711 { | 712 { |
747 menu_desc = Fsymbol_value (menu_desc); | 748 menu_desc = Fsymbol_value (menu_desc); |
748 CHECK_CONS (menu_desc); | 749 CHECK_CONS (menu_desc); |
749 CHECK_STRING (XCAR (menu_desc)); | 750 CHECK_STRING (XCAR (menu_desc)); |
750 | 751 |
751 current_menudesc = menu_desc; | 752 current_menudesc = menu_desc; |
752 current_hashtable = Fmake_hashtable (make_int(10), Qequal); | 753 current_hash_table = |
754 make_lisp_hash_table (10, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL); | |
753 menu = create_empty_popup_menu(); | 755 menu = create_empty_popup_menu(); |
754 Fputhash (hmenu_to_lisp_object (menu), Qnil, current_hashtable); | 756 Fputhash (hmenu_to_lisp_object (menu), Qnil, current_hash_table); |
755 top_level_menu = menu; | 757 top_level_menu = menu; |
756 | 758 |
757 /* see comments in menubar-x.c */ | 759 /* see comments in menubar-x.c */ |
758 if (zmacs_regions) | 760 if (zmacs_regions) |
759 zmacs_region_stays = 1; | 761 zmacs_region_stays = 1; |
795 | 797 |
796 void | 798 void |
797 vars_of_menubar_mswindows (void) | 799 vars_of_menubar_mswindows (void) |
798 { | 800 { |
799 current_menudesc = Qnil; | 801 current_menudesc = Qnil; |
800 current_hashtable = Qnil; | 802 current_hash_table = Qnil; |
801 | 803 |
802 staticpro (¤t_menudesc); | 804 staticpro (¤t_menudesc); |
803 staticpro (¤t_hashtable); | 805 staticpro (¤t_hash_table); |
804 } | 806 } |