Mercurial > hg > xemacs-beta
comparison src/menubar-x.c @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | ac2d302a0011 |
children | 441bb1e64a06 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
80 sleaziest thing possible and inhibit GC for the duration. This is probably | 80 sleaziest thing possible and inhibit GC for the duration. This is probably |
81 not a big deal... | 81 not a big deal... |
82 | 82 |
83 We do not have to worry about the pointers to Lisp_String data after | 83 We do not have to worry about the pointers to Lisp_String data after |
84 this function successfully finishes. lwlib copies all such data with | 84 this function successfully finishes. lwlib copies all such data with |
85 strdup(). | 85 strdup(). */ |
86 | |
87 */ | |
88 | 86 |
89 static widget_value * | 87 static widget_value * |
90 menu_item_descriptor_to_widget_value_1 (Lisp_Object desc, | 88 menu_item_descriptor_to_widget_value_1 (Lisp_Object desc, |
91 int menu_type, int deep_p, | 89 int menu_type, int deep_p, |
92 int filter_p, | 90 int filter_p, |
107 wv_closure = make_opaque_ptr (wv); | 105 wv_closure = make_opaque_ptr (wv); |
108 record_unwind_protect (widget_value_unwind, wv_closure); | 106 record_unwind_protect (widget_value_unwind, wv_closure); |
109 | 107 |
110 if (STRINGP (desc)) | 108 if (STRINGP (desc)) |
111 { | 109 { |
112 char *string_chars = (char *) string_data (XSTRING (desc)); | 110 char *string_chars = (char *) XSTRING_DATA (desc); |
113 wv->type = (separator_string_p (string_chars) ? SEPARATOR_TYPE : | 111 wv->type = (separator_string_p (string_chars) ? SEPARATOR_TYPE : |
114 TEXT_TYPE); | 112 TEXT_TYPE); |
115 #if 1 | 113 #if 1 |
116 /* #### - should internationalize with X resources instead. | 114 /* #### - should internationalize with X resources instead. |
117 Not so! --ben */ | 115 Not so! --ben */ |
148 Lisp_Object key, val; | 146 Lisp_Object key, val; |
149 Lisp_Object include_p, hook_fn = Qnil, config_tag = Qnil; | 147 Lisp_Object include_p, hook_fn = Qnil, config_tag = Qnil; |
150 int included_spec = 0; | 148 int included_spec = 0; |
151 wv->type = CASCADE_TYPE; | 149 wv->type = CASCADE_TYPE; |
152 wv->enabled = 1; | 150 wv->enabled = 1; |
153 wv->name = | 151 wv->name = (char *) XSTRING_DATA (LISP_GETTEXT (XCAR (desc))); |
154 (char *) string_data (XSTRING (LISP_GETTEXT (XCAR (desc)))); | |
155 desc = Fcdr (desc); | 152 desc = Fcdr (desc); |
156 | 153 |
157 while (key = Fcar (desc), KEYWORDP (key)) | 154 while (key = Fcar (desc), KEYWORDP (key)) |
158 { | 155 { |
159 Lisp_Object cascade = desc; | 156 Lisp_Object cascade = desc; |
203 the call to lw_map_widget_values(); no need | 200 the call to lw_map_widget_values(); no need |
204 to worry. */ | 201 to worry. */ |
205 incr_wv->call_data = LISP_TO_VOID (incremental_data); | 202 incr_wv->call_data = LISP_TO_VOID (incremental_data); |
206 goto menu_item_done; | 203 goto menu_item_done; |
207 } | 204 } |
208 #endif | 205 #endif /* LWLIB_MENUBARS_LUCID */ |
209 } | 206 } |
210 if (menu_type == POPUP_TYPE && popup_menu_titles && depth == 0) | 207 if (menu_type == POPUP_TYPE && popup_menu_titles && depth == 0) |
211 { | 208 { |
212 /* Simply prepend three more widget values to the contents of | 209 /* Simply prepend three more widget values to the contents of |
213 the menu: a label, and two separators (to get a double | 210 the menu: a label, and two separators (to get a double |
254 next = xmalloc_widget_value (); | 251 next = xmalloc_widget_value (); |
255 next->type = PUSHRIGHT_TYPE; | 252 next->type = PUSHRIGHT_TYPE; |
256 } | 253 } |
257 else | 254 else |
258 { | 255 { |
259 next = menu_item_descriptor_to_widget_value_1 (child, | 256 next = menu_item_descriptor_to_widget_value_1 |
260 menu_type, | 257 (child, menu_type, deep_p, filter_p, depth + 1); |
261 deep_p, | |
262 filter_p, | |
263 depth + 1); | |
264 } | 258 } |
265 if (! next) | 259 if (! next) |
266 continue; | 260 continue; |
267 else if (prev) | 261 else if (prev) |
268 prev->next = next; | 262 prev->next = next; |
340 /* This function can GC */ | 334 /* This function can GC */ |
341 struct gcpro gcpro1; | 335 struct gcpro gcpro1; |
342 struct device *d = get_device_from_display (XtDisplay (widget)); | 336 struct device *d = get_device_from_display (XtDisplay (widget)); |
343 struct frame *f = x_any_window_to_frame (d, XtWindow (widget)); | 337 struct frame *f = x_any_window_to_frame (d, XtWindow (widget)); |
344 Lisp_Object rest = Qnil; | 338 Lisp_Object rest = Qnil; |
339 Lisp_Object frame; | |
345 int any_changes = 0; | 340 int any_changes = 0; |
346 | 341 |
347 if (!f) | 342 if (!f) |
348 f = x_any_window_to_frame (d, XtWindow (XtParent (widget))); | 343 f = x_any_window_to_frame (d, XtWindow (XtParent (widget))); |
349 if (!f) | 344 if (!f) |
350 return; | 345 return; |
346 | |
347 /* make sure f is the selected frame */ | |
348 XSETFRAME (frame, f); | |
349 Fselect_frame (frame); | |
351 | 350 |
352 if (client_data) | 351 if (client_data) |
353 { | 352 { |
354 /* this is an incremental menu construction callback */ | 353 /* this is an incremental menu construction callback */ |
355 widget_value *hack_wv = (widget_value *) client_data; | 354 widget_value *hack_wv = (widget_value *) client_data; |
437 | 436 |
438 if (NILP (menubar)) | 437 if (NILP (menubar)) |
439 data = 0; | 438 data = 0; |
440 else | 439 else |
441 { | 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); | |
442 data = menu_item_descriptor_to_widget_value (menubar, MENUBAR_TYPE, | 447 data = menu_item_descriptor_to_widget_value (menubar, MENUBAR_TYPE, |
443 deep_p, 0); | 448 deep_p, 0); |
444 #ifdef ENERGIZE | 449 #ifdef ENERGIZE |
445 if (data) | 450 if (data) |
446 set_panel_button_sensitivity (f, data); | 451 set_panel_button_sensitivity (f, data); |
447 #endif | 452 #endif |
453 Fset_buffer (old_buffer); | |
454 unbind_to (count, Qnil); | |
448 } | 455 } |
449 return data; | 456 return data; |
450 } | 457 } |
451 | 458 |
452 static int | 459 static int |