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