Mercurial > hg > xemacs-beta
comparison src/events.h @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | fdefd0186b75 |
children | 026c5bf9c134 |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
126 from the SIGIO handler). | 126 from the SIGIO handler). |
127 | 127 |
128 XEmacs has its own event structures, which are distinct from the event | 128 XEmacs has its own event structures, which are distinct from the event |
129 structures used by X or any other window system. It is the job of the | 129 structures used by X or any other window system. It is the job of the |
130 event_stream layer to translate to this format. | 130 event_stream layer to translate to this format. |
131 | |
132 NOTE: #### All timestamps should be measured as milliseconds since XEmacs | |
133 started. Currently they are raw server timestamps. (The X protocol | |
134 doesn't provide any easy way of translating between server time and | |
135 real process time; yuck.) | |
136 | |
137 Every event type has the following structures: | |
138 | |
139 channel Where this event occurred on. This will be | |
140 a frame, device, console, or nil, depending on the | |
141 event type. It is important that an object of | |
142 a more specific type than is actually generated | |
143 is not substituted -- e.g. there should not be | |
144 a frame inserted when a key-press event occurs, | |
145 because events on dead channels are automatically | |
146 ignored. | |
147 | |
148 Specifically: | |
149 | |
150 -- for button and mouse-motion events, channel | |
151 will be a frame. (The translation to a window | |
152 occurs later.) | |
153 -- for keyboard events, channel will be a console. | |
154 Note that fake keyboard events (generated | |
155 by `character-to-event' or something that | |
156 calls this, such as macros) need to have | |
157 the selected console stored into them when | |
158 the event is created. This is so that the | |
159 correct console-local variables (e.g. the | |
160 command builder) will get affected. | |
161 -- for timer, process, magic-eval, and eval events, | |
162 channel will be nil. | |
163 -- for misc-user events, channel will be a frame. | |
164 -- for magic events, channel will be a frame | |
165 (usually) or a device. | |
166 | |
167 timestamp When this event occurred -- if not known, this | |
168 is made up. | |
169 | |
170 In addition, the following structures are specific to particular event | |
171 types: | |
172 | |
173 key_press_event | |
174 key What keysym this is; an integer or a symbol. | |
175 If this is an integer, it will be in the printing | |
176 ASCII range: >32 and <127. | |
177 modifiers Bucky-bits on that key: control, meta, etc. | |
178 Also includes buttons. | |
179 For many keys, Shift is not a bit; that is implicit | |
180 in the keyboard layout. | |
181 | |
182 button_press_event | |
183 button_release_event | |
184 button What button went down or up. | |
185 modifiers Bucky-bits on that button: shift, control, meta, etc. | |
186 Also includes other buttons (not the one pressed). | |
187 x, y Where it was at the button-state-change (in pixels). | |
188 | |
189 pointer_motion_event | |
190 x, y Where it was after it moved (in pixels). | |
191 modifiers Bucky-bits down when the motion was detected. | |
192 | |
193 process_event | |
194 process the XEmacs "process" object in question | |
195 | |
196 timeout_event | |
197 interval_id The ID returned when the associated call to | |
198 add_timeout_cb() was made | |
199 ------ the rest of the fields are filled in by XEmacs ----- | |
200 id_number The XEmacs timeout ID for this timeout (more | |
201 than one timeout event can have the same value | |
202 here, since XEmacs timeouts, as opposed to | |
203 add_timeout_cb() timeouts, can resignal | |
204 themselves) | |
205 function An elisp function to call when this timeout is | |
206 processed. | |
207 object The object passed to that function. | |
208 | |
209 eval_event | |
210 function An elisp function to call with this event object. | |
211 internal_function An unexported function to call with this event | |
212 object. This allows eval events to call internal | |
213 functions. For a normal eval event, this field | |
214 will always be 0. | |
215 object Anything. | |
216 This kind of event is used internally; sometimes the | |
217 window system interface would like to inform XEmacs of | |
218 some user action (such as focusing on another frame) | |
219 but needs that to happen synchronously with the other | |
220 user input, like keypresses. This is useful when | |
221 events are reported through callbacks rather | |
222 than in the standard event stream. | |
223 | |
224 misc_user_event | |
225 function An elisp function to call with this event object. | |
226 internal_function Ignored. | |
227 object Anything. | |
228 button What button went down or up. | |
229 modifiers Bucky-bits on that button: shift, control, meta, etc. | |
230 x, y Where it was at the button-state-change (in pixels). | |
231 This is similar to an eval_event, except that it is | |
232 generated by user actions: selections in the | |
233 menubar, scrollbar actions, or drag and drop actions. | |
234 It is a "command" event, like key and mouse presses | |
235 (and unlike mouse motion, process output, and enter | |
236 and leave window hooks). In many ways, eval_events | |
237 are not the same as keypresses or misc_user_events. | |
238 The button, modifiers, x, and y parts are only used | |
239 by the XEmacs Drag'n'Drop system. Don't depend on their | |
240 values for other types of misc_user_events. | |
241 | |
242 magic_event | |
243 No user-serviceable parts within. This is for things | |
244 like KeymapNotify and ExposeRegion events and so on | |
245 that XEmacs itself doesn't care about, but which it | |
246 must do something with for proper interaction with | |
247 the window system. | |
248 | |
249 Magic_events are handled somewhat asynchronously, just | |
250 like subprocess filters. However, occasionally a | |
251 magic_event needs to be handled synchronously; in that | |
252 case, the asynchronous handling of the magic_event will | |
253 push an eval_event back onto the queue, which will be | |
254 handled synchronously later. This is one of the | |
255 reasons why eval_events exist; I'm not entirely happy | |
256 with this aspect of this event model. | |
257 | |
258 magic_eval_event | |
259 This is like an eval event but its contents are | |
260 not Lisp-accessible. This allows for "internal | |
261 eval events" that call non-Lisp-accessible functions. | |
262 Externally, a magic_eval_event just appears as | |
263 a magic_event; the Lisp programmer need not know | |
264 anything more. | |
265 | |
266 */ | 131 */ |
267 | 132 |
268 /* | 133 /* |
269 Stream pairs description | 134 Stream pairs description |
270 ------------------------ | 135 ------------------------ |
362 } emacs_event_type; | 227 } emacs_event_type; |
363 | 228 |
364 #define first_event_type empty_event | 229 #define first_event_type empty_event |
365 #define last_event_type dead_event | 230 #define last_event_type dead_event |
366 | 231 |
232 #ifdef MULE | |
233 | |
234 enum alternative_key_chars | |
235 { | |
236 KEYCHAR_CURRENT_LANGENV, | |
237 KEYCHAR_DEFAULT_USER, | |
238 KEYCHAR_DEFAULT_SYSTEM, | |
239 KEYCHAR_UNDERLYING_VIRTUAL_KEY_CURRENT_LANGENV, | |
240 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_USER, | |
241 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_SYSTEM, | |
242 KEYCHAR_QWERTY, | |
243 KEYCHAR_LAST | |
244 }; | |
245 | |
246 #endif /* MULE */ | |
367 | 247 |
368 struct key_data | 248 struct key_data |
369 { | 249 { |
370 Lisp_Object keysym; | 250 /* What keysym this is; a character or a symbol. */ |
371 int modifiers; | 251 Lisp_Object keysym; |
252 /* Modifiers held down when key was pressed: control, meta, etc. | |
253 Also includes buttons. For many keys, Shift is not a bit; that | |
254 is implicit in the keyboard layout. */ | |
255 int modifiers; | |
256 #ifdef MULE | |
257 /* Alternate character interpretations for this key in different | |
258 keyboard layouts. This deals with the problem of pressing C-x in | |
259 the Russian layout (the so-called "Russian C-x problem"), for | |
260 example: `x' gets mapped to a Cyrillic character, so what do we | |
261 do? For that matter, what about `C-x b'? What we do is look the | |
262 key up in the default locales (current language environment, user | |
263 default, system default), then check to see if the underlying | |
264 virtual key is alphabetic in the same three defaults, then | |
265 finally check US ASCII. We ignore the underlying virtual key for | |
266 the current layout to avoid the problem of a French speaker | |
267 (AZERTY layout) who temporarily switches to Russian: The virtual | |
268 keys underlying Russian are US-ASCII, so what the French speaker | |
269 things of as C-a (the key just to the right of TAB) appears as | |
270 C-q. (#### We should probably ignore the current char and look | |
271 *ONLY* in alt_keychars for all control keys. What about the | |
272 English speaker who temporarily switches to the French layout and | |
273 finds C-q mapped to C-a?) */ | |
274 Emchar alt_keychars[KEYCHAR_LAST]; | |
275 #endif /* MULE */ | |
372 }; | 276 }; |
373 | 277 |
374 struct button_data | 278 struct button_data |
375 { | 279 { |
376 int button; | 280 /* What button went down or up. */ |
377 int modifiers; | 281 int button; |
378 int x, y; | 282 /* Bucky-bits on that button: shift, control, meta, etc. Also |
283 includes other buttons (not the one pressed). */ | |
284 int modifiers; | |
285 /* Where it was at the button-state-change (in pixels). */ | |
286 int x, y; | |
379 }; | 287 }; |
380 | 288 |
381 struct motion_data | 289 struct motion_data |
382 { | 290 { |
383 int x, y; | 291 /* Where it was after it moved (in pixels). */ |
384 int modifiers; | 292 int x, y; |
293 /* Bucky-bits down when the motion was detected. */ | |
294 int modifiers; | |
385 }; | 295 }; |
386 | 296 |
387 struct process_data | 297 struct process_data |
388 { | 298 { |
389 Lisp_Object process; | 299 /* the XEmacs "process" object in question */ |
300 Lisp_Object process; | |
390 }; | 301 }; |
391 | 302 |
392 struct timeout_data | 303 struct timeout_data |
393 { | 304 { |
394 int interval_id; | 305 /* |
395 int id_number; | 306 interval_id The ID returned when the associated call to |
396 Lisp_Object function; | 307 add_timeout_cb() was made |
397 Lisp_Object object; | 308 ------ the rest of the fields are filled in by XEmacs ----- |
309 id_number The XEmacs timeout ID for this timeout (more | |
310 than one timeout event can have the same value | |
311 here, since XEmacs timeouts, as opposed to | |
312 add_timeout_cb() timeouts, can resignal | |
313 themselves) | |
314 function An elisp function to call when this timeout is | |
315 processed. | |
316 object The object passed to that function. | |
317 */ | |
318 int interval_id; | |
319 int id_number; | |
320 Lisp_Object function; | |
321 Lisp_Object object; | |
398 }; | 322 }; |
399 | 323 |
400 struct eval_data | 324 struct eval_data |
401 { | 325 { |
402 Lisp_Object function; | 326 /* This kind of event is used internally; sometimes the window system |
403 Lisp_Object object; | 327 interface would like to inform XEmacs of some user action (such as |
328 focusing on another frame) but needs that to happen synchronously | |
329 with the other user input, like keypresses. This is useful when | |
330 events are reported through callbacks rather than in the standard | |
331 event stream. | |
332 | |
333 function An elisp function to call with this event object. | |
334 object Argument of function. | |
335 */ | |
336 Lisp_Object function; | |
337 Lisp_Object object; | |
404 }; | 338 }; |
405 | 339 |
406 struct misc_user_data | 340 struct misc_user_data |
407 { | 341 { |
408 Lisp_Object function; | 342 /* #### The misc-user type is serious junk. It should be separated |
409 Lisp_Object object; | 343 out into different events. There's no reason to create |
410 int button; | 344 sub-subtypes of events. |
411 int modifiers; | 345 |
412 int x, y; | 346 function An elisp function to call with this event object. |
347 object Argument of function. | |
348 button What button went down or up. | |
349 modifiers Bucky-bits on that button: shift, control, meta, etc. | |
350 x, y Where it was at the button-state-change (in pixels). | |
351 This is similar to an eval_event, except that it is | |
352 generated by user actions: selections in the | |
353 menubar, scrollbar actions, or drag and drop actions. | |
354 It is a "command" event, like key and mouse presses | |
355 (and unlike mouse motion, process output, and enter | |
356 and leave window hooks). In many ways, eval_events | |
357 are not the same as keypresses or misc_user_events. | |
358 The button, modifiers, x, and y parts are only used | |
359 by the XEmacs Drag'n'Drop system. Don't depend on their | |
360 values for other types of misc_user_events. | |
361 */ | |
362 Lisp_Object function; | |
363 Lisp_Object object; | |
364 int button; | |
365 int modifiers; | |
366 int x, y; | |
413 }; | 367 }; |
414 | 368 |
415 struct magic_eval_data | 369 struct magic_eval_data |
416 { | 370 { |
417 void (*internal_function) (Lisp_Object); | 371 /* This is like an eval event but its contents are not |
418 Lisp_Object object; | 372 Lisp-accessible. This allows for "internal eval events" that call |
373 non-Lisp-accessible functions. Externally, a magic_eval_event just | |
374 appears as a magic_event; the Lisp programmer need not know | |
375 anything more. | |
376 | |
377 internal_function An unexported function to call with this event | |
378 object. This allows eval events to call internal | |
379 functions. For a normal eval event, this field | |
380 will always be 0. | |
381 object Argument of function. | |
382 | |
383 */ | |
384 void (*internal_function) (Lisp_Object); | |
385 Lisp_Object object; | |
419 }; | 386 }; |
420 | 387 |
421 #if defined (HAVE_X_WINDOWS) && defined(emacs) | 388 #if defined (HAVE_X_WINDOWS) && defined(emacs) |
422 # include <X11/Xlib.h> | 389 # include <X11/Xlib.h> |
423 #endif | 390 #endif |
426 #include <gdk/gdk.h> | 393 #include <gdk/gdk.h> |
427 #endif | 394 #endif |
428 | 395 |
429 union magic_data | 396 union magic_data |
430 { | 397 { |
398 /* No user-serviceable parts within. This is for things like | |
399 KeymapNotify and ExposeRegion events and so on that XEmacs itself | |
400 doesn't care about, but which it must do something with for proper | |
401 interaction with the window system. | |
402 | |
403 Magic_events are handled somewhat asynchronously, just like | |
404 subprocess filters. However, occasionally a magic_event needs to | |
405 be handled synchronously; in that case, the asynchronous handling | |
406 of the magic_event will push an eval_event back onto the queue, | |
407 which will be handled synchronously later. This is one of the | |
408 reasons why eval_events exist; I'm not entirely happy with this | |
409 aspect of this event model. | |
410 */ | |
411 | |
431 #ifdef HAVE_TTY | 412 #ifdef HAVE_TTY |
432 char underlying_tty_event; | 413 char underlying_tty_event; |
433 #endif | 414 #endif |
434 #ifdef HAVE_GTK | 415 #ifdef HAVE_GTK |
435 GdkEvent underlying_gdk_event; | 416 GdkEvent underlying_gdk_event; |
436 #endif | 417 #endif |
437 #ifdef HAVE_X_WINDOWS | 418 #ifdef HAVE_X_WINDOWS |
438 XEvent underlying_x_event; | 419 XEvent underlying_x_event; |
439 #endif | 420 #endif |
440 #ifdef HAVE_MS_WINDOWS | 421 #ifdef HAVE_MS_WINDOWS |
441 int underlying_mswindows_event; | 422 int underlying_mswindows_event; |
442 #endif | 423 #endif |
443 }; | 424 }; |
444 | 425 |
445 struct Lisp_Timeout | 426 struct Lisp_Timeout |
446 { | 427 { |
447 struct lcrecord_header header; | 428 struct lcrecord_header header; |
448 int id; /* Id we use to identify the timeout over its lifetime */ | 429 int id; /* Id we use to identify the timeout over its lifetime */ |
449 int interval_id; /* Id for this particular interval; this may | 430 int interval_id; /* Id for this particular interval; this may |
450 be different each time the timeout is | 431 be different each time the timeout is |
451 signalled.*/ | 432 signalled.*/ |
452 Lisp_Object function, object; /* Function and object associated | 433 Lisp_Object function, object; /* Function and object associated |
453 with timeout. */ | 434 with timeout. */ |
454 EMACS_TIME next_signal_time; /* Absolute time when the timeout | 435 EMACS_TIME next_signal_time; /* Absolute time when the timeout |
455 is next going to be signalled. */ | 436 is next going to be signalled. */ |
456 unsigned int resignal_msecs; /* How far after the next timeout | 437 unsigned int resignal_msecs; /* How far after the next timeout |
457 should the one after that | 438 should the one after that |
458 occur? */ | 439 occur? */ |
459 }; | 440 }; |
460 typedef struct Lisp_Timeout Lisp_Timeout; | 441 typedef struct Lisp_Timeout Lisp_Timeout; |
461 | 442 |
462 DECLARE_LRECORD (timeout, Lisp_Timeout); | 443 DECLARE_LRECORD (timeout, Lisp_Timeout); |
463 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout) | 444 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout) |
474 - For events on the command_event_queue, the next one on the queue. | 455 - For events on the command_event_queue, the next one on the queue. |
475 - Likewise for events chained in the command builder. | 456 - Likewise for events chained in the command builder. |
476 - Otherwise it's Qnil. | 457 - Otherwise it's Qnil. |
477 */ | 458 */ |
478 struct lrecord_header lheader; | 459 struct lrecord_header lheader; |
479 Lisp_Object next; | 460 Lisp_Object next; |
480 emacs_event_type event_type; | 461 emacs_event_type event_type; |
481 Lisp_Object channel; | 462 |
482 unsigned int timestamp; | 463 /* Where this event occurred on. This will be a frame, device, |
464 console, or nil, depending on the event type. It is important | |
465 that an object of a more specific type than is actually generated | |
466 is not substituted -- e.g. there should not be a frame inserted | |
467 when a key-press event occurs, because events on dead channels | |
468 are automatically ignored. | |
469 | |
470 Specifically: | |
471 | |
472 -- for button and mouse-motion events, channel will be a | |
473 frame. (The translation to a window occurs later.) | |
474 | |
475 -- for keyboard events, channel will be a console. Note that | |
476 fake keyboard events (generated by `character-to-event' or | |
477 something that calls this, such as macros) need to have the | |
478 selected console stored into them when the event is created. | |
479 This is so that the correct console-local variables (e.g. the | |
480 command builder) will get affected. | |
481 | |
482 -- for timer, process, magic-eval, and eval events, channel will | |
483 be nil. | |
484 | |
485 -- for misc-user events, channel will be a frame. | |
486 | |
487 -- for magic events, channel will be a frame (usually) or a | |
488 device. */ | |
489 Lisp_Object channel; | |
490 | |
491 /* When this event occurred -- if not known, this is made up. #### | |
492 All timestamps should be measured as milliseconds since XEmacs | |
493 started. Currently they are raw server timestamps. (The X | |
494 protocol doesn't provide any easy way of translating between | |
495 server time and real process time; yuck.) */ | |
496 | |
497 unsigned int timestamp; | |
483 union | 498 union |
484 { | 499 { |
485 struct key_data key; | 500 struct key_data key; |
486 struct button_data button; | 501 struct button_data button; |
487 struct motion_data motion; | 502 struct motion_data motion; |
488 struct process_data process; | 503 struct process_data process; |
489 struct timeout_data timeout; | 504 struct timeout_data timeout; |
490 struct eval_data eval; /* misc_user_event no longer uses this */ | 505 struct eval_data eval; /* misc_user_event no longer uses this */ |
491 struct misc_user_data misc; /* because it needs position information */ | 506 struct misc_user_data misc; /* because it needs position information */ |
492 union magic_data magic; | 507 union magic_data magic; |
493 struct magic_eval_data magic_eval; | 508 struct magic_eval_data magic_eval; |
494 } event; | 509 } event; |
495 }; | 510 }; |
496 | 511 |
497 DECLARE_LRECORD (event, Lisp_Event); | 512 DECLARE_LRECORD (event, Lisp_Event); |
498 #define XEVENT(x) XRECORD (x, event, Lisp_Event) | 513 #define XEVENT(x) XRECORD (x, event, Lisp_Event) |
514 #define EVENT_CHAIN_LOOP(event, chain) \ | 529 #define EVENT_CHAIN_LOOP(event, chain) \ |
515 for (event = chain; !NILP (event); event = XEVENT_NEXT (event)) | 530 for (event = chain; !NILP (event); event = XEVENT_NEXT (event)) |
516 | 531 |
517 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event) | 532 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event) |
518 | 533 |
519 #define CHECK_LIVE_EVENT(x) do { \ | 534 #define CHECK_LIVE_EVENT(x) do { \ |
520 CHECK_EVENT (x); \ | 535 CHECK_EVENT (x); \ |
521 if (! EVENT_LIVE_P (XEVENT (x))) \ | 536 if (! EVENT_LIVE_P (XEVENT (x))) \ |
522 dead_wrong_type_argument (Qevent_live_p, (x)); \ | 537 dead_wrong_type_argument (Qevent_live_p, (x)); \ |
523 } while (0) | 538 } while (0) |
524 #define CONCHECK_LIVE_EVENT(x) do { \ | 539 #define CONCHECK_LIVE_EVENT(x) do { \ |
525 CONCHECK_EVENT (x); \ | 540 CONCHECK_EVENT (x); \ |
526 if (! EVENT_LIVE_P (XEVENT (x))) \ | 541 if (! EVENT_LIVE_P (XEVENT (x))) \ |
527 x = wrong_type_argument (Qevent_live_p, (x)); \ | 542 x = wrong_type_argument (Qevent_live_p, (x)); \ |
528 } while (0) | 543 } while (0) |
529 | 544 |
530 | 545 |
531 EXFUN (Fcharacter_to_event, 4); | 546 EXFUN (Fcharacter_to_event, 4); |
532 EXFUN (Fdeallocate_event, 1); | 547 EXFUN (Fdeallocate_event, 1); |
544 extern Lisp_Object Qcancel_mode_internal; | 559 extern Lisp_Object Qcancel_mode_internal; |
545 extern Lisp_Object Vmodifier_keys_sticky_time; | 560 extern Lisp_Object Vmodifier_keys_sticky_time; |
546 | 561 |
547 /* The modifiers XEmacs knows about; these appear in key and button events. */ | 562 /* The modifiers XEmacs knows about; these appear in key and button events. */ |
548 | 563 |
549 #define XEMACS_MOD_CONTROL (1<<0) | 564 #define XEMACS_MOD_CONTROL (1<<0) |
550 #define XEMACS_MOD_META (1<<1) | 565 #define XEMACS_MOD_META (1<<1) |
551 #define XEMACS_MOD_SUPER (1<<2) | 566 #define XEMACS_MOD_SUPER (1<<2) |
552 #define XEMACS_MOD_HYPER (1<<3) | 567 #define XEMACS_MOD_HYPER (1<<3) |
553 #define XEMACS_MOD_ALT (1<<4) | 568 #define XEMACS_MOD_ALT (1<<4) |
554 #define XEMACS_MOD_SHIFT (1<<5) /* not used for dual-case characters */ | 569 #define XEMACS_MOD_SHIFT (1<<5) /* not used for dual-case characters */ |
555 #define XEMACS_MOD_BUTTON1 (1<<6) | 570 #define XEMACS_MOD_BUTTON1 (1<<6) |
556 #define XEMACS_MOD_BUTTON2 (1<<7) | 571 #define XEMACS_MOD_BUTTON2 (1<<7) |
557 #define XEMACS_MOD_BUTTON3 (1<<8) | 572 #define XEMACS_MOD_BUTTON3 (1<<8) |
558 #define XEMACS_MOD_BUTTON4 (1<<9) | 573 #define XEMACS_MOD_BUTTON4 (1<<9) |
559 #define XEMACS_MOD_BUTTON5 (1<<10) | 574 #define XEMACS_MOD_BUTTON5 (1<<10) |
560 | 575 |
561 /* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key | 576 /* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key |
562 if there are both Alt and Meta keys. If there are no Meta keys, | 577 if there are both Alt and Meta keys. If there are no Meta keys, |
563 then Alt generates XEMACS_MOD_META instead. | 578 then Alt generates XEMACS_MOD_META instead. |
564 */ | 579 */ |
568 #define KEYSYM(x) (intern (x)) | 583 #define KEYSYM(x) (intern (x)) |
569 | 584 |
570 /* from events.c */ | 585 /* from events.c */ |
571 void format_event_object (char *buf, Lisp_Event *e, int brief); | 586 void format_event_object (char *buf, Lisp_Event *e, int brief); |
572 void character_to_event (Emchar c, Lisp_Event *event, | 587 void character_to_event (Emchar c, Lisp_Event *event, |
573 struct console *con, | 588 struct console *con, |
574 int use_console_meta_flag, | 589 int use_console_meta_flag, |
575 int do_backspace_mapping); | 590 int do_backspace_mapping); |
576 void zero_event (Lisp_Event *e); | 591 void zero_event (Lisp_Event *e); |
577 void deallocate_event_chain (Lisp_Object event); | 592 void deallocate_event_chain (Lisp_Object event); |
578 Lisp_Object event_chain_tail (Lisp_Object event); | 593 Lisp_Object event_chain_tail (Lisp_Object event); |
579 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); | 594 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); |
580 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); | 595 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); |
581 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, | 596 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, |
582 Lisp_Object *tail); | 597 Lisp_Object *tail); |
583 int event_chain_count (Lisp_Object event_chain); | 598 int event_chain_count (Lisp_Object event_chain); |
599 Lisp_Object transfer_event_chain_pointer (Lisp_Object pointer, | |
600 Lisp_Object old_chain, | |
601 Lisp_Object new_chain); | |
584 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event); | 602 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event); |
585 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq); | 603 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq); |
586 Lisp_Object event_chain_find_previous (Lisp_Object event_chain, | 604 Lisp_Object event_chain_find_previous (Lisp_Object event_chain, |
587 Lisp_Object event); | 605 Lisp_Object event); |
588 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); | 606 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); |
589 Lisp_Object copy_event_chain (Lisp_Object event_chain); | 607 Lisp_Object copy_event_chain (Lisp_Object event_chain); |
590 /* True if this is a non-internal event | 608 /* True if this is a non-internal event |
591 (keyboard press, menu, scrollbar, mouse button) */ | 609 (keyboard press, menu, scrollbar, mouse button) */ |
592 int command_event_p (Lisp_Object event); | 610 int command_event_p (Lisp_Object event); |
593 void define_self_inserting_symbol (Lisp_Object, Lisp_Object); | 611 void define_self_inserting_symbol (Lisp_Object, Lisp_Object); |
594 Emchar event_to_character (Lisp_Event *, int, int, int); | 612 Emchar event_to_character (Lisp_Event *, int, int, int); |
595 struct console *event_console_or_selected (Lisp_Object event); | 613 struct console *event_console_or_selected (Lisp_Object event); |
596 | 614 |
597 /* from event-stream.c */ | 615 /* from event-stream.c */ |
598 Lisp_Object allocate_command_builder (Lisp_Object console); | 616 Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf); |
599 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); | 617 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); |
600 void event_stream_next_event (Lisp_Event *event); | 618 void event_stream_next_event (Lisp_Event *event); |
601 void event_stream_handle_magic_event (Lisp_Event *event); | 619 void event_stream_handle_magic_event (Lisp_Event *event); |
602 void event_stream_select_console (struct console *con); | 620 void event_stream_select_console (struct console *con); |
603 void event_stream_unselect_console (struct console *con); | 621 void event_stream_unselect_console (struct console *con); |
604 void event_stream_select_process (Lisp_Process *proc); | 622 void event_stream_select_process (Lisp_Process *proc); |
605 void event_stream_unselect_process (Lisp_Process *proc); | 623 void event_stream_unselect_process (Lisp_Process *proc); |
606 USID event_stream_create_stream_pair (void* inhandle, void* outhandle, | 624 USID event_stream_create_stream_pair (void* inhandle, void* outhandle, |
607 Lisp_Object* instream, Lisp_Object* outstream, int flags); | 625 Lisp_Object* instream, Lisp_Object* outstream, int flags); |
608 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream); | 626 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream); |
609 void event_stream_quit_p (void); | 627 void event_stream_quit_p (void); |
610 | 628 |
611 struct low_level_timeout | 629 struct low_level_timeout |
612 { | 630 { |
614 EMACS_TIME time; | 632 EMACS_TIME time; |
615 struct low_level_timeout *next; | 633 struct low_level_timeout *next; |
616 }; | 634 }; |
617 | 635 |
618 int add_low_level_timeout (struct low_level_timeout **timeout_list, | 636 int add_low_level_timeout (struct low_level_timeout **timeout_list, |
619 EMACS_TIME thyme); | 637 EMACS_TIME thyme); |
620 void remove_low_level_timeout (struct low_level_timeout **timeout_list, | 638 void remove_low_level_timeout (struct low_level_timeout **timeout_list, |
621 int id); | 639 int id); |
622 int get_low_level_timeout_interval (struct low_level_timeout * | 640 int get_low_level_timeout_interval (struct low_level_timeout * |
623 timeout_list, EMACS_TIME *interval); | 641 timeout_list, EMACS_TIME *interval); |
624 int pop_low_level_timeout (struct low_level_timeout **timeout_list, | 642 int pop_low_level_timeout (struct low_level_timeout **timeout_list, |
625 EMACS_TIME *time_out); | 643 EMACS_TIME *time_out); |
626 int event_stream_generate_wakeup (unsigned int milliseconds, | 644 int event_stream_generate_wakeup (unsigned int milliseconds, |
627 unsigned int vanilliseconds, | 645 unsigned int vanilliseconds, |
628 Lisp_Object function, | 646 Lisp_Object function, |
629 Lisp_Object object, | 647 Lisp_Object object, |
630 int async_p); | 648 int async_p); |
631 int event_stream_resignal_wakeup (int interval_id, int async_p, | 649 int event_stream_resignal_wakeup (int interval_id, int async_p, |
632 Lisp_Object *function, Lisp_Object *object); | 650 Lisp_Object *function, Lisp_Object *object); |
633 void event_stream_disable_wakeup (int id, int async_p); | 651 void event_stream_disable_wakeup (int id, int async_p); |
634 | 652 |
635 /* from signal.c */ | 653 /* from signal.c */ |
636 int signal_add_async_interval_timeout (EMACS_TIME thyme); | 654 int signal_add_async_interval_timeout (EMACS_TIME thyme); |
637 void signal_remove_async_interval_timeout (int id); | 655 void signal_remove_async_interval_timeout (int id); |
668 int event_stream_unixoid_select_console (struct console *con); | 686 int event_stream_unixoid_select_console (struct console *con); |
669 int event_stream_unixoid_unselect_console (struct console *con); | 687 int event_stream_unixoid_unselect_console (struct console *con); |
670 int event_stream_unixoid_select_process (Lisp_Process *proc); | 688 int event_stream_unixoid_select_process (Lisp_Process *proc); |
671 int event_stream_unixoid_unselect_process (Lisp_Process *proc); | 689 int event_stream_unixoid_unselect_process (Lisp_Process *proc); |
672 int read_event_from_tty_or_stream_desc (Lisp_Event *event, | 690 int read_event_from_tty_or_stream_desc (Lisp_Event *event, |
673 struct console *con, int fd); | 691 struct console *con); |
674 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, | 692 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle, |
675 Lisp_Object* instream, | 693 Lisp_Object* instream, |
676 Lisp_Object* outstream, | 694 Lisp_Object* outstream, |
677 int flags); | 695 int flags); |
678 USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream, | 696 USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream, |
679 Lisp_Object outstream); | 697 Lisp_Object outstream); |
680 | 698 |
681 /* Beware: this evil macro evaluates its arg many times */ | 699 /* Beware: this evil macro evaluates its arg many times */ |
682 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd))) | 700 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd))) |
683 | 701 |
684 #endif /* HAVE_UNIXOID_EVENT_LOOP */ | 702 #endif /* HAVE_UNIXOID_EVENT_LOOP */ |
698 */ | 716 */ |
699 struct command_builder | 717 struct command_builder |
700 { | 718 { |
701 struct lcrecord_header header; | 719 struct lcrecord_header header; |
702 Lisp_Object console; /* back pointer to the console this command | 720 Lisp_Object console; /* back pointer to the console this command |
703 builder is for */ | 721 builder is for */ |
704 /* Qnil, or a Lisp_Event representing the first event read | 722 #if 0 |
705 * after the last command completed. Threaded. */ | 723 /* #### Not implemented: nil, or an event representing the first |
706 /* #### NYI */ | 724 event read after the last command completed. Threaded. */ |
707 Lisp_Object prefix_events; | 725 Lisp_Object prefix_events; |
708 /* Qnil, or a Lisp_Event representing event in the current | 726 #endif /* 0 */ |
709 * keymap-lookup sequence. Subsequent events are threaded via | 727 /* nil, or an event chain representing the events in the current |
710 * the event's next slot */ | 728 keymap-lookup sequence. NOTE: All events in the chain MUST be |
729 freshly allocated, with no pointers to them elsewhere. */ | |
711 Lisp_Object current_events; | 730 Lisp_Object current_events; |
712 /* Last elt of above */ | 731 /* Last elt of current_events */ |
713 Lisp_Object most_current_event; | 732 Lisp_Object most_current_event; |
714 /* Last elt before function map code took over. What this means is: | 733 /* Last elt before function map code took over. What this means is: |
715 All prefixes up to (but not including) this event have non-nil | 734 All prefixes up to (but not including) this event have non-nil |
716 bindings, but the prefix including this event has a nil binding. | 735 bindings, but the prefix including this event has a nil binding. |
717 Any events in the chain after this one were read solely because | 736 Any events in the chain after this one were read solely because |
718 we're part of a possible function key. If we end up with | 737 we're part of a possible function key. If we end up with |
719 something that's not part of a possible function key, we have to | 738 something that's not part of a possible function key, we have to |
735 } munge_me[2]; | 754 } munge_me[2]; |
736 | 755 |
737 Intbyte *echo_buf; | 756 Intbyte *echo_buf; |
738 Bytecount echo_buf_length; /* size of echo_buf */ | 757 Bytecount echo_buf_length; /* size of echo_buf */ |
739 Bytecount echo_buf_index; /* index into echo_buf | 758 Bytecount echo_buf_index; /* index into echo_buf |
740 * -1 before doing echoing for new cmd */ | 759 * -1 before doing echoing for new cmd */ |
741 /* Self-insert-command is magic in that it doesn't always push an undo- | 760 /* Self-insert-command is magic in that it doesn't always push an undo- |
742 boundary: up to 20 consecutive self-inserts can happen before an undo- | 761 boundary: up to 20 consecutive self-inserts can happen before an undo- |
743 boundary is pushed. This variable is that counter. | 762 boundary is pushed. This variable is that counter. |
744 */ | 763 */ |
745 int self_insert_countdown; | 764 int self_insert_countdown; |