annotate src/gui-x.c @ 272:c5d627a313b1 r21-0b34

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