comparison src/menubar-x.c @ 438:84b14dcb0985 r21-2-27

Import from CVS: tag r21-2-27
author cvs
date Mon, 13 Aug 2007 11:32:25 +0200
parents 080151679be2
children 8de8e3f6228a
comparison
equal deleted inserted replaced
437:e2a4e8b94b82 438:84b14dcb0985
92 /* This function cannot GC. 92 /* This function cannot GC.
93 It is only called from menu_item_descriptor_to_widget_value, which 93 It is only called from menu_item_descriptor_to_widget_value, which
94 prohibits GC. */ 94 prohibits GC. */
95 /* !!#### This function has not been Mule-ized */ 95 /* !!#### This function has not been Mule-ized */
96 int menubar_root_p = (menu_type == MENUBAR_TYPE && depth == 0); 96 int menubar_root_p = (menu_type == MENUBAR_TYPE && depth == 0);
97 widget_value *wv;
98 Lisp_Object wv_closure;
99 int count = specpdl_depth (); 97 int count = specpdl_depth ();
100 int partition_seen = 0; 98 int partition_seen = 0;
101 99 widget_value *wv = xmalloc_widget_value ();
102 wv = xmalloc_widget_value (); 100 Lisp_Object wv_closure = make_opaque_ptr (wv);
103 101
104 wv_closure = make_opaque_ptr (wv);
105 record_unwind_protect (widget_value_unwind, wv_closure); 102 record_unwind_protect (widget_value_unwind, wv_closure);
106 103
107 if (STRINGP (desc)) 104 if (STRINGP (desc))
108 { 105 {
109 char *string_chars = (char *) XSTRING_DATA (desc); 106 char *string_chars = (char *) XSTRING_DATA (desc);
361 int in_menu_callback; 358 int in_menu_callback;
362 359
363 static Lisp_Object 360 static Lisp_Object
364 restore_in_menu_callback (Lisp_Object val) 361 restore_in_menu_callback (Lisp_Object val)
365 { 362 {
366 in_menu_callback = XINT(val); 363 in_menu_callback = XINT (val);
367 return Qnil; 364 return Qnil;
368 } 365 }
369 #endif /* LWLIB_MENUBARS_LUCID || LWLIB_MENUBARS_MOTIF */ 366 #endif /* LWLIB_MENUBARS_LUCID || LWLIB_MENUBARS_MOTIF */
370 367
371 #if 0 368 #if 0
512 } 509 }
513 510
514 static widget_value * 511 static widget_value *
515 compute_menubar_data (struct frame *f, Lisp_Object menubar, int deep_p) 512 compute_menubar_data (struct frame *f, Lisp_Object menubar, int deep_p)
516 { 513 {
517 widget_value *data;
518
519 if (NILP (menubar)) 514 if (NILP (menubar))
520 data = 0; 515 return 0;
521 else 516 else
522 { 517 {
523 Lisp_Object old_buffer; 518 widget_value *data;
524 int count = specpdl_depth (); 519 int count = specpdl_depth ();
525 520
526 old_buffer = Fcurrent_buffer (); 521 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
527 record_unwind_protect (Fset_buffer, old_buffer); 522 Fset_buffer (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer);
528 Fset_buffer ( XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer);
529 data = menu_item_descriptor_to_widget_value (menubar, MENUBAR_TYPE, 523 data = menu_item_descriptor_to_widget_value (menubar, MENUBAR_TYPE,
530 deep_p, 0); 524 deep_p, 0);
531 Fset_buffer (old_buffer);
532 unbind_to (count, Qnil); 525 unbind_to (count, Qnil);
533 } 526
534 return data; 527 return data;
528 }
535 } 529 }
536 530
537 static int 531 static int
538 set_frame_menubar (struct frame *f, int deep_p, int first_time_p) 532 set_frame_menubar (struct frame *f, int deep_p, int first_time_p)
539 { 533 {
540 widget_value *data; 534 widget_value *data;
541 Lisp_Object menubar; 535 Lisp_Object menubar;
542 int menubar_visible; 536 int menubar_visible;
543 long id; 537 long id;
544 /* As for the toolbar, the minibuffer does not have its own menubar. */ 538 /* As with the toolbar, the minibuffer does not have its own menubar. */
545 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f)); 539 struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
546 540
547 if (! FRAME_X_P (f)) 541 if (! FRAME_X_P (f))
548 return 0; 542 return 0;
549 543
691 685
692 XtSetArg (al [0], XtNx, &shellx); 686 XtSetArg (al [0], XtNx, &shellx);
693 XtSetArg (al [1], XtNy, &shelly); 687 XtSetArg (al [1], XtNy, &shelly);
694 XtGetValues (shell, al, 2); 688 XtGetValues (shell, al, 2);
695 } 689 }
696 #endif 690 #endif
697 XtSetArg (al [0], XtNx, &framex); 691 XtSetArg (al [0], XtNx, &framex);
698 XtSetArg (al [1], XtNy, &framey); 692 XtSetArg (al [1], XtNy, &framey);
699 XtGetValues (daddy, al, 2); 693 XtGetValues (daddy, al, 2);
700 btn->x_root = shellx + framex + btn->x; 694 btn->x_root = shellx + framex + btn->x;
701 btn->y_root = shelly + framey + btn->y; 695 btn->y_root = shelly + framey + btn->y;