aboutsummaryrefslogtreecommitdiffstats
path: root/src/xmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index b585df2125b..2042699f48c 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1,7 +1,7 @@
1/* X Communication module for terminals which understand the X protocol. 1/* X Communication module for terminals which understand the X protocol.
2 2
3Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2012 3Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2013 Free Software
4 Free Software Foundation, Inc. 4Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -976,7 +976,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
976 if (! menubar_widget) 976 if (! menubar_widget)
977 previous_menu_items_used = 0; 977 previous_menu_items_used = 0;
978 978
979 buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; 979 buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents;
980 specbind (Qinhibit_quit, Qt); 980 specbind (Qinhibit_quit, Qt);
981 /* Don't let the debugger step into this code 981 /* Don't let the debugger step into this code
982 because it is not reentrant. */ 982 because it is not reentrant. */
@@ -1055,7 +1055,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
1055 wv->help = Qnil; 1055 wv->help = Qnil;
1056 first_wv = wv; 1056 first_wv = wv;
1057 1057
1058 for (i = 0; 0 <= submenu_start[i]; i++) 1058 for (i = 0; submenu_start[i] >= 0; i++)
1059 { 1059 {
1060 menu_items_n_panes = submenu_n_panes[i]; 1060 menu_items_n_panes = submenu_n_panes[i];
1061 wv = digest_single_submenu (submenu_start[i], submenu_end[i], 1061 wv = digest_single_submenu (submenu_start[i], submenu_end[i],
@@ -1411,11 +1411,9 @@ popup_selection_callback (GtkWidget *widget, gpointer client_data)
1411static Lisp_Object 1411static Lisp_Object
1412pop_down_menu (Lisp_Object arg) 1412pop_down_menu (Lisp_Object arg)
1413{ 1413{
1414 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1415
1416 popup_activated_flag = 0; 1414 popup_activated_flag = 0;
1417 block_input (); 1415 block_input ();
1418 gtk_widget_destroy (GTK_WIDGET (p->pointer)); 1416 gtk_widget_destroy (GTK_WIDGET (XSAVE_POINTER (arg, 0)));
1419 unblock_input (); 1417 unblock_input ();
1420 return Qnil; 1418 return Qnil;
1421} 1419}
@@ -1479,7 +1477,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1479 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 1477 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
1480 timestamp ? timestamp : gtk_get_current_event_time ()); 1478 timestamp ? timestamp : gtk_get_current_event_time ());
1481 1479
1482 record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); 1480 record_unwind_protect (pop_down_menu, make_save_pointer (menu));
1483 1481
1484 if (gtk_widget_get_mapped (menu)) 1482 if (gtk_widget_get_mapped (menu))
1485 { 1483 {
@@ -1612,11 +1610,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1612static Lisp_Object 1610static Lisp_Object
1613cleanup_widget_value_tree (Lisp_Object arg) 1611cleanup_widget_value_tree (Lisp_Object arg)
1614{ 1612{
1615 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1613 free_menubar_widget_value_tree (XSAVE_POINTER (arg, 0));
1616 widget_value *wv = p->pointer;
1617
1618 free_menubar_widget_value_tree (wv);
1619
1620 return Qnil; 1614 return Qnil;
1621} 1615}
1622 1616
@@ -1832,7 +1826,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
1832 /* Make sure to free the widget_value objects we used to specify the 1826 /* Make sure to free the widget_value objects we used to specify the
1833 contents even with longjmp. */ 1827 contents even with longjmp. */
1834 record_unwind_protect (cleanup_widget_value_tree, 1828 record_unwind_protect (cleanup_widget_value_tree,
1835 make_save_value (first_wv, 0)); 1829 make_save_pointer (first_wv));
1836 1830
1837 /* Actually create and show the menu until popped down. */ 1831 /* Actually create and show the menu until popped down. */
1838 create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp); 1832 create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp);
@@ -1931,7 +1925,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
1931 if (menu) 1925 if (menu)
1932 { 1926 {
1933 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1927 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1934 record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); 1928 record_unwind_protect (pop_down_menu, make_save_pointer (menu));
1935 1929
1936 /* Display the menu. */ 1930 /* Display the menu. */
1937 gtk_widget_show_all (menu); 1931 gtk_widget_show_all (menu);
@@ -2142,7 +2136,7 @@ xdialog_show (FRAME_PTR f,
2142 /* Make sure to free the widget_value objects we used to specify the 2136 /* Make sure to free the widget_value objects we used to specify the
2143 contents even with longjmp. */ 2137 contents even with longjmp. */
2144 record_unwind_protect (cleanup_widget_value_tree, 2138 record_unwind_protect (cleanup_widget_value_tree,
2145 make_save_value (first_wv, 0)); 2139 make_save_pointer (first_wv));
2146 2140
2147 /* Actually create and show the dialog. */ 2141 /* Actually create and show the dialog. */
2148 create_and_show_dialog (f, first_wv); 2142 create_and_show_dialog (f, first_wv);
@@ -2242,11 +2236,8 @@ menu_help_callback (char const *help_string, int pane, int item)
2242static Lisp_Object 2236static Lisp_Object
2243pop_down_menu (Lisp_Object arg) 2237pop_down_menu (Lisp_Object arg)
2244{ 2238{
2245 struct Lisp_Save_Value *p1 = XSAVE_VALUE (Fcar (arg)); 2239 FRAME_PTR f = XSAVE_POINTER (arg, 0);
2246 struct Lisp_Save_Value *p2 = XSAVE_VALUE (Fcdr (arg)); 2240 XMenu *menu = XSAVE_POINTER (arg, 1);
2247
2248 FRAME_PTR f = p1->pointer;
2249 XMenu *menu = p2->pointer;
2250 2241
2251 block_input (); 2242 block_input ();
2252#ifndef MSDOS 2243#ifndef MSDOS
@@ -2488,8 +2479,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
2488#endif 2479#endif
2489 2480
2490 record_unwind_protect (pop_down_menu, 2481 record_unwind_protect (pop_down_menu,
2491 Fcons (make_save_value (f, 0), 2482 make_save_value (SAVE_TYPE_PTR_PTR, f, menu));
2492 make_save_value (menu, 0)));
2493 2483
2494 /* Help display under X won't work because XMenuActivate contains 2484 /* Help display under X won't work because XMenuActivate contains
2495 a loop that doesn't give Emacs a chance to process it. */ 2485 a loop that doesn't give Emacs a chance to process it. */