428
|
1 /* Definitions for the new event model;
|
|
2 created 16-jul-91 by Jamie Zawinski
|
|
3 Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
|
788
|
4 Copyright (C) 1995, 1996, 2002 Ben Wing.
|
428
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
440
|
25 #ifndef INCLUDED_events_h_
|
|
26 #define INCLUDED_events_h_
|
428
|
27
|
|
28 #include "systime.h"
|
|
29
|
2367
|
30 /*
|
428
|
31
|
2367
|
32 See also
|
428
|
33
|
2367
|
34 (Info-goto-node "(internals)Event Stream Callback Routines")
|
|
35 (Info-goto-node "(internals)Stream Pairs")
|
428
|
36
|
|
37 */
|
|
38
|
|
39 /* typedef unsigned int USID; in lisp.h */
|
|
40 #define USID_ERROR ((USID)-1)
|
|
41 #define USID_DONTHASH ((USID)0)
|
|
42
|
|
43
|
|
44 struct event_stream
|
|
45 {
|
|
46 int (*event_pending_p) (int);
|
440
|
47 void (*next_event_cb) (Lisp_Event *);
|
|
48 void (*handle_magic_event_cb) (Lisp_Event *);
|
788
|
49 void (*format_magic_event_cb) (Lisp_Event *, Lisp_Object pstream);
|
|
50 int (*compare_magic_event_cb) (Lisp_Event *, Lisp_Event *);
|
|
51 Hashcode (*hash_magic_event_cb)(Lisp_Event *);
|
428
|
52 int (*add_timeout_cb) (EMACS_TIME);
|
|
53 void (*remove_timeout_cb) (int);
|
|
54 void (*select_console_cb) (struct console *);
|
|
55 void (*unselect_console_cb) (struct console *);
|
853
|
56 void (*select_process_cb) (Lisp_Process *, int doin, int doerr);
|
|
57 void (*unselect_process_cb) (Lisp_Process *, int doin, int doerr);
|
1204
|
58 void (*drain_queue_cb) (void);
|
|
59 void (*force_event_pending_cb)(struct frame* f);
|
853
|
60 void (*create_io_streams_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
|
|
61 void * /* errhandle*/,
|
428
|
62 Lisp_Object* /* instream */,
|
|
63 Lisp_Object* /* outstream */,
|
853
|
64 Lisp_Object* /* errstream */,
|
|
65 USID * /* in_usid */, USID * /* err_usid */,
|
428
|
66 int /* flags */);
|
853
|
67 void (*delete_io_streams_cb) (Lisp_Object /* instream */,
|
|
68 Lisp_Object /* outstream */,
|
|
69 Lisp_Object /* errstream */,
|
|
70 USID * /* in_usid */, USID * /* err_usid */);
|
442
|
71 int (*current_event_timestamp_cb) (struct console *);
|
428
|
72 };
|
|
73
|
853
|
74 /* Flags for create_io_streams_cb() FLAGS parameter */
|
428
|
75 #define STREAM_PTY_FLUSHING 0x0001
|
|
76 #define STREAM_NETWORK_CONNECTION 0x0002
|
|
77
|
|
78 extern struct event_stream *event_stream;
|
|
79
|
1204
|
80 #ifdef EVENT_DATA_AS_OBJECTS
|
|
81 #define EVENT_FOO_BAR_1(extractor, field) ((extractor)->field)
|
|
82 #define EVENT_FOO_BAR(e, uptype, downtype, field) EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field)
|
|
83 #define SET_EVENT_FOO_BAR_1(extractor, field, val) \
|
|
84 do { (extractor)->field = (val); } while (0)
|
|
85 #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) SET_EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field, val)
|
|
86 #else
|
|
87 #define EVENT_FOO_BAR(e, uptype, downtype, field) ((e)->event.downtype.field)
|
|
88 #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) \
|
|
89 do { (e)->event.downtype.field = (val); } while (0)
|
|
90 #endif
|
934
|
91
|
428
|
92 typedef enum emacs_event_type
|
|
93 {
|
|
94 empty_event,
|
|
95 key_press_event,
|
|
96 button_press_event,
|
|
97 button_release_event,
|
|
98 pointer_motion_event,
|
|
99 process_event,
|
|
100 timeout_event,
|
|
101 magic_event,
|
|
102 magic_eval_event,
|
|
103 eval_event,
|
|
104 misc_user_event,
|
|
105 dead_event
|
|
106 } emacs_event_type;
|
|
107
|
|
108 #define first_event_type empty_event
|
|
109 #define last_event_type dead_event
|
|
110
|
771
|
111 enum alternative_key_chars
|
|
112 {
|
|
113 KEYCHAR_CURRENT_LANGENV,
|
|
114 KEYCHAR_DEFAULT_USER,
|
|
115 KEYCHAR_DEFAULT_SYSTEM,
|
|
116 KEYCHAR_UNDERLYING_VIRTUAL_KEY_CURRENT_LANGENV,
|
|
117 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_USER,
|
|
118 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_SYSTEM,
|
|
119 KEYCHAR_QWERTY,
|
|
120 KEYCHAR_LAST
|
|
121 };
|
|
122
|
934
|
123 struct Lisp_Key_Data
|
428
|
124 {
|
1204
|
125 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
126 struct lrecord_header lheader;
|
1204
|
127 #endif /* EVENT_DATA_AS_OBJECTS */
|
771
|
128 /* What keysym this is; a character or a symbol. */
|
|
129 Lisp_Object keysym;
|
|
130 /* Modifiers held down when key was pressed: control, meta, etc.
|
|
131 Also includes buttons. For many keys, Shift is not a bit; that
|
|
132 is implicit in the keyboard layout. */
|
|
133 int modifiers;
|
|
134 /* Alternate character interpretations for this key in different
|
|
135 keyboard layouts. This deals with the problem of pressing C-x in
|
|
136 the Russian layout (the so-called "Russian C-x problem"), for
|
|
137 example: `x' gets mapped to a Cyrillic character, so what do we
|
|
138 do? For that matter, what about `C-x b'? What we do is look the
|
|
139 key up in the default locales (current language environment, user
|
|
140 default, system default), then check to see if the underlying
|
|
141 virtual key is alphabetic in the same three defaults, then
|
|
142 finally check US ASCII. We ignore the underlying virtual key for
|
|
143 the current layout to avoid the problem of a French speaker
|
|
144 (AZERTY layout) who temporarily switches to Russian: The virtual
|
|
145 keys underlying Russian are US-ASCII, so what the French speaker
|
|
146 things of as C-a (the key just to the right of TAB) appears as
|
2828
|
147 C-q.
|
|
148
|
|
149 I've just implemented this in event-stream.c, and I really want to
|
|
150 see feedback from actual Russians about it, and whether it needs to
|
|
151 be much more complete than what I've done. E.g, the mapping back to
|
|
152 US Qwerty is hardcoded on the X11 side of things, and only deals
|
|
153 with the alphabetic characters.
|
|
154
|
|
155 Also, I think it's downright confusing for people with Roman
|
|
156 letters on their keyboard to have random other letters than are
|
|
157 described as calling some command, call that command. So I want to
|
|
158 consider enabling it by language environment.
|
|
159
|
|
160 [[ (#### We should probably ignore the current char and look
|
771
|
161 *ONLY* in alt_keychars for all control keys. What about the
|
|
162 English speaker who temporarily switches to the French layout and
|
2828
|
163 finds C-q mapped to C-a?) ]]
|
|
164
|
|
165 No, we shouldn't. People who use the French layout expect that
|
|
166 pressing control with the key to the right of tab passes C-a to
|
|
167 emacs; English speakers (more exactly, Qwerty users) who
|
|
168 temporarily switch to the French layout encounter that issue in
|
|
169 every other app too, and they normally remap the keyboard in
|
|
170 software as soon as they can, or learn to live with Azerty. That
|
|
171 applies for all the Roman-alphabet keyboard layouts. Aidan Kehoe,
|
|
172 2005-05-15
|
|
173
|
|
174 I've taken out the dependency on MULE for this feature because it's
|
|
175 also useful in a non-Mule XEmacs where the user has set their font
|
|
176 to something ending in iso8859-5. How many of those users there
|
|
177 are, is another question. */
|
867
|
178 Ichar alt_keychars[KEYCHAR_LAST];
|
428
|
179 };
|
|
180
|
934
|
181 typedef struct Lisp_Key_Data Lisp_Key_Data;
|
|
182
|
1204
|
183 #define KEY_DATA_KEYSYM(d) ((d)->keysym)
|
|
184 #define KEY_DATA_MODIFIERS(d) ((d)->modifiers)
|
|
185 #define SET_KEY_DATA_KEYSYM(d, k) ((d)->keysym = k)
|
|
186 #define SET_KEY_DATA_MODIFIERS(d, m) ((d)->modifiers = m)
|
|
187
|
|
188 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
189 DECLARE_LRECORD (key_data, Lisp_Key_Data);
|
|
190 #define XKEY_DATA(x) XRECORD (x, key_data, Lisp_Key_Data)
|
|
191 #define wrap_key_data(p) wrap_record (p, key_data)
|
|
192 #define KEY_DATAP(x) RECORDP (x, key_data)
|
|
193 #define CHECK_KEY_DATA(x) CHECK_RECORD (x, key_data)
|
|
194 #define CONCHECK_KEY_DATA(x) CONCHECK_RECORD (x, key_data)
|
1204
|
195 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
196
|
1204
|
197 #define EVENT_KEY_KEYSYM(e) EVENT_FOO_BAR (e, KEY, key, keysym)
|
|
198 #define XEVENT_KEY_KEYSYM(e) EVENT_KEY_KEYSYM (XEVENT (e))
|
|
199 #define SET_EVENT_KEY_KEYSYM(e, val) \
|
|
200 SET_EVENT_FOO_BAR (e, KEY, key, keysym, val)
|
|
201 #define XSET_EVENT_KEY_KEYSYM(e, val) \
|
|
202 SET_EVENT_KEY_KEYSYM (XEVENT (e), val)
|
934
|
203
|
1204
|
204 #define EVENT_KEY_MODIFIERS(e) EVENT_FOO_BAR (e, KEY, key, modifiers)
|
|
205 #define XEVENT_KEY_MODIFIERS(e) EVENT_KEY_MODIFIERS (XEVENT (e))
|
|
206 #define SET_EVENT_KEY_MODIFIERS(e, val) \
|
|
207 SET_EVENT_FOO_BAR (e, KEY, key, modifiers, val)
|
|
208 #define XSET_EVENT_KEY_MODIFIERS(e, val) \
|
|
209 SET_EVENT_KEY_MODIFIERS (XEVENT (e), val)
|
934
|
210
|
1204
|
211 #define EVENT_KEY_ALT_KEYCHARS(e, n) \
|
|
212 EVENT_FOO_BAR (e, KEY, key, alt_keychars[n])
|
|
213 #define XEVENT_KEY_ALT_KEYCHARS(e, n) EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n)
|
|
214 #define SET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \
|
|
215 SET_EVENT_FOO_BAR (e, KEY, key, alt_keychars[n], val)
|
|
216 #define XSET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \
|
|
217 SET_EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n, val)
|
|
218
|
934
|
219 struct Lisp_Button_Data
|
428
|
220 {
|
1204
|
221 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
222 struct lrecord_header lheader;
|
1204
|
223 #endif /* EVENT_DATA_AS_OBJECTS */
|
771
|
224 /* What button went down or up. */
|
|
225 int button;
|
|
226 /* Bucky-bits on that button: shift, control, meta, etc. Also
|
|
227 includes other buttons (not the one pressed). */
|
|
228 int modifiers;
|
|
229 /* Where it was at the button-state-change (in pixels). */
|
|
230 int x, y;
|
428
|
231 };
|
934
|
232 typedef struct Lisp_Button_Data Lisp_Button_Data;
|
428
|
233
|
1204
|
234 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
235 DECLARE_LRECORD (button_data, Lisp_Button_Data);
|
|
236 #define XBUTTON_DATA(x) XRECORD (x, button_data, Lisp_Button_Data)
|
|
237 #define wrap_button_data(p) wrap_record (p, button_data)
|
|
238 #define BUTTON_DATAP(x) RECORDP (x, button_data)
|
|
239 #define CHECK_BUTTON_DATA(x) CHECK_RECORD (x, button_data)
|
|
240 #define CONCHECK_BUTTON_DATA(x) CONCHECK_RECORD (x, button_data)
|
1204
|
241 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
242
|
1204
|
243 #define EVENT_BUTTON_BUTTON(e) EVENT_FOO_BAR (e, BUTTON, button, button)
|
|
244 #define XEVENT_BUTTON_BUTTON(e) EVENT_BUTTON_BUTTON (XEVENT (e))
|
|
245 #define SET_EVENT_BUTTON_BUTTON(e, val) \
|
|
246 SET_EVENT_FOO_BAR (e, BUTTON, button, button, val)
|
|
247 #define XSET_EVENT_BUTTON_BUTTON(e, val) \
|
|
248 SET_EVENT_BUTTON_BUTTON (XEVENT (e), val)
|
|
249
|
|
250 #define EVENT_BUTTON_MODIFIERS(e) EVENT_FOO_BAR (e, BUTTON, button, modifiers)
|
|
251 #define XEVENT_BUTTON_MODIFIERS(e) EVENT_BUTTON_MODIFIERS (XEVENT (e))
|
|
252 #define SET_EVENT_BUTTON_MODIFIERS(e, val) \
|
|
253 SET_EVENT_FOO_BAR (e, BUTTON, button, modifiers, val)
|
|
254 #define XSET_EVENT_BUTTON_MODIFIERS(e, val) \
|
|
255 SET_EVENT_BUTTON_MODIFIERS (XEVENT (e), val)
|
934
|
256
|
1204
|
257 #define EVENT_BUTTON_X(e) EVENT_FOO_BAR (e, BUTTON, button, x)
|
|
258 #define XEVENT_BUTTON_X(e) EVENT_BUTTON_X (XEVENT (e))
|
|
259 #define SET_EVENT_BUTTON_X(e, val) \
|
|
260 SET_EVENT_FOO_BAR (e, BUTTON, button, x, val)
|
|
261 #define XSET_EVENT_BUTTON_X(e, val) \
|
|
262 SET_EVENT_BUTTON_X (XEVENT (e), val)
|
934
|
263
|
1204
|
264 #define EVENT_BUTTON_Y(e) EVENT_FOO_BAR (e, BUTTON, button, y)
|
|
265 #define XEVENT_BUTTON_Y(e) EVENT_BUTTON_Y (XEVENT (e))
|
|
266 #define SET_EVENT_BUTTON_Y(e, val) \
|
|
267 SET_EVENT_FOO_BAR (e, BUTTON, button, y, val)
|
|
268 #define XSET_EVENT_BUTTON_Y(e, val) \
|
|
269 SET_EVENT_BUTTON_Y (XEVENT (e), val)
|
|
270
|
934
|
271 struct Lisp_Motion_Data
|
428
|
272 {
|
1204
|
273 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
274 struct lrecord_header lheader;
|
1204
|
275 #endif /* EVENT_DATA_AS_OBJECTS */
|
771
|
276 /* Where it was after it moved (in pixels). */
|
|
277 int x, y;
|
|
278 /* Bucky-bits down when the motion was detected. */
|
|
279 int modifiers;
|
428
|
280 };
|
934
|
281 typedef struct Lisp_Motion_Data Lisp_Motion_Data;
|
428
|
282
|
1204
|
283 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
284 DECLARE_LRECORD (motion_data, Lisp_Motion_Data);
|
|
285 #define XMOTION_DATA(x) XRECORD (x, motion_data, Lisp_Motion_Data)
|
|
286 #define wrap_motion_data(p) wrap_record (p, motion_data)
|
|
287 #define MOTION_DATAP(x) RECORDP (x, motion_data)
|
|
288 #define CHECK_MOTION_DATA(x) CHECK_RECORD (x, motion_data)
|
|
289 #define CONCHECK_MOTION_DATA(x) CONCHECK_RECORD (x, motion_data)
|
1204
|
290 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
291
|
1204
|
292 #define EVENT_MOTION_X(e) EVENT_FOO_BAR (e, MOTION, motion, x)
|
|
293 #define XEVENT_MOTION_X(e) EVENT_MOTION_X (XEVENT (e))
|
|
294 #define SET_EVENT_MOTION_X(e, val) \
|
|
295 SET_EVENT_FOO_BAR (e, MOTION, motion, x, val)
|
|
296 #define XSET_EVENT_MOTION_X(e, val) \
|
|
297 SET_EVENT_MOTION_X (XEVENT (e), val)
|
934
|
298
|
1204
|
299 #define EVENT_MOTION_Y(e) EVENT_FOO_BAR (e, MOTION, motion, y)
|
|
300 #define XEVENT_MOTION_Y(e) EVENT_MOTION_Y (XEVENT (e))
|
|
301 #define SET_EVENT_MOTION_Y(e, val) \
|
|
302 SET_EVENT_FOO_BAR (e, MOTION, motion, y, val)
|
|
303 #define XSET_EVENT_MOTION_Y(e, val) \
|
|
304 SET_EVENT_MOTION_Y (XEVENT (e), val)
|
|
305
|
|
306 #define EVENT_MOTION_MODIFIERS(e) EVENT_FOO_BAR (e, MOTION, motion, modifiers)
|
|
307 #define XEVENT_MOTION_MODIFIERS(e) EVENT_MOTION_MODIFIERS (XEVENT (e))
|
|
308 #define SET_EVENT_MOTION_MODIFIERS(e, val) \
|
|
309 SET_EVENT_FOO_BAR (e, MOTION, motion, modifiers, val)
|
|
310 #define XSET_EVENT_MOTION_MODIFIERS(e, val) \
|
|
311 SET_EVENT_MOTION_MODIFIERS (XEVENT (e), val)
|
|
312
|
934
|
313 struct Lisp_Process_Data
|
428
|
314 {
|
1204
|
315 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
316 struct lrecord_header lheader;
|
1204
|
317 #endif /* EVENT_DATA_AS_OBJECTS */
|
771
|
318 /* the XEmacs "process" object in question */
|
|
319 Lisp_Object process;
|
428
|
320 };
|
934
|
321 typedef struct Lisp_Process_Data Lisp_Process_Data;
|
428
|
322
|
1204
|
323 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
324 DECLARE_LRECORD (process_data, Lisp_Process_Data);
|
|
325 #define XPROCESS_DATA(x) XRECORD (x, process_data, Lisp_Process_Data)
|
|
326 #define wrap_process_data(p) wrap_record (p, process_data)
|
|
327 #define PROCESS_DATAP(x) RECORDP (x, process_data)
|
|
328 #define CHECK_PROCESS_DATA(x) CHECK_RECORD (x, process_data)
|
|
329 #define CONCHECK_PROCESS_DATA(x) CONCHECK_RECORD (x, process_data)
|
1204
|
330 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
331
|
1204
|
332 #define EVENT_PROCESS_PROCESS(e) EVENT_FOO_BAR (e, PROCESS, process, process)
|
|
333 #define XEVENT_PROCESS_PROCESS(e) EVENT_PROCESS_PROCESS (XEVENT (e))
|
|
334 #define SET_EVENT_PROCESS_PROCESS(e, val) \
|
|
335 SET_EVENT_FOO_BAR (e, PROCESS, process, process, val)
|
|
336 #define XSET_EVENT_PROCESS_PROCESS(e, val) \
|
|
337 SET_EVENT_PROCESS_PROCESS (XEVENT (e), val)
|
|
338
|
934
|
339 struct Lisp_Timeout_Data
|
428
|
340 {
|
771
|
341 /*
|
|
342 interval_id The ID returned when the associated call to
|
|
343 add_timeout_cb() was made
|
|
344 ------ the rest of the fields are filled in by XEmacs -----
|
|
345 id_number The XEmacs timeout ID for this timeout (more
|
|
346 than one timeout event can have the same value
|
|
347 here, since XEmacs timeouts, as opposed to
|
|
348 add_timeout_cb() timeouts, can resignal
|
|
349 themselves)
|
|
350 function An elisp function to call when this timeout is
|
|
351 processed.
|
|
352 object The object passed to that function.
|
|
353 */
|
1204
|
354 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
355 struct lrecord_header lheader;
|
1204
|
356 #endif /* EVENT_DATA_AS_OBJECTS */
|
771
|
357 int interval_id;
|
|
358 int id_number;
|
|
359 Lisp_Object function;
|
|
360 Lisp_Object object;
|
428
|
361 };
|
934
|
362 typedef struct Lisp_Timeout_Data Lisp_Timeout_Data;
|
428
|
363
|
1204
|
364 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
365 DECLARE_LRECORD (timeout_data, Lisp_Timeout_Data);
|
|
366 #define XTIMEOUT_DATA(x) XRECORD (x, timeout_data, Lisp_Timeout_Data)
|
|
367 #define wrap_timeout_data(p) wrap_record(p, timeout_data)
|
|
368 #define TIMEOUT_DATAP(x) RECORDP (x, timeout_data)
|
|
369 #define CHECK_TIMEOUT_DATA(x) CHECK_RECORD (x, timeout_data)
|
|
370 #define CONCHECK_TIMEOUT_DATA(x) CONCHECK_RECORD (x, timeout_data)
|
1204
|
371 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
372
|
1204
|
373 #define EVENT_TIMEOUT_INTERVAL_ID(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id)
|
|
374 #define XEVENT_TIMEOUT_INTERVAL_ID(e) EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e))
|
|
375 #define SET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \
|
|
376 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id, val)
|
|
377 #define XSET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \
|
|
378 SET_EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e), val)
|
|
379
|
|
380 #define EVENT_TIMEOUT_ID_NUMBER(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number)
|
|
381 #define XEVENT_TIMEOUT_ID_NUMBER(e) EVENT_TIMEOUT_ID_NUMBER (XEVENT (e))
|
|
382 #define SET_EVENT_TIMEOUT_ID_NUMBER(e, val) \
|
|
383 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number, val)
|
|
384 #define XSET_EVENT_TIMEOUT_ID_NUMBER(e, val) \
|
|
385 SET_EVENT_TIMEOUT_ID_NUMBER (XEVENT (e), val)
|
934
|
386
|
1204
|
387 #define EVENT_TIMEOUT_FUNCTION(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, function)
|
|
388 #define XEVENT_TIMEOUT_FUNCTION(e) EVENT_TIMEOUT_FUNCTION (XEVENT (e))
|
|
389 #define SET_EVENT_TIMEOUT_FUNCTION(e, val) \
|
|
390 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, function, val)
|
|
391 #define XSET_EVENT_TIMEOUT_FUNCTION(e, val) \
|
|
392 SET_EVENT_TIMEOUT_FUNCTION (XEVENT (e), val)
|
934
|
393
|
1204
|
394 #define EVENT_TIMEOUT_OBJECT(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, object)
|
|
395 #define XEVENT_TIMEOUT_OBJECT(e) EVENT_TIMEOUT_OBJECT (XEVENT (e))
|
|
396 #define SET_EVENT_TIMEOUT_OBJECT(e, val) \
|
|
397 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, object, val)
|
|
398 #define XSET_EVENT_TIMEOUT_OBJECT(e, val) \
|
|
399 SET_EVENT_TIMEOUT_OBJECT (XEVENT (e), val)
|
|
400
|
934
|
401 struct Lisp_Eval_Data
|
428
|
402 {
|
771
|
403 /* This kind of event is used internally; sometimes the window system
|
|
404 interface would like to inform XEmacs of some user action (such as
|
|
405 focusing on another frame) but needs that to happen synchronously
|
|
406 with the other user input, like keypresses. This is useful when
|
|
407 events are reported through callbacks rather than in the standard
|
|
408 event stream.
|
|
409
|
|
410 function An elisp function to call with this event object.
|
|
411 object Argument of function.
|
|
412 */
|
1204
|
413 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
414 struct lrecord_header lheader;
|
1204
|
415 #endif /* EVENT_DATA_AS_OBJECTS */
|
771
|
416 Lisp_Object function;
|
|
417 Lisp_Object object;
|
428
|
418 };
|
934
|
419 typedef struct Lisp_Eval_Data Lisp_Eval_Data;
|
428
|
420
|
1204
|
421 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
422 DECLARE_LRECORD (eval_data, Lisp_Eval_Data);
|
|
423 #define XEVAL_DATA(x) XRECORD (x, eval_data, Lisp_Eval_Data)
|
|
424 #define wrap_eval_data(p) wrap_record(p, eval_data)
|
|
425 #define EVAL_DATAP(x) RECORDP (x, eval_data)
|
|
426 #define CHECK_EVAL_DATA(x) CHECK_RECORD (x, eval_data)
|
|
427 #define CONCHECK_EVAL_DATA(x) CONCHECK_RECORD (x, eval_data)
|
1204
|
428 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
429
|
1204
|
430 #define EVENT_EVAL_FUNCTION(e) EVENT_FOO_BAR (e, EVAL, eval, function)
|
|
431 #define XEVENT_EVAL_FUNCTION(e) EVENT_EVAL_FUNCTION (XEVENT (e))
|
|
432 #define SET_EVENT_EVAL_FUNCTION(e, val) \
|
|
433 SET_EVENT_FOO_BAR (e, EVAL, eval, function, val)
|
|
434 #define XSET_EVENT_EVAL_FUNCTION(e, val) \
|
|
435 SET_EVENT_EVAL_FUNCTION (XEVENT (e), val)
|
934
|
436
|
1204
|
437 #define EVENT_EVAL_OBJECT(e) EVENT_FOO_BAR (e, EVAL, eval, object)
|
|
438 #define XEVENT_EVAL_OBJECT(e) EVENT_EVAL_OBJECT (XEVENT (e))
|
|
439 #define SET_EVENT_EVAL_OBJECT(e, val) \
|
|
440 SET_EVENT_FOO_BAR (e, EVAL, eval, object, val)
|
|
441 #define XSET_EVENT_EVAL_OBJECT(e, val) \
|
|
442 SET_EVENT_EVAL_OBJECT (XEVENT (e), val)
|
934
|
443
|
|
444 struct Lisp_Misc_User_Data
|
428
|
445 {
|
771
|
446 /* #### The misc-user type is serious junk. It should be separated
|
|
447 out into different events. There's no reason to create
|
|
448 sub-subtypes of events.
|
|
449
|
|
450 function An elisp function to call with this event object.
|
|
451 object Argument of function.
|
|
452 button What button went down or up.
|
|
453 modifiers Bucky-bits on that button: shift, control, meta, etc.
|
|
454 x, y Where it was at the button-state-change (in pixels).
|
|
455 This is similar to an eval_event, except that it is
|
|
456 generated by user actions: selections in the
|
|
457 menubar, scrollbar actions, or drag and drop actions.
|
|
458 It is a "command" event, like key and mouse presses
|
|
459 (and unlike mouse motion, process output, and enter
|
|
460 and leave window hooks). In many ways, eval_events
|
|
461 are not the same as keypresses or misc_user_events.
|
|
462 The button, modifiers, x, and y parts are only used
|
|
463 by the XEmacs Drag'n'Drop system. Don't depend on their
|
|
464 values for other types of misc_user_events.
|
|
465 */
|
1204
|
466 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
467 struct lrecord_header lheader;
|
1204
|
468 #endif /* EVENT_DATA_AS_OBJECTS */
|
771
|
469 Lisp_Object function;
|
|
470 Lisp_Object object;
|
|
471 int button;
|
|
472 int modifiers;
|
|
473 int x, y;
|
428
|
474 };
|
934
|
475 typedef struct Lisp_Misc_User_Data Lisp_Misc_User_Data;
|
428
|
476
|
1204
|
477 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
478 DECLARE_LRECORD (misc_user_data, Lisp_Misc_User_Data);
|
|
479 #define XMISC_USER_DATA(x) XRECORD (x, misc_user_data, Lisp_Misc_User_Data)
|
|
480 #define wrap_misc_user_data(p) wrap_record(p, misc_user_data)
|
|
481 #define MISC_USER_DATAP(x) RECORDP (x, misc_user_data)
|
|
482 #define CHECK_MISC_USER_DATA(x) CHECK_RECORD (x, misc_user_data)
|
|
483 #define CONCHECK_MISC_USER_DATA(x) CONCHECK_RECORD (x, misc_user_data)
|
1204
|
484 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
485
|
1204
|
486 #define EVENT_MISC_USER_FUNCTION(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, function)
|
|
487 #define XEVENT_MISC_USER_FUNCTION(e) EVENT_MISC_USER_FUNCTION (XEVENT (e))
|
|
488 #define SET_EVENT_MISC_USER_FUNCTION(e, val) \
|
|
489 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, function, val)
|
|
490 #define XSET_EVENT_MISC_USER_FUNCTION(e, val) \
|
|
491 SET_EVENT_MISC_USER_FUNCTION (XEVENT (e), val)
|
|
492
|
|
493 #define EVENT_MISC_USER_OBJECT(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, object)
|
|
494 #define XEVENT_MISC_USER_OBJECT(e) EVENT_MISC_USER_OBJECT (XEVENT (e))
|
|
495 #define SET_EVENT_MISC_USER_OBJECT(e, val) \
|
|
496 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, object, val)
|
|
497 #define XSET_EVENT_MISC_USER_OBJECT(e, val) \
|
|
498 SET_EVENT_MISC_USER_OBJECT (XEVENT (e), val)
|
934
|
499
|
1204
|
500 #define EVENT_MISC_USER_BUTTON(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, button)
|
|
501 #define XEVENT_MISC_USER_BUTTON(e) EVENT_MISC_USER_BUTTON (XEVENT (e))
|
|
502 #define SET_EVENT_MISC_USER_BUTTON(e, val) \
|
|
503 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, button, val)
|
|
504 #define XSET_EVENT_MISC_USER_BUTTON(e, val) \
|
|
505 SET_EVENT_MISC_USER_BUTTON (XEVENT (e), val)
|
|
506
|
|
507 #define EVENT_MISC_USER_MODIFIERS(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers)
|
|
508 #define XEVENT_MISC_USER_MODIFIERS(e) EVENT_MISC_USER_MODIFIERS (XEVENT (e))
|
|
509 #define SET_EVENT_MISC_USER_MODIFIERS(e, val) \
|
|
510 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers, val)
|
|
511 #define XSET_EVENT_MISC_USER_MODIFIERS(e, val) \
|
|
512 SET_EVENT_MISC_USER_MODIFIERS (XEVENT (e), val)
|
934
|
513
|
1204
|
514 #define EVENT_MISC_USER_X(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, x)
|
|
515 #define XEVENT_MISC_USER_X(e) EVENT_MISC_USER_X (XEVENT (e))
|
|
516 #define SET_EVENT_MISC_USER_X(e, val) \
|
|
517 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, x, val)
|
|
518 #define XSET_EVENT_MISC_USER_X(e, val) \
|
|
519 SET_EVENT_MISC_USER_X (XEVENT (e), val)
|
934
|
520
|
1204
|
521 #define EVENT_MISC_USER_Y(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, y)
|
|
522 #define XEVENT_MISC_USER_Y(e) EVENT_MISC_USER_Y (XEVENT (e))
|
|
523 #define SET_EVENT_MISC_USER_Y(e, val) \
|
|
524 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, y, val)
|
|
525 #define XSET_EVENT_MISC_USER_Y(e, val) \
|
|
526 SET_EVENT_MISC_USER_Y (XEVENT (e), val)
|
934
|
527
|
|
528 struct Lisp_Magic_Eval_Data
|
428
|
529 {
|
771
|
530 /* This is like an eval event but its contents are not
|
|
531 Lisp-accessible. This allows for "internal eval events" that call
|
|
532 non-Lisp-accessible functions. Externally, a magic_eval_event just
|
|
533 appears as a magic_event; the Lisp programmer need not know
|
|
534 anything more.
|
|
535
|
|
536 internal_function An unexported function to call with this event
|
|
537 object. This allows eval events to call internal
|
|
538 functions. For a normal eval event, this field
|
|
539 will always be 0.
|
|
540 object Argument of function.
|
|
541
|
|
542 */
|
1204
|
543 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
544 struct lrecord_header lheader;
|
1204
|
545 #endif /* EVENT_DATA_AS_OBJECTS */
|
771
|
546 void (*internal_function) (Lisp_Object);
|
|
547 Lisp_Object object;
|
428
|
548 };
|
934
|
549 typedef struct Lisp_Magic_Eval_Data Lisp_Magic_Eval_Data;
|
|
550
|
1204
|
551 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
552 DECLARE_LRECORD (magic_eval_data, Lisp_Magic_Eval_Data);
|
|
553 #define XMAGIC_EVAL_DATA(x) XRECORD (x, magic_eval_data, Lisp_Magic_Eval_Data)
|
|
554 #define wrap_magic_eval_data(p) wrap_record(p, magic_eval_data)
|
|
555 #define MAGIC_EVAL_DATAP(x) RECORDP (x, magic_eval_data)
|
|
556 #define CHECK_MAGIC_EVAL_DATA(x) CHECK_RECORD (x, magic_eval_data)
|
|
557 #define CONCHECK_MAGIC_EVAL_DATA(x) CONCHECK_RECORD (x, magic_eval_data)
|
1204
|
558 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
559
|
1204
|
560 #define EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function)
|
|
561 #define XEVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e))
|
|
562 #define SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \
|
|
563 SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function, val)
|
|
564 #define XSET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \
|
|
565 SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e), val)
|
|
566
|
|
567 #define EVENT_MAGIC_EVAL_OBJECT(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object)
|
|
568 #define XEVENT_MAGIC_EVAL_OBJECT(e) EVENT_MAGIC_EVAL_OBJECT (XEVENT (e))
|
|
569 #define SET_EVENT_MAGIC_EVAL_OBJECT(e, val) \
|
|
570 SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object, val)
|
|
571 #define XSET_EVENT_MAGIC_EVAL_OBJECT(e, val) \
|
|
572 SET_EVENT_MAGIC_EVAL_OBJECT (XEVENT (e), val)
|
428
|
573
|
|
574 #if defined (HAVE_X_WINDOWS) && defined(emacs)
|
|
575 # include <X11/Xlib.h>
|
|
576 #endif
|
|
577
|
462
|
578 #ifdef HAVE_GTK
|
|
579 #include <gdk/gdk.h>
|
|
580 #endif
|
|
581
|
934
|
582
|
|
583 struct Lisp_Magic_Data
|
|
584 {
|
1204
|
585 /* No user-serviceable parts within. This is for things like
|
|
586 KeymapNotify and ExposeRegion events and so on that XEmacs itself
|
|
587 doesn't care about, but which it must do something with for proper
|
|
588 interaction with the window system.
|
|
589
|
|
590 Magic_events are handled somewhat asynchronously, just like
|
|
591 subprocess filters. However, occasionally a magic_event needs to
|
|
592 be handled synchronously; in that case, the asynchronous handling
|
|
593 of the magic_event will push an eval_event back onto the queue,
|
|
594 which will be handled synchronously later. This is one of the
|
|
595 reasons why eval_events exist; I'm not entirely happy with this
|
|
596 aspect of this event model.
|
|
597 */
|
|
598
|
|
599 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
600 struct lrecord_header lheader;
|
1204
|
601 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
602
|
|
603 union {
|
|
604 #ifdef HAVE_GTK
|
|
605 GdkEvent gdk_event;
|
|
606 #endif
|
|
607 #ifdef HAVE_X_WINDOWS
|
|
608 XEvent x_event;
|
|
609 #endif
|
|
610 #ifdef HAVE_MS_WINDOWS
|
|
611 int mswindows_event;
|
|
612 #endif
|
|
613 } underlying;
|
|
614 };
|
|
615
|
|
616 typedef struct Lisp_Magic_Data Lisp_Magic_Data;
|
|
617
|
1204
|
618 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
619 DECLARE_LRECORD (magic_data, Lisp_Magic_Data);
|
|
620 #define XMAGIC_DATA(x) XRECORD (x, magic_data, Lisp_Magic_Data)
|
|
621 #define wrap_magic_data(p) wrap_record(p, magic_data)
|
|
622 #define MAGIC_DATAP(x) RECORDP (x, magic_data)
|
|
623 #define CHECK_MAGIC_DATA(x) CHECK_RECORD (x, magic_data)
|
|
624 #define CONCHECK_MAGIC_DATA(x) CONCHECK_RECORD (x, magic_data)
|
1204
|
625 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
626
|
1204
|
627 #define EVENT_MAGIC_UNDERLYING(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying)
|
|
628 #define XEVENT_MAGIC_UNDERLYING(e) EVENT_MAGIC_UNDERLYING (XEVENT (e))
|
|
629 #define SET_EVENT_MAGIC_UNDERLYING(e, val) \
|
|
630 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying, val)
|
|
631 #define XSET_EVENT_MAGIC_UNDERLYING(e, val) \
|
|
632 SET_EVENT_MAGIC_UNDERLYING (XEVENT (e), val)
|
934
|
633
|
|
634 #ifdef HAVE_GTK
|
1204
|
635 #define EVENT_MAGIC_GDK_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event)
|
|
636 #define XEVENT_MAGIC_GDK_EVENT(e) EVENT_MAGIC_GDK_EVENT (XEVENT (e))
|
|
637 #define SET_EVENT_MAGIC_GDK_EVENT(e, val) \
|
|
638 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event, val)
|
|
639 #define XSET_EVENT_MAGIC_GDK_EVENT(e, val) \
|
|
640 SET_EVENT_MAGIC_GDK_EVENT (XEVENT (e), val)
|
|
641 #endif
|
934
|
642
|
|
643 #ifdef HAVE_X_WINDOWS
|
1204
|
644 #define EVENT_MAGIC_X_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event)
|
|
645 #define XEVENT_MAGIC_X_EVENT(e) EVENT_MAGIC_X_EVENT (XEVENT (e))
|
|
646 #define SET_EVENT_MAGIC_X_EVENT(e, val) \
|
|
647 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event, val)
|
|
648 #define XSET_EVENT_MAGIC_X_EVENT(e, val) \
|
|
649 SET_EVENT_MAGIC_X_EVENT (XEVENT (e), val)
|
934
|
650 #endif
|
|
651
|
|
652 #ifdef HAVE_MS_WINDOWS
|
1204
|
653 #define EVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event)
|
|
654 #define XEVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e))
|
|
655 #define SET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \
|
|
656 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event, val)
|
|
657 #define XSET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \
|
|
658 SET_EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e), val)
|
934
|
659 #endif
|
|
660
|
428
|
661 struct Lisp_Timeout
|
|
662 {
|
2720
|
663 #ifdef MC_ALLOC
|
|
664 struct lrecord_header header;
|
|
665 #else /* MC_ALLOC */
|
432
|
666 struct lcrecord_header header;
|
2720
|
667 #endif /* MC_ALLOC */
|
428
|
668 int id; /* Id we use to identify the timeout over its lifetime */
|
|
669 int interval_id; /* Id for this particular interval; this may
|
771
|
670 be different each time the timeout is
|
|
671 signalled.*/
|
428
|
672 Lisp_Object function, object; /* Function and object associated
|
771
|
673 with timeout. */
|
428
|
674 EMACS_TIME next_signal_time; /* Absolute time when the timeout
|
771
|
675 is next going to be signalled. */
|
428
|
676 unsigned int resignal_msecs; /* How far after the next timeout
|
771
|
677 should the one after that
|
|
678 occur? */
|
428
|
679 };
|
440
|
680 typedef struct Lisp_Timeout Lisp_Timeout;
|
428
|
681
|
440
|
682 DECLARE_LRECORD (timeout, Lisp_Timeout);
|
|
683 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout)
|
617
|
684 #define wrap_timeout(p) wrap_record (p, timeout)
|
428
|
685 #define TIMEOUTP(x) RECORDP (x, timeout)
|
|
686 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
|
|
687 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout)
|
|
688
|
|
689 struct Lisp_Event
|
|
690 {
|
|
691 /* header->next (aka XEVENT_NEXT ()) is used as follows:
|
|
692 - For dead events, this is the next dead one.
|
|
693 - For events on the command_event_queue, the next one on the queue.
|
|
694 - Likewise for events chained in the command builder.
|
|
695 - Otherwise it's Qnil.
|
|
696 */
|
|
697 struct lrecord_header lheader;
|
771
|
698 Lisp_Object next;
|
|
699 emacs_event_type event_type;
|
|
700
|
|
701 /* Where this event occurred on. This will be a frame, device,
|
|
702 console, or nil, depending on the event type. It is important
|
|
703 that an object of a more specific type than is actually generated
|
|
704 is not substituted -- e.g. there should not be a frame inserted
|
|
705 when a key-press event occurs, because events on dead channels
|
|
706 are automatically ignored.
|
|
707
|
|
708 Specifically:
|
|
709
|
|
710 -- for button and mouse-motion events, channel will be a
|
|
711 frame. (The translation to a window occurs later.)
|
|
712
|
|
713 -- for keyboard events, channel will be a console. Note that
|
|
714 fake keyboard events (generated by `character-to-event' or
|
|
715 something that calls this, such as macros) need to have the
|
|
716 selected console stored into them when the event is created.
|
|
717 This is so that the correct console-local variables (e.g. the
|
|
718 command builder) will get affected.
|
|
719
|
|
720 -- for timer, process, magic-eval, and eval events, channel will
|
|
721 be nil.
|
|
722
|
|
723 -- for misc-user events, channel will be a frame.
|
|
724
|
|
725 -- for magic events, channel will be a frame (usually) or a
|
|
726 device. */
|
|
727 Lisp_Object channel;
|
|
728
|
|
729 /* When this event occurred -- if not known, this is made up. ####
|
|
730 All timestamps should be measured as milliseconds since XEmacs
|
|
731 started. Currently they are raw server timestamps. (The X
|
|
732 protocol doesn't provide any easy way of translating between
|
|
733 server time and real process time; yuck.) */
|
934
|
734 unsigned int timestamp;
|
771
|
735
|
1204
|
736 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
737 Lisp_Object event_data;
|
1204
|
738 #else /* not EVENT_DATA_AS_OBJECTS */
|
428
|
739 union
|
|
740 {
|
1204
|
741 Lisp_Key_Data key;
|
|
742 Lisp_Button_Data button;
|
|
743 Lisp_Motion_Data motion;
|
|
744 Lisp_Process_Data process;
|
|
745 Lisp_Timeout_Data timeout;
|
|
746 Lisp_Eval_Data eval; /* misc_user_event no longer uses this */
|
|
747 Lisp_Misc_User_Data misc_user;/* because it needs position information */
|
|
748 Lisp_Magic_Data magic;
|
|
749 Lisp_Magic_Eval_Data magic_eval;
|
428
|
750 } event;
|
1204
|
751 #endif /* not EVENT_DATA_AS_OBJECTS */
|
428
|
752 };
|
|
753
|
440
|
754 DECLARE_LRECORD (event, Lisp_Event);
|
|
755 #define XEVENT(x) XRECORD (x, event, Lisp_Event)
|
617
|
756 #define wrap_event(p) wrap_record (p, event)
|
428
|
757 #define EVENTP(x) RECORDP (x, event)
|
|
758 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
|
|
759 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
|
|
760
|
|
761 DECLARE_LRECORD (command_builder, struct command_builder);
|
|
762
|
|
763 #define EVENT_CHANNEL(a) ((a)->channel)
|
1204
|
764 #define XEVENT_CHANNEL(ev) (XEVENT (ev)->channel)
|
428
|
765 #define EVENT_TYPE(a) ((a)->event_type)
|
|
766 #define XEVENT_TYPE(a) (XEVENT (a)->event_type)
|
|
767 #define EVENT_NEXT(a) ((a)->next)
|
|
768 #define XEVENT_NEXT(e) (XEVENT (e)->next)
|
1204
|
769 #define EVENT_TIMESTAMP(ev) ((ev)->timestamp)
|
|
770 #define XEVENT_TIMESTAMP(ev) EVENT_TIMESTAMP (XEVENT (ev))
|
934
|
771
|
1204
|
772 #ifdef EVENT_DATA_AS_OBJECTS
|
934
|
773 #define XEVENT_DATA(ev) (XEVENT (ev)->event_data)
|
|
774 #define EVENT_DATA(ev) ((ev)->event_data)
|
1204
|
775 #define SET_EVENT_DATA(ev, d) \
|
|
776 do { \
|
|
777 Lisp_Event *mac_event = (ev); \
|
|
778 mac_event->event_data = (d); \
|
|
779 } while (0)
|
|
780 #define XSET_EVENT_DATA(ev, d) SET_EVENT_DATA (XEVENT (ev), d)
|
|
781 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
782
|
1204
|
783 #define SET_EVENT_TIMESTAMP_ZERO(ev) ((ev)->timestamp = 0)
|
|
784 #define SET_EVENT_TIMESTAMP(ev, t) ((ev)->timestamp = (t))
|
934
|
785 #define XSET_EVENT_TIMESTAMP(ev, t) SET_EVENT_TIMESTAMP (XEVENT (ev), t)
|
|
786
|
|
787 #define SET_EVENT_CHANNEL(ev, c) \
|
|
788 do { \
|
|
789 Lisp_Event *mac_event = (ev); \
|
|
790 mac_event->channel = (c); \
|
|
791 } while (0)
|
|
792 #define XSET_EVENT_CHANNEL(ev, c) SET_EVENT_CHANNEL (XEVENT (ev), c)
|
|
793
|
1204
|
794 DECLARE_INLINE_HEADER (
|
|
795 void
|
|
796 set_event_type (struct Lisp_Event *event, emacs_event_type t)
|
|
797 )
|
|
798 {
|
|
799 #ifdef EVENT_DATA_AS_OBJECTS
|
|
800 switch (EVENT_TYPE (event))
|
|
801 {
|
|
802 case key_press_event:
|
|
803 free_key_data (event->event_data);
|
|
804 break;
|
|
805 case button_press_event:
|
|
806 case button_release_event:
|
|
807 free_button_data (event->event_data);
|
|
808 break;
|
|
809 case pointer_motion_event:
|
|
810 free_motion_data (event->event_data);
|
|
811 break;
|
|
812 case process_event:
|
|
813 free_process_data (event->event_data);
|
|
814 break;
|
|
815 case timeout_event:
|
|
816 free_timeout_data (event->event_data);
|
|
817 break;
|
|
818 case magic_event:
|
|
819 free_magic_data (event->event_data);
|
|
820 break;
|
|
821 case magic_eval_event:
|
|
822 free_magic_eval_data (event->event_data);
|
|
823 break;
|
|
824 case eval_event:
|
|
825 free_eval_data (event->event_data);
|
|
826 break;
|
|
827 case misc_user_event:
|
|
828 free_misc_user_data (event->event_data);
|
|
829 break;
|
|
830 default:
|
|
831 break;
|
|
832 }
|
|
833 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
834
|
|
835 event->event_type = t;
|
|
836
|
1204
|
837 #ifdef EVENT_DATA_AS_OBJECTS
|
|
838 switch (t)
|
|
839 {
|
|
840 case key_press_event:
|
|
841 event->event_data = make_key_data ();
|
|
842 break;
|
|
843 case button_press_event:
|
|
844 case button_release_event:
|
|
845 event->event_data = make_button_data ();
|
|
846 break;
|
|
847 case pointer_motion_event:
|
|
848 event->event_data = make_motion_data ();
|
|
849 break;
|
|
850 case process_event:
|
|
851 event->event_data = make_process_data ();
|
|
852 break;
|
|
853 case timeout_event:
|
|
854 event->event_data = make_timeout_data ();
|
|
855 break;
|
|
856 case magic_event:
|
|
857 event->event_data = make_magic_data ();
|
|
858 break;
|
|
859 case magic_eval_event:
|
|
860 event->event_data = make_magic_eval_data ();
|
|
861 break;
|
|
862 case eval_event:
|
|
863 event->event_data = make_eval_data ();
|
|
864 break;
|
|
865 case misc_user_event:
|
|
866 event->event_data = make_misc_user_data ();
|
|
867 break;
|
|
868 default:
|
|
869 event->event_data = Qnil;
|
|
870 break;
|
|
871 }
|
|
872 #endif /* EVENT_DATA_AS_OBJECTS */
|
934
|
873 }
|
1204
|
874
|
|
875 #define SET_EVENT_NEXT(ev, n) do { (ev)->next = (n); } while (0)
|
|
876 #define XSET_EVENT_NEXT(ev, n) SET_EVENT_NEXT (XEVENT (ev), n)
|
|
877
|
934
|
878 #define XSET_EVENT_TYPE(ev, t) set_event_type (XEVENT (ev), t)
|
|
879 #define SET_EVENT_TYPE(ev, t) set_event_type (ev, t)
|
|
880
|
428
|
881 #define EVENT_CHAIN_LOOP(event, chain) \
|
|
882 for (event = chain; !NILP (event); event = XEVENT_NEXT (event))
|
|
883
|
|
884 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event)
|
|
885
|
771
|
886 #define CHECK_LIVE_EVENT(x) do { \
|
|
887 CHECK_EVENT (x); \
|
|
888 if (! EVENT_LIVE_P (XEVENT (x))) \
|
|
889 dead_wrong_type_argument (Qevent_live_p, (x)); \
|
428
|
890 } while (0)
|
771
|
891 #define CONCHECK_LIVE_EVENT(x) do { \
|
|
892 CONCHECK_EVENT (x); \
|
|
893 if (! EVENT_LIVE_P (XEVENT (x))) \
|
|
894 x = wrong_type_argument (Qevent_live_p, (x)); \
|
428
|
895 } while (0)
|
|
896
|
|
897
|
|
898 EXFUN (Fcharacter_to_event, 4);
|
|
899 EXFUN (Fdeallocate_event, 1);
|
|
900 EXFUN (Fevent_glyph_extent, 1);
|
|
901 EXFUN (Fevent_modeline_position, 1);
|
|
902 EXFUN (Fevent_over_modeline_p, 1);
|
|
903 EXFUN (Fevent_over_toolbar_p, 1);
|
|
904 EXFUN (Fevent_over_vertical_divider_p, 1);
|
|
905 EXFUN (Fevent_point, 1);
|
|
906 EXFUN (Fevent_window, 1);
|
|
907 EXFUN (Fmake_event, 2);
|
1268
|
908 EXFUN (Fnext_command_event, 2);
|
428
|
909
|
|
910 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn;
|
|
911 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property;
|
|
912 extern Lisp_Object Qcancel_mode_internal;
|
444
|
913 extern Lisp_Object Vmodifier_keys_sticky_time;
|
428
|
914
|
502
|
915 /* The modifiers XEmacs knows about; these appear in key and button events. */
|
|
916
|
771
|
917 #define XEMACS_MOD_CONTROL (1<<0)
|
|
918 #define XEMACS_MOD_META (1<<1)
|
|
919 #define XEMACS_MOD_SUPER (1<<2)
|
|
920 #define XEMACS_MOD_HYPER (1<<3)
|
|
921 #define XEMACS_MOD_ALT (1<<4)
|
|
922 #define XEMACS_MOD_SHIFT (1<<5) /* not used for dual-case characters */
|
|
923 #define XEMACS_MOD_BUTTON1 (1<<6)
|
|
924 #define XEMACS_MOD_BUTTON2 (1<<7)
|
|
925 #define XEMACS_MOD_BUTTON3 (1<<8)
|
|
926 #define XEMACS_MOD_BUTTON4 (1<<9)
|
|
927 #define XEMACS_MOD_BUTTON5 (1<<10)
|
502
|
928
|
|
929 /* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key
|
|
930 if there are both Alt and Meta keys. If there are no Meta keys,
|
|
931 then Alt generates XEMACS_MOD_META instead.
|
428
|
932 */
|
|
933
|
|
934 /* Maybe this should be trickier */
|
|
935 #define KEYSYM(x) (intern (x))
|
|
936
|
|
937 /* from events.c */
|
934
|
938 void format_event_object (Eistring *buf, Lisp_Object event, int brief);
|
1229
|
939 /*void format_event_data_object (Eistring *buf, Lisp_Object data, int brief);*/
|
867
|
940 void character_to_event (Ichar c, Lisp_Event *event,
|
771
|
941 struct console *con,
|
|
942 int use_console_meta_flag,
|
|
943 int do_backspace_mapping);
|
440
|
944 void zero_event (Lisp_Event *e);
|
1204
|
945
|
|
946 #define MECR_DEALLOCATE_EVENT 1
|
|
947
|
428
|
948 void deallocate_event_chain (Lisp_Object event);
|
|
949 Lisp_Object event_chain_tail (Lisp_Object event);
|
|
950 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
|
|
951 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
|
|
952 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
|
771
|
953 Lisp_Object *tail);
|
1204
|
954 int map_event_chain_remove (int (*fn) (Lisp_Object ev, void *user_data),
|
|
955 Lisp_Object *head, Lisp_Object *tail,
|
|
956 void *user_data, int flags);
|
428
|
957 int event_chain_count (Lisp_Object event_chain);
|
|
958 Lisp_Object event_chain_find_previous (Lisp_Object event_chain,
|
771
|
959 Lisp_Object event);
|
428
|
960 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
|
|
961 Lisp_Object copy_event_chain (Lisp_Object event_chain);
|
1204
|
962 Lisp_Object transfer_event_chain_pointer (Lisp_Object pointer,
|
|
963 Lisp_Object old_chain,
|
|
964 Lisp_Object new_chain);
|
|
965
|
|
966
|
|
967 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event);
|
|
968 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
|
428
|
969 /* True if this is a non-internal event
|
|
970 (keyboard press, menu, scrollbar, mouse button) */
|
|
971 int command_event_p (Lisp_Object event);
|
440
|
972 void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
|
2828
|
973 Ichar event_to_character (Lisp_Object, int, int);
|
428
|
974 struct console *event_console_or_selected (Lisp_Object event);
|
1204
|
975 void upshift_event (Lisp_Object event);
|
|
976 void downshift_event (Lisp_Object event);
|
|
977 int event_upshifted_p (Lisp_Object event);
|
428
|
978
|
|
979 /* from event-stream.c */
|
1204
|
980 extern Lisp_Object dispatch_event_queue;
|
771
|
981 Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf);
|
1204
|
982 void enqueue_dispatch_event (Lisp_Object event);
|
|
983 Lisp_Object dequeue_dispatch_event (void);
|
428
|
984 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
|
440
|
985 void event_stream_handle_magic_event (Lisp_Event *event);
|
788
|
986 void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream);
|
|
987 int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2);
|
|
988 Hashcode event_stream_hash_magic_event (Lisp_Event *e);
|
428
|
989 void event_stream_select_console (struct console *con);
|
|
990 void event_stream_unselect_console (struct console *con);
|
853
|
991 void event_stream_select_process (Lisp_Process *proc, int doin, int doerr);
|
|
992 void event_stream_unselect_process (Lisp_Process *proc, int doin, int doerr);
|
|
993 void event_stream_create_io_streams (void* inhandle, void* outhandle,
|
|
994 void *errhandle, Lisp_Object* instream,
|
|
995 Lisp_Object* outstream,
|
|
996 Lisp_Object* errstream,
|
|
997 USID* in_usid,
|
|
998 USID* err_usid,
|
|
999 int flags);
|
|
1000 void event_stream_delete_io_streams (Lisp_Object instream,
|
|
1001 Lisp_Object outstream,
|
|
1002 Lisp_Object errstream,
|
|
1003 USID* in_usid,
|
|
1004 USID* err_usid);
|
1268
|
1005 Lisp_Object event_stream_protect_modal_loop (const char *error_string,
|
|
1006 Lisp_Object (*bfun) (void *barg),
|
|
1007 void *barg, int flags);
|
|
1008 void event_stream_drain_queue (void);
|
428
|
1009 void event_stream_quit_p (void);
|
853
|
1010 void run_pre_idle_hook (void);
|
428
|
1011
|
|
1012 struct low_level_timeout
|
|
1013 {
|
|
1014 int id;
|
|
1015 EMACS_TIME time;
|
|
1016 struct low_level_timeout *next;
|
|
1017 };
|
|
1018
|
|
1019 int add_low_level_timeout (struct low_level_timeout **timeout_list,
|
771
|
1020 EMACS_TIME thyme);
|
428
|
1021 void remove_low_level_timeout (struct low_level_timeout **timeout_list,
|
771
|
1022 int id);
|
428
|
1023 int get_low_level_timeout_interval (struct low_level_timeout *
|
771
|
1024 timeout_list, EMACS_TIME *interval);
|
428
|
1025 int pop_low_level_timeout (struct low_level_timeout **timeout_list,
|
771
|
1026 EMACS_TIME *time_out);
|
428
|
1027 int event_stream_generate_wakeup (unsigned int milliseconds,
|
771
|
1028 unsigned int vanilliseconds,
|
|
1029 Lisp_Object function,
|
|
1030 Lisp_Object object,
|
|
1031 int async_p);
|
593
|
1032 int event_stream_resignal_wakeup (int interval_id, int async_p,
|
771
|
1033 Lisp_Object *function, Lisp_Object *object);
|
428
|
1034 void event_stream_disable_wakeup (int id, int async_p);
|
|
1035
|
593
|
1036 /* from signal.c */
|
|
1037 int signal_add_async_interval_timeout (EMACS_TIME thyme);
|
|
1038 void signal_remove_async_interval_timeout (int id);
|
428
|
1039
|
|
1040 /* from event-stream.c -- focus sanity */
|
|
1041 extern int focus_follows_mouse;
|
|
1042 void investigate_frame_change (void);
|
|
1043
|
|
1044 void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev);
|
|
1045 void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev);
|
|
1046
|
|
1047 Lisp_Object extract_this_command_keys_nth_mouse_event (int n);
|
|
1048 Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n);
|
|
1049
|
|
1050 void single_console_state (void);
|
|
1051 void any_console_state (void);
|
|
1052 int in_single_console_state (void);
|
|
1053
|
|
1054 extern int emacs_is_blocking;
|
1268
|
1055 extern int in_modal_loop;
|
428
|
1056 extern volatile int sigint_happened;
|
|
1057
|
|
1058 #ifdef HAVE_UNIXOID_EVENT_LOOP
|
|
1059 /* from event-unixoid.c */
|
|
1060
|
|
1061 /* Ceci n'est pas un pipe. */
|
|
1062 extern int signal_event_pipe[];
|
|
1063
|
|
1064 void signal_fake_event (void);
|
|
1065 void drain_signal_event_pipe (void);
|
1204
|
1066 void drain_tty_devices (void);
|
428
|
1067
|
|
1068 extern int fake_event_occurred;
|
|
1069
|
|
1070 int event_stream_unixoid_select_console (struct console *con);
|
|
1071 int event_stream_unixoid_unselect_console (struct console *con);
|
853
|
1072 void event_stream_unixoid_select_process (Lisp_Process *proc, int doin,
|
|
1073 int doerr, int *infd, int *errfd);
|
|
1074 void event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin,
|
|
1075 int doerr, int *infd, int *errfd);
|
1204
|
1076 struct console *find_tty_or_stream_console_from_fd (int fd);
|
440
|
1077 int read_event_from_tty_or_stream_desc (Lisp_Event *event,
|
771
|
1078 struct console *con);
|
853
|
1079 void event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle,
|
|
1080 void *errhandle,
|
|
1081 Lisp_Object* instream,
|
|
1082 Lisp_Object* outstream,
|
|
1083 Lisp_Object* errstream,
|
|
1084 USID* in_usid,
|
|
1085 USID* err_usid,
|
|
1086 int flags);
|
|
1087 void event_stream_unixoid_delete_io_streams (Lisp_Object instream,
|
|
1088 Lisp_Object outstream,
|
|
1089 Lisp_Object errstream,
|
|
1090 USID* in_usid,
|
|
1091 USID* err_usid);
|
428
|
1092
|
1204
|
1093 #endif /* HAVE_UNIXOID_EVENT_LOOP */
|
|
1094
|
|
1095 /* The following is not inside of HAVE_UNIXOID_EVENT_LOOP because of the
|
|
1096 possibility of combiling XEmacs with no-MSW, no-X, no-TTY --
|
|
1097 process-unix.c is still compiled. #### Should we still compile
|
|
1098 subprocesses with no event loops? */
|
428
|
1099 /* Beware: this evil macro evaluates its arg many times */
|
|
1100 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd)))
|
|
1101
|
|
1102 /* Define this if you want the tty event stream to be used when the
|
|
1103 first console is tty, even if HAVE_X_WINDOWS is defined */
|
|
1104 /* #define DEBUG_TTY_EVENT_STREAM */
|
|
1105
|
|
1106
|
442
|
1107 /* #### a hack, until accelerator shit is cleaned up */
|
|
1108
|
|
1109 /* This structure is what we use to encapsulate the state of a command sequence
|
|
1110 being composed; key events are executed by adding themselves to the command
|
|
1111 builder; if the command builder is then complete (does not still represent
|
|
1112 a prefix key sequence) it executes the corresponding command.
|
|
1113 */
|
|
1114 struct command_builder
|
|
1115 {
|
2720
|
1116 #ifdef MC_ALLOC
|
|
1117 struct lrecord_header header;
|
|
1118 #else /* MC_ALLOC */
|
442
|
1119 struct lcrecord_header header;
|
2720
|
1120 #endif /* MC_ALLOC */
|
442
|
1121 Lisp_Object console; /* back pointer to the console this command
|
771
|
1122 builder is for */
|
|
1123 #if 0
|
|
1124 /* #### Not implemented: nil, or an event representing the first
|
|
1125 event read after the last command completed. Threaded. */
|
442
|
1126 Lisp_Object prefix_events;
|
771
|
1127 #endif /* 0 */
|
|
1128 /* nil, or an event chain representing the events in the current
|
|
1129 keymap-lookup sequence. NOTE: All events in the chain MUST be
|
|
1130 freshly allocated, with no pointers to them elsewhere. */
|
442
|
1131 Lisp_Object current_events;
|
771
|
1132 /* Last elt of current_events */
|
442
|
1133 Lisp_Object most_current_event;
|
771
|
1134 /* Last elt before function map code took over. What this means is:
|
442
|
1135 All prefixes up to (but not including) this event have non-nil
|
|
1136 bindings, but the prefix including this event has a nil binding.
|
|
1137 Any events in the chain after this one were read solely because
|
|
1138 we're part of a possible function key. If we end up with
|
|
1139 something that's not part of a possible function key, we have to
|
|
1140 unread all of those events. */
|
|
1141 Lisp_Object last_non_munged_event;
|
1204
|
1142 /* One value for function-key-map, one for key-translation-map:
|
|
1143 First event that can begin a possible function key sequence
|
|
1144 (to be translated according to function-key-map). Normally
|
|
1145 this is the first event in the chain. However, once we've
|
|
1146 translated a sequence through function-key-map, this will point
|
|
1147 to the first event after the translated sequence: we don't ever
|
|
1148 want to translate any events twice through function-key-map, or
|
|
1149 things could get really screwed up (e.g. if the user created a
|
|
1150 translation loop). If this is nil, then the next-read event is
|
|
1151 the first that can begin a function key sequence. */
|
|
1152 Lisp_Object first_mungeable_event[2];
|
934
|
1153 Ibyte *echo_buf;
|
442
|
1154
|
|
1155 Bytecount echo_buf_length; /* size of echo_buf */
|
|
1156 Bytecount echo_buf_index; /* index into echo_buf
|
771
|
1157 * -1 before doing echoing for new cmd */
|
442
|
1158 /* Self-insert-command is magic in that it doesn't always push an undo-
|
|
1159 boundary: up to 20 consecutive self-inserts can happen before an undo-
|
|
1160 boundary is pushed. This variable is that counter.
|
|
1161 */
|
|
1162 int self_insert_countdown;
|
|
1163 };
|
|
1164
|
440
|
1165 #endif /* INCLUDED_events_h_ */
|