annotate src/gui-x.c @ 210:49f55ca3ba57

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