aboutsummaryrefslogtreecommitdiffstats
path: root/src/macmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/macmenu.c')
-rw-r--r--src/macmenu.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/macmenu.c b/src/macmenu.c
index 54393bca594..e97a968d92d 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -602,6 +602,13 @@ list_of_items (pane)
602 } 602 }
603} 603}
604 604
605static Lisp_Object
606cleanup_popup_menu (arg)
607 Lisp_Object arg;
608{
609 discard_menu_items ();
610}
611
605DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, 612DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0,
606 doc: /* Pop up a deck-of-cards menu and return user's selection. 613 doc: /* Pop up a deck-of-cards menu and return user's selection.
607POSITION is a position specification. This is either a mouse button 614POSITION is a position specification. This is either a mouse button
@@ -647,6 +654,8 @@ cached information about equivalent key sequences. */)
647 int keymaps = 0; 654 int keymaps = 0;
648 int for_click = 0; 655 int for_click = 0;
649 struct gcpro gcpro1; 656 struct gcpro gcpro1;
657 int specpdl_count = SPECPDL_INDEX ();
658
650 659
651#ifdef HAVE_MENUS 660#ifdef HAVE_MENUS
652 if (! NILP (position)) 661 if (! NILP (position))
@@ -806,13 +815,13 @@ cached information about equivalent key sequences. */)
806 815
807#ifdef HAVE_MENUS 816#ifdef HAVE_MENUS
808 /* Display them in a menu. */ 817 /* Display them in a menu. */
818 record_unwind_protect (cleanup_popup_menu, Qnil);
809 BLOCK_INPUT; 819 BLOCK_INPUT;
810 820
811 selection = mac_menu_show (f, xpos, ypos, for_click, 821 selection = mac_menu_show (f, xpos, ypos, for_click,
812 keymaps, title, &error_name); 822 keymaps, title, &error_name);
813 UNBLOCK_INPUT; 823 UNBLOCK_INPUT;
814 824 unbind_to (specpdl_count, Qnil);
815 discard_menu_items ();
816 825
817 UNGCPRO; 826 UNGCPRO;
818#endif /* HAVE_MENUS */ 827#endif /* HAVE_MENUS */
@@ -1931,6 +1940,9 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1931 } 1940 }
1932 } 1941 }
1933 } 1942 }
1943 else if (!for_click)
1944 /* Make "Cancel" equivalent to C-g. */
1945 Fsignal (Qquit, Qnil);
1934 1946
1935 return Qnil; 1947 return Qnil;
1936} 1948}