0
|
1 /* General GUI code -- X-specific. (menubars, scrollbars, toolbars, dialogs)
|
|
2 Copyright (C) 1995 Board of Trustees, University of Illinois.
|
|
3 Copyright (C) 1995, 1996 Ben Wing.
|
|
4 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
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
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 #include <config.h>
|
|
26 #include "lisp.h"
|
|
27
|
|
28 #include "console-x.h"
|
|
29 #ifdef LWLIB_USES_MOTIF
|
|
30 #include <Xm/Xm.h> /* for XmVersion */
|
|
31 #endif
|
|
32 #include "gui-x.h"
|
|
33 #include "buffer.h"
|
|
34 #include "device.h"
|
|
35 #include "frame.h"
|
231
|
36 #include "gui.h"
|
0
|
37 #include "opaque.h"
|
|
38
|
|
39 #ifdef HAVE_POPUPS
|
|
40 Lisp_Object Qmenu_no_selection_hook;
|
|
41 #endif
|
|
42
|
|
43 /* we need a unique id for each popup menu, dialog box, and scrollbar */
|
|
44 static unsigned int lwlib_id_tick;
|
|
45
|
|
46 LWLIB_ID new_lwlib_id (void);
|
|
47 LWLIB_ID
|
|
48 new_lwlib_id (void)
|
|
49 {
|
|
50 return ++lwlib_id_tick;
|
|
51 }
|
|
52
|
|
53 widget_value *
|
|
54 xmalloc_widget_value (void)
|
|
55 {
|
|
56 widget_value *tmp = malloc_widget_value ();
|
|
57 if (!tmp) memory_full ();
|
|
58 return tmp;
|
|
59 }
|
|
60
|
|
61
|
|
62 #ifdef HAVE_POPUPS
|
|
63 static Lisp_Object mark_popup_data (Lisp_Object obj,
|
|
64 void (*markobj) (Lisp_Object));
|
|
65 DEFINE_LRECORD_IMPLEMENTATION ("popup-data", popup_data,
|
|
66 mark_popup_data, internal_object_printer,
|
|
67 0, 0, 0, struct popup_data);
|
|
68
|
|
69 struct mark_widget_value_closure
|
|
70 {
|
|
71 void (*markobj) (Lisp_Object);
|
|
72 };
|
|
73
|
|
74 static int
|
|
75 mark_widget_value_mapper (widget_value *val, void *closure)
|
|
76 {
|
|
77 Lisp_Object markee;
|
|
78
|
|
79 struct mark_widget_value_closure *cl =
|
|
80 (struct mark_widget_value_closure *) closure;
|
|
81 if (val->call_data)
|
|
82 {
|
|
83 VOID_TO_LISP (markee, val->call_data);
|
|
84 (cl->markobj) (markee);
|
|
85 }
|
|
86
|
175
|
87 if (val->accel)
|
|
88 {
|
|
89 VOID_TO_LISP (markee, val->accel);
|
|
90 (cl->markobj) (markee);
|
|
91 }
|
0
|
92 return 0;
|
|
93 }
|
|
94
|
|
95 static Lisp_Object
|
|
96 mark_popup_data (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
97 {
|
|
98 struct popup_data *data = (struct popup_data *) XPOPUP_DATA (obj);
|
|
99
|
|
100 /* Now mark the callbacks and such that are hidden in the lwlib
|
|
101 call-data */
|
|
102
|
|
103 if (data->id)
|
|
104 {
|
|
105 struct mark_widget_value_closure closure;
|
|
106
|
|
107 closure.markobj = markobj;
|
|
108 lw_map_widget_values (data->id, mark_widget_value_mapper, &closure);
|
|
109 }
|
173
|
110
|
|
111 return data->last_menubar_buffer;
|
0
|
112 }
|
|
113
|
|
114 /* This is like FRAME_MENUBAR_DATA (f), but contains an alist of
|
|
115 (id . popup-data) for GCPRO'ing the callbacks of the popup menus
|
|
116 and dialog boxes. */
|
|
117 static Lisp_Object Vpopup_callbacks;
|
|
118
|
|
119 void
|
|
120 gcpro_popup_callbacks (LWLIB_ID id)
|
|
121 {
|
|
122 struct popup_data *pdata;
|
|
123 Lisp_Object lid = make_int (id);
|
|
124 Lisp_Object lpdata = Qnil;
|
|
125
|
|
126 assert (NILP (assq_no_quit (lid, Vpopup_callbacks)));
|
185
|
127 pdata = alloc_lcrecord_type (struct popup_data, lrecord_popup_data);
|
0
|
128 pdata->id = id;
|
|
129 pdata->last_menubar_buffer = Qnil;
|
|
130 pdata->menubar_contents_up_to_date = 0;
|
|
131 XSETPOPUP_DATA (lpdata, pdata);
|
|
132 Vpopup_callbacks = Fcons (Fcons (lid, lpdata), Vpopup_callbacks);
|
|
133 }
|
|
134
|
|
135 void
|
|
136 ungcpro_popup_callbacks (LWLIB_ID id)
|
|
137 {
|
|
138 Lisp_Object lid = make_int (id);
|
|
139 Lisp_Object this = assq_no_quit (lid, Vpopup_callbacks);
|
|
140 assert (!NILP (this));
|
|
141 Vpopup_callbacks = delq_no_quit (this, Vpopup_callbacks);
|
|
142 }
|
|
143
|
|
144 int
|
|
145 popup_handled_p (LWLIB_ID id)
|
|
146 {
|
173
|
147 return NILP (assq_no_quit (make_int (id), Vpopup_callbacks));
|
0
|
148 }
|
|
149
|
|
150 /* menu_item_descriptor_to_widget_value() et al. mallocs a
|
|
151 widget_value, but then may signal lisp errors. If an error does
|
|
152 not occur, the opaque ptr we have here has had its pointer set to 0
|
|
153 to tell us not to do anything. Otherwise we free the widget value.
|
|
154 (This has nothing to do with GC, it's just about not dropping
|
|
155 pointers to malloc'd data when errors happen.) */
|
|
156
|
|
157 Lisp_Object
|
|
158 widget_value_unwind (Lisp_Object closure)
|
|
159 {
|
|
160 widget_value *wv = (widget_value *) get_opaque_ptr (closure);
|
|
161 free_opaque_ptr (closure);
|
|
162 if (wv)
|
|
163 free_widget_value (wv);
|
|
164 return Qnil;
|
|
165 }
|
|
166
|
|
167 #if 0
|
|
168 static void
|
|
169 print_widget_value (widget_value *wv, int depth)
|
|
170 {
|
|
171 /* !!#### This function has not been Mule-ized */
|
|
172 char d [200];
|
|
173 int i;
|
|
174 for (i = 0; i < depth; i++) d[i] = ' ';
|
|
175 d[depth]=0;
|
|
176 /* #### - print type field */
|
|
177 printf ("%sname: %s\n", d, (wv->name ? wv->name : "(null)"));
|
|
178 if (wv->value) printf ("%svalue: %s\n", d, wv->value);
|
|
179 if (wv->key) printf ("%skey: %s\n", d, wv->key);
|
|
180 printf ("%senabled: %d\n", d, wv->enabled);
|
|
181 if (wv->contents)
|
|
182 {
|
|
183 printf ("\n%scontents: \n", d);
|
|
184 print_widget_value (wv->contents, depth + 5);
|
|
185 }
|
|
186 if (wv->next)
|
|
187 {
|
|
188 printf ("\n");
|
|
189 print_widget_value (wv->next, depth);
|
|
190 }
|
|
191 }
|
|
192 #endif
|
|
193
|
|
194 /* This recursively calls free_widget_value() on the tree of widgets.
|
|
195 It must free all data that was malloc'ed for these widget_values.
|
|
196
|
|
197 It used to be that emacs only allocated new storage for the `key' slot.
|
|
198 All other slots are pointers into the data of Lisp_Strings, and must be
|
|
199 left alone. */
|
|
200 void
|
|
201 free_popup_widget_value_tree (widget_value *wv)
|
|
202 {
|
|
203 if (! wv) return;
|
|
204 if (wv->key) xfree (wv->key);
|
|
205 if (wv->value) xfree (wv->value);
|
|
206
|
|
207 wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
|
|
208
|
|
209 if (wv->contents && (wv->contents != (widget_value*)1))
|
|
210 {
|
|
211 free_popup_widget_value_tree (wv->contents);
|
|
212 wv->contents = (widget_value *) 0xDEADBEEF;
|
|
213 }
|
|
214 if (wv->next)
|
|
215 {
|
|
216 free_popup_widget_value_tree (wv->next);
|
|
217 wv->next = (widget_value *) 0xDEADBEEF;
|
|
218 }
|
|
219 free_widget_value (wv);
|
|
220 }
|
|
221
|
|
222 /* The following is actually called from somewhere within XtDispatchEvent(),
|
|
223 called from XtAppProcessEvent() in event-Xt.c */
|
|
224
|
|
225 void
|
|
226 popup_selection_callback (Widget widget, LWLIB_ID ignored_id,
|
|
227 XtPointer client_data)
|
|
228 {
|
|
229 Lisp_Object fn, arg;
|
|
230 Lisp_Object data;
|
|
231 Lisp_Object frame = Qnil;
|
|
232 struct device *d = get_device_from_display (XtDisplay (widget));
|
|
233 struct frame *f = x_any_widget_or_parent_to_frame (d, widget);
|
|
234
|
175
|
235 /* set in lwlib to the time stamp associated with the most recent menu
|
|
236 operation */
|
|
237 extern Time x_focus_timestamp_really_sucks_fix_me_better;
|
|
238
|
0
|
239 if (!f)
|
|
240 return;
|
|
241 if (((EMACS_INT) client_data) == 0)
|
|
242 return;
|
|
243 VOID_TO_LISP (data, client_data);
|
|
244 XSETFRAME (frame, f);
|
|
245
|
|
246 #if 0
|
|
247 /* #### What the hell? I can't understand why this call is here,
|
|
248 and doing it is really courting disaster in the new event
|
|
249 model, since popup_selection_callback is called from
|
|
250 within next_event_internal() and Faccept_process_output()
|
|
251 itself calls next_event_internal(). --Ben */
|
|
252
|
|
253 /* Flush the X and process input */
|
|
254 Faccept_process_output (Qnil, Qnil, Qnil);
|
|
255 #endif
|
|
256
|
|
257 if (((EMACS_INT) client_data) == -1)
|
|
258 {
|
|
259 fn = Qrun_hooks;
|
|
260 arg = Qmenu_no_selection_hook;
|
|
261 }
|
|
262 else if (SYMBOLP (data))
|
|
263 {
|
|
264 fn = Qcall_interactively;
|
|
265 arg = data;
|
|
266 }
|
|
267 else if (CONSP (data))
|
|
268 {
|
|
269 fn = Qeval;
|
|
270 arg = data;
|
|
271 }
|
|
272 else
|
|
273 {
|
|
274 fn = Qeval;
|
|
275 arg = list3 (Qsignal,
|
|
276 list2 (Qquote, Qerror),
|
|
277 list2 (Qquote, list2 (build_translated_string
|
|
278 ("illegal popup callback"),
|
|
279 data)));
|
|
280 }
|
|
281
|
|
282 /* This is the timestamp used for asserting focus so we need to get an
|
|
283 up-to-date value event if no events has been dispatched to emacs
|
|
284 */
|
179
|
285 #if defined(HAVE_MENUBARS)
|
175
|
286 DEVICE_X_MOUSE_TIMESTAMP (d) = x_focus_timestamp_really_sucks_fix_me_better;
|
177
|
287 #else
|
|
288 DEVICE_X_MOUSE_TIMESTAMP (d) = DEVICE_X_GLOBAL_MOUSE_TIMESTAMP (d);
|
|
289 #endif
|
0
|
290 signal_special_Xt_user_event (frame, fn, arg);
|
|
291 }
|
|
292
|
|
293 #if 1
|
|
294 /* Eval the activep slot of the menu item */
|
|
295 # define wv_set_evalable_slot(slot,form) \
|
|
296 do { Lisp_Object _f_ = (form); \
|
|
297 slot = (NILP (_f_) ? 0 : \
|
|
298 EQ (_f_, Qt) ? 1 : \
|
|
299 !NILP (Feval (_f_))); \
|
|
300 } while (0)
|
|
301 #else
|
|
302 /* Treat the activep slot of the menu item as a boolean */
|
|
303 # define wv_set_evalable_slot(slot,form) \
|
|
304 slot = (!NILP ((form)))
|
|
305 #endif
|
|
306
|
|
307 char *
|
|
308 menu_separator_style (CONST char *s)
|
|
309 {
|
|
310 CONST char *p;
|
|
311 char first;
|
|
312
|
|
313 if (!s || s[0] == '\0')
|
|
314 return NULL;
|
|
315 first = s[0];
|
|
316 if (first != '-' && first != '=')
|
|
317 return NULL;
|
|
318 for (p = s; *p == first; p++);
|
|
319
|
|
320 /* #### - cannot currently specify a separator tag "--!tag" and a
|
|
321 separator style "--:style" at the same time. */
|
|
322 /* #### - Also, the motif menubar code doesn't deal with the
|
|
323 double etched style yet, so it's not good to get into the habit of
|
|
324 using "===" in menubars to get double-etched lines */
|
|
325 if (*p == '!' || *p == '\0')
|
|
326 return ((first == '-')
|
|
327 ? NULL /* single etched is the default */
|
|
328 : xstrdup ("shadowDoubleEtchedIn"));
|
|
329 else if (*p == ':')
|
|
330 return xstrdup (p+1);
|
173
|
331
|
0
|
332 return NULL;
|
|
333 }
|
|
334
|
175
|
335 /* set menu accelerator key to first underlined character in menu name */
|
|
336
|
|
337 Lisp_Object
|
|
338 menu_name_to_accelerator (char *name)
|
|
339 {
|
|
340 while (*name) {
|
|
341 if (*name=='%') {
|
|
342 ++name;
|
|
343 if (!(*name))
|
|
344 return Qnil;
|
|
345 if (*name=='_'&&*(name+1))
|
|
346 return make_char (tolower(*(name+1)));
|
|
347 }
|
|
348 ++name;
|
|
349 }
|
|
350 return Qnil;
|
|
351 }
|
|
352
|
0
|
353 /* This does the dirty work. gc_currently_forbidden is 1 when this is called.
|
|
354 */
|
|
355
|
|
356 int
|
|
357 button_item_to_widget_value (Lisp_Object desc, widget_value *wv,
|
|
358 int allow_text_field_p, int no_keys_p)
|
|
359 {
|
|
360 /* !!#### This function has not been Mule-ized */
|
|
361 /* This function cannot GC because gc_currently_forbidden is set when
|
|
362 it's called */
|
2
|
363 Lisp_Object name = Qnil;
|
|
364 Lisp_Object callback = Qnil;
|
|
365 Lisp_Object suffix = Qnil;
|
|
366 Lisp_Object active_p = Qt;
|
|
367 Lisp_Object include_p = Qt;
|
0
|
368 Lisp_Object selected_p = Qnil;
|
2
|
369 Lisp_Object keys = Qnil;
|
|
370 Lisp_Object style = Qnil;
|
0
|
371 Lisp_Object config_tag = Qnil;
|
175
|
372 Lisp_Object accel = Qnil;
|
173
|
373 int length = XVECTOR_LENGTH (desc);
|
|
374 Lisp_Object *contents = XVECTOR_DATA (desc);
|
0
|
375 int plist_p;
|
|
376 int selected_spec = 0, included_spec = 0;
|
|
377
|
|
378 if (length < 3)
|
|
379 signal_simple_error ("button descriptors must be at least 3 long", desc);
|
|
380
|
|
381 /* length 3: [ "name" callback active-p ]
|
|
382 length 4: [ "name" callback active-p suffix ]
|
|
383 or [ "name" callback keyword value ]
|
|
384 length 5+: [ "name" callback [ keyword value ]+ ]
|
|
385 */
|
|
386 plist_p = (length >= 5 || KEYWORDP (contents [2]));
|
|
387
|
|
388 if (!plist_p)
|
|
389 /* the old way */
|
|
390 {
|
|
391 name = contents [0];
|
|
392 callback = contents [1];
|
|
393 active_p = contents [2];
|
|
394 if (length == 4)
|
|
395 suffix = contents [3];
|
|
396 }
|
|
397 else
|
|
398 {
|
|
399 /* the new way */
|
|
400 int i;
|
|
401 if (length & 1)
|
|
402 signal_simple_error (
|
|
403 "button descriptor has an odd number of keywords and values",
|
|
404 desc);
|
|
405
|
|
406 name = contents [0];
|
|
407 callback = contents [1];
|
|
408 for (i = 2; i < length;)
|
|
409 {
|
|
410 Lisp_Object key = contents [i++];
|
|
411 Lisp_Object val = contents [i++];
|
|
412 if (!KEYWORDP (key))
|
|
413 signal_simple_error_2 ("not a keyword", key, desc);
|
|
414
|
2
|
415 if (EQ (key, Q_active)) active_p = val;
|
|
416 else if (EQ (key, Q_suffix)) suffix = val;
|
|
417 else if (EQ (key, Q_keys)) keys = val;
|
|
418 else if (EQ (key, Q_style)) style = val;
|
0
|
419 else if (EQ (key, Q_selected)) selected_p = val, selected_spec = 1;
|
2
|
420 else if (EQ (key, Q_included)) include_p = val, included_spec = 1;
|
0
|
421 else if (EQ (key, Q_config)) config_tag = val;
|
175
|
422 else if (EQ (key, Q_accelerator))
|
|
423 {
|
|
424 if ( SYMBOLP (val)
|
|
425 || CHARP (val))
|
|
426 accel = val;
|
|
427 else
|
|
428 signal_simple_error ("bad keyboard accelerator", val);
|
|
429 }
|
0
|
430 else if (EQ (key, Q_filter))
|
|
431 signal_simple_error(":filter keyword not permitted on leaf nodes", desc);
|
173
|
432 else
|
0
|
433 signal_simple_error_2 ("unknown menu item keyword", key, desc);
|
|
434 }
|
|
435 }
|
|
436
|
|
437 #ifdef HAVE_MENUBARS
|
|
438 if ((!NILP (config_tag) && NILP (Fmemq (config_tag, Vmenubar_configuration)))
|
|
439 || (included_spec && NILP (Feval (include_p))))
|
|
440 {
|
|
441 /* the include specification says to ignore this item. */
|
|
442 return 0;
|
|
443 }
|
16
|
444 #endif /* HAVE_MENUBARS */
|
0
|
445
|
|
446 CHECK_STRING (name);
|
14
|
447 wv->name = (char *) XSTRING_DATA (name);
|
0
|
448
|
175
|
449 if (NILP (accel))
|
|
450 accel = menu_name_to_accelerator (wv->name);
|
|
451 wv->accel = LISP_TO_VOID (accel);
|
185
|
452
|
0
|
453 if (!NILP (suffix))
|
|
454 {
|
|
455 CONST char *const_bogosity;
|
|
456 CHECK_STRING (suffix);
|
2
|
457 GET_C_STRING_FILENAME_DATA_ALLOCA (suffix, const_bogosity);
|
0
|
458 wv->value = (char *) const_bogosity;
|
|
459 wv->value = xstrdup (wv->value);
|
|
460 }
|
|
461
|
|
462 wv_set_evalable_slot (wv->enabled, active_p);
|
|
463 wv_set_evalable_slot (wv->selected, selected_p);
|
|
464
|
|
465 wv->call_data = LISP_TO_VOID (callback);
|
|
466
|
|
467 if (no_keys_p
|
|
468 #ifdef HAVE_MENUBARS
|
|
469 || !menubar_show_keybindings
|
|
470 #endif
|
|
471 )
|
|
472 wv->key = 0;
|
|
473 else if (!NILP (keys)) /* Use this string to generate key bindings */
|
|
474 {
|
|
475 CHECK_STRING (keys);
|
|
476 keys = Fsubstitute_command_keys (keys);
|
14
|
477 if (XSTRING_LENGTH (keys) > 0)
|
|
478 wv->key = xstrdup ((char *) XSTRING_DATA (keys));
|
0
|
479 else
|
|
480 wv->key = 0;
|
|
481 }
|
|
482 else if (SYMBOLP (callback)) /* Show the binding of this command. */
|
|
483 {
|
|
484 char buf [1024];
|
|
485 /* #### Warning, dependency here on current_buffer and point */
|
|
486 where_is_to_char (callback, buf);
|
|
487 if (buf [0])
|
|
488 wv->key = xstrdup (buf);
|
|
489 else
|
|
490 wv->key = 0;
|
|
491 }
|
|
492
|
|
493 CHECK_SYMBOL (style);
|
|
494 if (NILP (style))
|
|
495 {
|
|
496 /* If the callback is nil, treat this item like unselectable text.
|
|
497 This way, dashes will show up as a separator. */
|
|
498 if (!wv->enabled)
|
|
499 wv->type = BUTTON_TYPE;
|
|
500 if (separator_string_p (wv->name))
|
|
501 {
|
|
502 wv->type = SEPARATOR_TYPE;
|
|
503 wv->value = menu_separator_style (wv->name);
|
|
504 }
|
|
505 else
|
|
506 {
|
|
507 #if 0
|
|
508 /* #### - this is generally desirable for menubars, but it breaks
|
|
509 a package that uses dialog boxes and next_command_event magic
|
|
510 to use the callback slot in dialog buttons for data instead of
|
|
511 a real callback.
|
|
512
|
|
513 Code is data, right? The beauty of LISP abuse. --Stig */
|
|
514 if (NILP (callback))
|
|
515 wv->type = TEXT_TYPE;
|
|
516 else
|
|
517 #endif
|
|
518 wv->type = BUTTON_TYPE;
|
|
519 }
|
|
520 }
|
|
521 else if (EQ (style, Qbutton))
|
|
522 wv->type = BUTTON_TYPE;
|
|
523 else if (EQ (style, Qtoggle))
|
|
524 wv->type = TOGGLE_TYPE;
|
|
525 else if (EQ (style, Qradio))
|
|
526 wv->type = RADIO_TYPE;
|
|
527 else if (EQ (style, Qtext))
|
|
528 {
|
|
529 wv->type = TEXT_TYPE;
|
|
530 #if 0
|
|
531 wv->value = wv->name;
|
|
532 wv->name = "value";
|
173
|
533 #endif
|
0
|
534 }
|
|
535 else
|
|
536 signal_simple_error_2 ("unknown style", style, desc);
|
|
537
|
|
538 if (!allow_text_field_p && (wv->type == TEXT_TYPE))
|
|
539 signal_simple_error ("text field not allowed in this context", desc);
|
|
540
|
|
541 if (selected_spec && EQ (style, Qtext))
|
|
542 signal_simple_error (
|
|
543 ":selected only makes sense with :style toggle, radio or button",
|
|
544 desc);
|
|
545 return 1;
|
|
546 }
|
|
547
|
|
548 #endif /* HAVE_POPUPS */
|
|
549
|
|
550 /* This is a kludge to make sure emacs can only link against a version of
|
|
551 lwlib that was compiled in the right way. Emacs references symbols which
|
|
552 correspond to the way it thinks lwlib was compiled, and if lwlib wasn't
|
|
553 compiled in that way, then somewhat meaningful link errors will result.
|
|
554 The alternatives to this range from obscure link errors, to obscure
|
|
555 runtime errors that look a lot like bugs.
|
|
556 */
|
|
557
|
|
558 static void
|
|
559 sanity_check_lwlib (void)
|
|
560 {
|
|
561 #define MACROLET(v) { extern int v; v = 1; }
|
|
562
|
|
563 #if (XlibSpecificationRelease == 4)
|
|
564 MACROLET (lwlib_uses_x11r4);
|
|
565 #elif (XlibSpecificationRelease == 5)
|
|
566 MACROLET (lwlib_uses_x11r5);
|
|
567 #elif (XlibSpecificationRelease == 6)
|
|
568 MACROLET (lwlib_uses_x11r6);
|
|
569 #else
|
|
570 MACROLET (lwlib_uses_unknown_x11);
|
|
571 #endif
|
|
572 #ifdef LWLIB_USES_MOTIF
|
|
573 MACROLET (lwlib_uses_motif);
|
|
574 #else
|
|
575 MACROLET (lwlib_does_not_use_motif);
|
|
576 #endif
|
|
577 #if (XmVersion >= 1002)
|
|
578 MACROLET (lwlib_uses_motif_1_2);
|
|
579 #else
|
|
580 MACROLET (lwlib_does_not_use_motif_1_2);
|
|
581 #endif
|
|
582 #ifdef LWLIB_MENUBARS_LUCID
|
|
583 MACROLET (lwlib_menubars_lucid);
|
|
584 #elif defined (HAVE_MENUBARS)
|
|
585 MACROLET (lwlib_menubars_motif);
|
|
586 #endif
|
|
587 #ifdef LWLIB_SCROLLBARS_LUCID
|
|
588 MACROLET (lwlib_scrollbars_lucid);
|
|
589 #elif defined (LWLIB_SCROLLBARS_MOTIF)
|
|
590 MACROLET (lwlib_scrollbars_motif);
|
|
591 #elif defined (HAVE_SCROLLBARS)
|
|
592 MACROLET (lwlib_scrollbars_athena);
|
|
593 #endif
|
|
594 #ifdef LWLIB_DIALOGS_MOTIF
|
|
595 MACROLET (lwlib_dialogs_motif);
|
|
596 #elif defined (HAVE_DIALOGS)
|
|
597 MACROLET (lwlib_dialogs_athena);
|
|
598 #endif
|
|
599
|
|
600 #undef MACROLET
|
|
601 }
|
|
602
|
|
603 void
|
|
604 syms_of_gui_x (void)
|
|
605 {
|
|
606 #ifdef HAVE_POPUPS
|
|
607 defsymbol (&Qmenu_no_selection_hook, "menu-no-selection-hook");
|
|
608 #endif
|
|
609 }
|
|
610
|
|
611 void
|
|
612 vars_of_gui_x (void)
|
|
613 {
|
|
614 lwlib_id_tick = (1<<16); /* start big, to not conflict with Energize */
|
|
615
|
|
616 #ifdef HAVE_POPUPS
|
|
617 popup_up_p = 0;
|
|
618
|
|
619 Vpopup_callbacks = Qnil;
|
|
620 staticpro (&Vpopup_callbacks);
|
|
621
|
|
622 #if 0
|
|
623 /* This DEFVAR_LISP is just for the benefit of make-docfile. */
|
|
624 /* #### misnamed */
|
|
625 DEFVAR_LISP ("menu-no-selection-hook", &Vmenu_no_selection_hook /*
|
|
626 Function or functions to call when a menu or dialog box is dismissed
|
|
627 without a selection having been made.
|
|
628 */ );
|
|
629 #endif
|
|
630 Fset (Qmenu_no_selection_hook, Qnil);
|
|
631 #endif /* HAVE_POPUPS */
|
|
632
|
|
633 /* this makes only safe calls as in emacs.c */
|
|
634 sanity_check_lwlib ();
|
|
635 }
|