comparison src/menubar-x.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents fdefd0186b75
children e38acbeb1cae
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
1 /* Implements an elisp-programmable menubar -- X interface. 1 /* Implements an elisp-programmable menubar -- X interface.
2 Copyright (C) 1993, 1994 Free Software Foundation, Inc. 2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp. 3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
4 Copyright (C) 2000 Ben Wing. 4 Copyright (C) 2000, 2001 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 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 9 under the terms of the GNU General Public License as published by the
333 will be called with to tell it not to free the wv (as we are 333 will be called with to tell it not to free the wv (as we are
334 returning it.) */ 334 returning it.) */
335 set_opaque_ptr (wv_closure, 0); 335 set_opaque_ptr (wv_closure, 0);
336 } 336 }
337 337
338 unbind_to (count, Qnil); 338 unbind_to (count);
339 return wv; 339 return wv;
340 } 340 }
341 341
342 static widget_value * 342 static widget_value *
343 menu_item_descriptor_to_widget_value (Lisp_Object desc, 343 menu_item_descriptor_to_widget_value (Lisp_Object desc,
346 int deep_p, /* */ 346 int deep_p, /* */
347 int filter_p) /* if :filter forms 347 int filter_p) /* if :filter forms
348 should run now */ 348 should run now */
349 { 349 {
350 widget_value *wv; 350 widget_value *wv;
351 int count = specpdl_depth (); 351 int count = begin_gc_forbidden ();
352 record_unwind_protect (restore_gc_inhibit,
353 make_int (gc_currently_forbidden));
354 gc_currently_forbidden = 1;
355 /* Can't GC! */ 352 /* Can't GC! */
356 wv = menu_item_descriptor_to_widget_value_1 (desc, menu_type, deep_p, 353 wv = menu_item_descriptor_to_widget_value_1 (desc, menu_type, deep_p,
357 filter_p, 0); 354 filter_p, 0);
358 unbind_to (count, Qnil); 355 unbind_to (count);
359 return wv; 356 return wv;
360 } 357 }
361 358
362 359
363 #if defined LWLIB_MENUBARS_LUCID || defined LWLIB_MENUBARS_MOTIF 360 #if defined LWLIB_MENUBARS_LUCID || defined LWLIB_MENUBARS_MOTIF
462 record_unwind_protect (restore_in_menu_callback, 459 record_unwind_protect (restore_in_menu_callback,
463 make_int (in_menu_callback)); 460 make_int (in_menu_callback));
464 in_menu_callback = 1; 461 in_menu_callback = 1;
465 wv = menu_item_descriptor_to_widget_value (submenu_desc, SUBMENU_TYPE, 462 wv = menu_item_descriptor_to_widget_value (submenu_desc, SUBMENU_TYPE,
466 1, 0); 463 1, 0);
467 unbind_to (count, Qnil); 464 unbind_to (count);
468 465
469 if (!wv) 466 if (!wv)
470 { 467 {
471 wv = xmalloc_widget_value (); 468 wv = xmalloc_widget_value ();
472 wv->type = CASCADE_TYPE; 469 wv->type = CASCADE_TYPE;
526 523
527 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 524 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
528 Fset_buffer (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer); 525 Fset_buffer (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer);
529 data = menu_item_descriptor_to_widget_value (menubar, MENUBAR_TYPE, 526 data = menu_item_descriptor_to_widget_value (menubar, MENUBAR_TYPE,
530 deep_p, 0); 527 deep_p, 0);
531 unbind_to (count, Qnil); 528 unbind_to (count);
532 529
533 return data; 530 return data;
534 } 531 }
535 } 532 }
536 533
1153 Vmenu_accelerator_prefix = Qnil; 1150 Vmenu_accelerator_prefix = Qnil;
1154 Vmenu_accelerator_modifiers = Qnil; 1151 Vmenu_accelerator_modifiers = Qnil;
1155 Vmenu_accelerator_enabled = Qnil; 1152 Vmenu_accelerator_enabled = Qnil;
1156 if (!NILP (errordata)) 1153 if (!NILP (errordata))
1157 { 1154 {
1158 Lisp_Object args[2];
1159
1160 args[0] = build_string ("Error in menu accelerators (setting to nil)");
1161 /* #### This should call 1155 /* #### This should call
1162 (with-output-to-string (display-error errordata)) 1156 (with-output-to-string (display-error errordata))
1163 but that stuff is all in Lisp currently. */ 1157 but that stuff is all in Lisp currently. */
1164 args[1] = errordata;
1165 warn_when_safe_lispobj 1158 warn_when_safe_lispobj
1166 (Qerror, Qwarning, 1159 (Qerror, Qwarning,
1167 emacs_doprnt_string_lisp ((const Intbyte *) "%s: %s", 1160 emacs_sprintf_string_lisp
1168 Qnil, -1, 2, args)); 1161 ("%s: %s", Qnil, 2,
1162 build_msg_string ("Error in menu accelerators (setting to nil)"),
1163 errordata));
1169 } 1164 }
1170 1165
1171 return Qnil; 1166 return Qnil;
1172 } 1167 }
1173 1168