aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-05-21 18:09:43 +0000
committerRichard M. Stallman1996-05-21 18:09:43 +0000
commitfdc12c4dcae21c92656663ec5871764355443ca8 (patch)
treea5c2003c3c1cd29eeb97c76970055b88762dd9cd /src
parent5ae3ca1cf10492f933bcaff739506a5c54193bc7 (diff)
downloademacs-fdc12c4dcae21c92656663ec5871764355443ca8.tar.gz
emacs-fdc12c4dcae21c92656663ec5871764355443ca8.zip
Include buffer.h.
(set_frame_menubar): Make sure input is unblocked when we call create_menu_items. Switch temporarily to proper buffer, bind inhibit-quit to t, and run the same hooks as in smenu.c. (syms_of_win32menu): Initialize and staticpro Qdebug_on_next_call.
Diffstat (limited to 'src')
-rw-r--r--src/w32menu.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/w32menu.c b/src/w32menu.c
index 3e63fd9acde..eb6b18fa21d 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA. */
30#include "window.h" 30#include "window.h"
31#include "keyboard.h" 31#include "keyboard.h"
32#include "blockinput.h" 32#include "blockinput.h"
33#include "buffer.h"
33 34
34/* This may include sys/types.h, and that somehow loses 35/* This may include sys/types.h, and that somehow loses
35 if this is not done before the other system files. */ 36 if this is not done before the other system files. */
@@ -53,9 +54,18 @@ typedef struct menu_map
53 int menu_items_used; 54 int menu_items_used;
54} menu_map; 55} menu_map;
55 56
57Lisp_Object Qdebug_on_next_call;
58
56extern Lisp_Object Qmenu_enable; 59extern Lisp_Object Qmenu_enable;
57extern Lisp_Object Qmenu_bar; 60extern Lisp_Object Qmenu_bar;
58 61
62extern Lisp_Object Voverriding_local_map;
63extern Lisp_Object Voverriding_local_map_menu_flag;
64
65extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
66
67extern Lisp_Object Qmenu_bar_update_hook;
68
59static Lisp_Object win32_dialog_show (); 69static Lisp_Object win32_dialog_show ();
60static Lisp_Object win32menu_show (); 70static Lisp_Object win32menu_show ();
61 71
@@ -1384,12 +1394,40 @@ set_frame_menubar (f, first_time)
1384 int i; 1394 int i;
1385 struct gcpro gcpro1; 1395 struct gcpro gcpro1;
1386 menu_map mm; 1396 menu_map mm;
1397 int count = specpdl_ptr - specpdl;
1398
1399 struct buffer *prev = current_buffer;
1400 Lisp_Object buffer;
1401
1402 buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer;
1403 specbind (Qinhibit_quit, Qt);
1404 /* Don't let the debugger step into this code
1405 because it is not reentrant. */
1406 specbind (Qdebug_on_next_call, Qnil);
1407
1408 record_unwind_protect (Fstore_match_data, Fmatch_data ());
1409 if (NILP (Voverriding_local_map_menu_flag))
1410 {
1411 specbind (Qoverriding_terminal_local_map, Qnil);
1412 specbind (Qoverriding_local_map, Qnil);
1413 }
1414
1415 set_buffer_internal_1 (XBUFFER (buffer));
1416
1417 /* Run the Lucid hook. */
1418 call1 (Vrun_hooks, Qactivate_menubar_hook);
1419 /* If it has changed current-menubar from previous value,
1420 really recompute the menubar from the value. */
1421 if (! NILP (Vlucid_menu_bar_dirty_flag))
1422 call0 (Qrecompute_lucid_menubar);
1423 safe_run_hooks (Qmenu_bar_update_hook);
1387 1424
1388 BLOCK_INPUT; 1425 BLOCK_INPUT;
1389 1426
1390 GCPRO1 (items); 1427 GCPRO1 (items);
1391 1428
1392 if (NILP (items = FRAME_MENU_BAR_ITEMS (f))) 1429 items = FRAME_MENU_BAR_ITEMS (f);
1430 if (NILP (items))
1393 items = FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); 1431 items = FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
1394 1432
1395 hmenu = CreateMenu (); 1433 hmenu = CreateMenu ();
@@ -1397,6 +1435,7 @@ set_frame_menubar (f, first_time)
1397 if (!hmenu) goto error; 1435 if (!hmenu) goto error;
1398 1436
1399 discard_menu_items (&mm); 1437 discard_menu_items (&mm);
1438 UNBLOCK_INPUT;
1400 1439
1401 for (i = 0; i < XVECTOR (items)->size; i += 4) 1440 for (i = 0; i < XVECTOR (items)->size; i += 4)
1402 { 1441 {
@@ -1409,6 +1448,8 @@ set_frame_menubar (f, first_time)
1409 if (NILP (string)) 1448 if (NILP (string))
1410 break; 1449 break;
1411 1450
1451 /* Input must not be blocked here
1452 because we call general Lisp code and internal_condition_case_1. */
1412 new_hmenu = create_menu_items (&mm, 1453 new_hmenu = create_menu_items (&mm,
1413 XVECTOR (items)->contents[i + 2], 1454 XVECTOR (items)->contents[i + 2],
1414 0); 1455 0);
@@ -1416,10 +1457,13 @@ set_frame_menubar (f, first_time)
1416 if (!new_hmenu) 1457 if (!new_hmenu)
1417 continue; 1458 continue;
1418 1459
1460 BLOCK_INPUT;
1419 AppendMenu (hmenu, MF_POPUP, (UINT)new_hmenu, 1461 AppendMenu (hmenu, MF_POPUP, (UINT)new_hmenu,
1420 (char *) XSTRING (string)->data); 1462 (char *) XSTRING (string)->data);
1463 UNBLOCK_INPUT;
1421 } 1464 }
1422 1465
1466 BLOCK_INPUT;
1423 { 1467 {
1424 HMENU old = GetMenu (FRAME_WIN32_WINDOW (f)); 1468 HMENU old = GetMenu (FRAME_WIN32_WINDOW (f));
1425 SetMenu (FRAME_WIN32_WINDOW (f), hmenu); 1469 SetMenu (FRAME_WIN32_WINDOW (f), hmenu);
@@ -1427,8 +1471,10 @@ set_frame_menubar (f, first_time)
1427 } 1471 }
1428 1472
1429 error: 1473 error:
1474 set_buffer_internal_1 (prev);
1430 UNGCPRO; 1475 UNGCPRO;
1431 UNBLOCK_INPUT; 1476 UNBLOCK_INPUT;
1477 unbind_to (count, Qnil);
1432} 1478}
1433 1479
1434void 1480void
@@ -1913,6 +1959,9 @@ win32_dialog_show (f, menubarp, keymaps, title, error)
1913 1959
1914syms_of_win32menu () 1960syms_of_win32menu ()
1915{ 1961{
1962 Qdebug_on_next_call = intern ("debug-on-next-call");
1963 staticpro (&Qdebug_on_next_call);
1964
1916 defsubr (&Sx_popup_menu); 1965 defsubr (&Sx_popup_menu);
1917 defsubr (&Sx_popup_dialog); 1966 defsubr (&Sx_popup_dialog);
1918} 1967}