comparison src/menubar-x.c @ 82:6a378aca36af r20-0b91

Import from CVS: tag r20-0b91
author cvs
date Mon, 13 Aug 2007 09:07:36 +0200
parents 131b0175ea99
children a145efe76779
comparison
equal deleted inserted replaced
81:ebca3d831cea 82:6a378aca36af
334 /* This function can GC */ 334 /* This function can GC */
335 struct gcpro gcpro1; 335 struct gcpro gcpro1;
336 struct device *d = get_device_from_display (XtDisplay (widget)); 336 struct device *d = get_device_from_display (XtDisplay (widget));
337 struct frame *f = x_any_window_to_frame (d, XtWindow (widget)); 337 struct frame *f = x_any_window_to_frame (d, XtWindow (widget));
338 Lisp_Object rest = Qnil; 338 Lisp_Object rest = Qnil;
339 Lisp_Object frame;
339 int any_changes = 0; 340 int any_changes = 0;
340 341
341 if (!f) 342 if (!f)
342 f = x_any_window_to_frame (d, XtWindow (XtParent (widget))); 343 f = x_any_window_to_frame (d, XtWindow (XtParent (widget)));
343 if (!f) 344 if (!f)
344 return; 345 return;
346
347 /* make sure f is the selected frame */
348 XSETFRAME (frame, f);
349 Fselect_frame (frame);
345 350
346 if (client_data) 351 if (client_data)
347 { 352 {
348 /* this is an incremental menu construction callback */ 353 /* this is an incremental menu construction callback */
349 widget_value *hack_wv = (widget_value *) client_data; 354 widget_value *hack_wv = (widget_value *) client_data;
431 436
432 if (NILP (menubar)) 437 if (NILP (menubar))
433 data = 0; 438 data = 0;
434 else 439 else
435 { 440 {
441 Lisp_Object old_buffer;
442 int count = specpdl_depth ();
443
444 old_buffer = Fcurrent_buffer ();
445 record_unwind_protect (Fset_buffer, old_buffer);
446 Fset_buffer ( XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer);
436 data = menu_item_descriptor_to_widget_value (menubar, MENUBAR_TYPE, 447 data = menu_item_descriptor_to_widget_value (menubar, MENUBAR_TYPE,
437 deep_p, 0); 448 deep_p, 0);
438 #ifdef ENERGIZE 449 #ifdef ENERGIZE
439 if (data) 450 if (data)
440 set_panel_button_sensitivity (f, data); 451 set_panel_button_sensitivity (f, data);
441 #endif 452 #endif
453 Fset_buffer (old_buffer);
454 unbind_to (count, Qnil);
442 } 455 }
443 return data; 456 return data;
444 } 457 }
445 458
446 static int 459 static int