Mercurial > hg > xemacs-beta
comparison src/events.h @ 934:c925bacdda60
[xemacs-hg @ 2002-07-29 09:21:12 by michaels]
2002-07-17 Marcus Crestani <crestani@informatik.uni-tuebingen.de>
Markus Kaltenbach <makalten@informatik.uni-tuebingen.de>
Mike Sperber <mike@xemacs.org>
configure flag to turn these changes on: --use-kkcc
First we added a dumpable flag to lrecord_implementation. It shows,
if the object is dumpable and should be processed by the dumper.
* lrecord.h (struct lrecord_implementation): added dumpable flag
(MAKE_LRECORD_IMPLEMENTATION): fitted the different makro definitions
to the new lrecord_implementation and their calls.
Then we changed mark_object, that it no longer needs a mark method for
those types that have pdump descritions.
* alloc.c:
(mark_object): If the object has a description, the new mark algorithm
is called, and the object is marked according to its description.
Otherwise it uses the mark method like before.
These procedures mark objects according to their descriptions. They
are modeled on the corresponding pdumper procedures.
(mark_with_description):
(get_indirect_count):
(structure_size):
(mark_struct_contents):
These procedures still call mark_object, this is needed while there are
Lisp_Objects without descriptions left.
We added pdump descriptions for many Lisp_Objects:
* extents.c: extent_auxiliary_description
* database.c: database_description
* gui.c: gui_item_description
* scrollbar.c: scrollbar_instance_description
* toolbar.c: toolbar_button_description
* event-stream.c: command_builder_description
* mule-charset.c: charset_description
* device-msw.c: devmode_description
* dialog-msw.c: mswindows_dialog_id_description
* eldap.c: ldap_description
* postgresql.c: pgconn_description
pgresult_description
* tooltalk.c: tooltalk_message_description
tooltalk_pattern_description
* ui-gtk.c: emacs_ffi_description
emacs_gtk_object_description
* events.c:
* events.h:
* event-stream.c:
* event-Xt.c:
* event-gtk.c:
* event-tty.c:
To write a pdump description for Lisp_Event, we converted every struct
in the union event to a Lisp_Object. So we created nine new
Lisp_Objects: Lisp_Key_Data, Lisp_Button_Data, Lisp_Motion_Data,
Lisp_Process_Data, Lisp_Timeout_Data, Lisp_Eval_Data,
Lisp_Misc_User_Data, Lisp_Magic_Data, Lisp_Magic_Eval_Data.
We also wrote makro selectors and mutators for the fields of the new
designed Lisp_Event and added everywhere these new abstractions.
We implemented XD_UNION support in (mark_with_description), so
we can describe exspecially console/device specific data with XD_UNION.
To describe with XD_UNION, we added a field to these objects, which
holds the variant type of the object. This field is initialized in
the appendant constructor. The variant is an integer, it has also to
be described in an description, if XD_UNION is used.
XD_UNION is used in following descriptions:
* console.c: console_description
(get_console_variant): returns the variant
(create_console): added variant initialization
* console.h (console_variant): the different console types
* console-impl.h (struct console): added enum console_variant contype
* device.c: device_description
(Fmake_device): added variant initialization
* device-impl.h (struct device): added enum console_variant devtype
* objects.c: image_instance_description
font_instance_description
(Fmake_color_instance): added variant initialization
(Fmake_font_instance): added variant initialization
* objects-impl.h (struct Lisp_Color_Instance): added color_instance_type
* objects-impl.h (struct Lisp_Font_Instance): added font_instance_type
* process.c: process_description
(make_process_internal): added variant initialization
* process.h (process_variant): the different process types
author | michaels |
---|---|
date | Mon, 29 Jul 2002 09:21:25 +0000 |
parents | 804517e16990 |
children | 4a2ad9252ff5 |
comparison
equal
deleted
inserted
replaced
933:f6bc42928b34 | 934:c925bacdda60 |
---|---|
24 | 24 |
25 #ifndef INCLUDED_events_h_ | 25 #ifndef INCLUDED_events_h_ |
26 #define INCLUDED_events_h_ | 26 #define INCLUDED_events_h_ |
27 | 27 |
28 #include "systime.h" | 28 #include "systime.h" |
29 | |
30 #ifdef USE_KKCC | |
31 #include "opaque.h" | |
32 #endif /* USE_KKCC */ | |
29 | 33 |
30 /* There is one object called an event_stream. This object contains | 34 /* There is one object called an event_stream. This object contains |
31 callback functions for doing the window-system-dependent operations | 35 callback functions for doing the window-system-dependent operations |
32 that XEmacs requires. | 36 that XEmacs requires. |
33 | 37 |
225 #define STREAM_PTY_FLUSHING 0x0001 | 229 #define STREAM_PTY_FLUSHING 0x0001 |
226 #define STREAM_NETWORK_CONNECTION 0x0002 | 230 #define STREAM_NETWORK_CONNECTION 0x0002 |
227 | 231 |
228 extern struct event_stream *event_stream; | 232 extern struct event_stream *event_stream; |
229 | 233 |
234 #ifdef USE_KKCC | |
235 Lisp_Object make_key_data (void); | |
236 Lisp_Object make_button_data (void); | |
237 Lisp_Object make_motion_data (void); | |
238 Lisp_Object make_process_data (void); | |
239 Lisp_Object make_timeout_data (void); | |
240 Lisp_Object make_magic_data (void); | |
241 Lisp_Object make_magic_eval_data (void); | |
242 Lisp_Object make_eval_data (void); | |
243 Lisp_Object make_misc_user_data (void); | |
244 #endif USE_KKCC | |
245 | |
230 typedef enum emacs_event_type | 246 typedef enum emacs_event_type |
231 { | 247 { |
232 empty_event, | 248 empty_event, |
233 key_press_event, | 249 key_press_event, |
234 button_press_event, | 250 button_press_event, |
260 KEYCHAR_LAST | 276 KEYCHAR_LAST |
261 }; | 277 }; |
262 | 278 |
263 #endif /* MULE */ | 279 #endif /* MULE */ |
264 | 280 |
281 #ifdef USE_KKCC | |
282 struct Lisp_Key_Data | |
283 #else /* not USE_KKCC */ | |
265 struct key_data | 284 struct key_data |
266 { | 285 #endif /* not USE_KKCC */ |
286 { | |
287 #ifdef USE_KKCC | |
288 struct lrecord_header lheader; | |
289 #endif /* USE_KKCC */ | |
267 /* What keysym this is; a character or a symbol. */ | 290 /* What keysym this is; a character or a symbol. */ |
268 Lisp_Object keysym; | 291 Lisp_Object keysym; |
269 /* Modifiers held down when key was pressed: control, meta, etc. | 292 /* Modifiers held down when key was pressed: control, meta, etc. |
270 Also includes buttons. For many keys, Shift is not a bit; that | 293 Also includes buttons. For many keys, Shift is not a bit; that |
271 is implicit in the keyboard layout. */ | 294 is implicit in the keyboard layout. */ |
290 finds C-q mapped to C-a?) */ | 313 finds C-q mapped to C-a?) */ |
291 Ichar alt_keychars[KEYCHAR_LAST]; | 314 Ichar alt_keychars[KEYCHAR_LAST]; |
292 #endif /* MULE */ | 315 #endif /* MULE */ |
293 }; | 316 }; |
294 | 317 |
318 #ifdef USE_KKCC | |
319 typedef struct Lisp_Key_Data Lisp_Key_Data; | |
320 | |
321 DECLARE_LRECORD (key_data, Lisp_Key_Data); | |
322 #define XKEY_DATA(x) XRECORD (x, key_data, Lisp_Key_Data) | |
323 #define wrap_key_data(p) wrap_record (p, key_data) | |
324 #define KEY_DATAP(x) RECORDP (x, key_data) | |
325 #define CHECK_KEY_DATA(x) CHECK_RECORD (x, key_data) | |
326 #define CONCHECK_KEY_DATA(x) CONCHECK_RECORD (x, key_data) | |
327 | |
328 #define XKEY_DATA_KEYSYM(d) (XKEY_DATA (d)->keysym) | |
329 #define KEY_DATA_KEYSYM(d) ((d)->keysym) | |
330 #define XKEY_DATA_MODIFIERS(d) (XKEY_DATA (d)->modifiers) | |
331 #define KEY_DATA_MODIFIERS(d) ((d)->modifiers) | |
332 | |
333 #define XSET_KEY_DATA_KEYSYM(d, k) (XKEY_DATA (d)->keysym = (k)) | |
334 #define SET_KEY_DATA_KEYSYM(d, k) ((d)->keysym = k) | |
335 #define XSET_KEY_DATA_MODIFIERS(d, m) (XKEY_DATA (d)->modifiers = m) | |
336 #define SET_KEY_DATA_MODIFIERS(d, m) ((d)->modifiers = m) | |
337 #endif /* USE_KKCC */ | |
338 | |
339 #ifdef USE_KKCC | |
340 struct Lisp_Button_Data | |
341 #else /* not USE_KKCC */ | |
295 struct button_data | 342 struct button_data |
296 { | 343 #endif /* not USE_KKCC */ |
344 { | |
345 #ifdef USE_KKCC | |
346 struct lrecord_header lheader; | |
347 #endif /* USE_KKCC */ | |
297 /* What button went down or up. */ | 348 /* What button went down or up. */ |
298 int button; | 349 int button; |
299 /* Bucky-bits on that button: shift, control, meta, etc. Also | 350 /* Bucky-bits on that button: shift, control, meta, etc. Also |
300 includes other buttons (not the one pressed). */ | 351 includes other buttons (not the one pressed). */ |
301 int modifiers; | 352 int modifiers; |
302 /* Where it was at the button-state-change (in pixels). */ | 353 /* Where it was at the button-state-change (in pixels). */ |
303 int x, y; | 354 int x, y; |
304 }; | 355 }; |
305 | 356 #ifdef USE_KKCC |
357 typedef struct Lisp_Button_Data Lisp_Button_Data; | |
358 | |
359 DECLARE_LRECORD (button_data, Lisp_Button_Data); | |
360 #define XBUTTON_DATA(x) XRECORD (x, button_data, Lisp_Button_Data) | |
361 #define wrap_button_data(p) wrap_record (p, button_data) | |
362 #define BUTTON_DATAP(x) RECORDP (x, button_data) | |
363 #define CHECK_BUTTON_DATA(x) CHECK_RECORD (x, button_data) | |
364 #define CONCHECK_BUTTON_DATA(x) CONCHECK_RECORD (x, button_data) | |
365 | |
366 #define XBUTTON_DATA_BUTTON(d) (XBUTTON_DATA (d)->button) | |
367 #define XBUTTON_DATA_MODIFIERS(d) (XBUTTON_DATA (d)->modifiers) | |
368 #define XBUTTON_DATA_X(d) (XBUTTON_DATA (d)->x) | |
369 #define XBUTTON_DATA_Y(d) (XBUTTON_DATA (d)->y) | |
370 | |
371 #define XSET_BUTTON_DATA_BUTTON(d, b) (XBUTTON_DATA (d)->button = (b)) | |
372 #define XSET_BUTTON_DATA_MODIFIERS(d, m) (XBUTTON_DATA (d)->modifiers = (m)) | |
373 #define XSET_BUTTON_DATA_X(d, new_x) (XBUTTON_DATA (d)->x = (new_x)) | |
374 #define XSET_BUTTON_DATA_Y(d, new_y) (XBUTTON_DATA (d)->y = (new_y)) | |
375 #endif /* USE_KKCC */ | |
376 | |
377 #ifdef USE_KKCC | |
378 struct Lisp_Motion_Data | |
379 #else /* not USE_KKCC */ | |
306 struct motion_data | 380 struct motion_data |
307 { | 381 #endif /* not USE_KKCC */ |
382 { | |
383 #ifdef USE_KKCC | |
384 struct lrecord_header lheader; | |
385 #endif /* USE_KKCC */ | |
308 /* Where it was after it moved (in pixels). */ | 386 /* Where it was after it moved (in pixels). */ |
309 int x, y; | 387 int x, y; |
310 /* Bucky-bits down when the motion was detected. */ | 388 /* Bucky-bits down when the motion was detected. */ |
311 int modifiers; | 389 int modifiers; |
312 }; | 390 }; |
313 | 391 #ifdef USE_KKCC |
392 typedef struct Lisp_Motion_Data Lisp_Motion_Data; | |
393 | |
394 DECLARE_LRECORD (motion_data, Lisp_Motion_Data); | |
395 #define XMOTION_DATA(x) XRECORD (x, motion_data, Lisp_Motion_Data) | |
396 #define wrap_motion_data(p) wrap_record (p, motion_data) | |
397 #define MOTION_DATAP(x) RECORDP (x, motion_data) | |
398 #define CHECK_MOTION_DATA(x) CHECK_RECORD (x, motion_data) | |
399 #define CONCHECK_MOTION_DATA(x) CONCHECK_RECORD (x, motion_data) | |
400 | |
401 #define XMOTION_DATA_X(d) (XMOTION_DATA (d)->x) | |
402 #define XMOTION_DATA_Y(d) (XMOTION_DATA (d)->y) | |
403 #define XMOTION_DATA_MODIFIERS(d) (XMOTION_DATA (d)->modifiers) | |
404 | |
405 #define XSET_MOTION_DATA_X(d, new_x) (XMOTION_DATA (d)->x = (new_x)) | |
406 #define XSET_MOTION_DATA_Y(d, new_y) (XMOTION_DATA (d)->y = (new_y)) | |
407 #define XSET_MOTION_DATA_MODIFIERS(d, m) (XMOTION_DATA (d)->modifiers = (m)) | |
408 #endif /* USE_KKCC */ | |
409 | |
410 #ifdef USE_KKCC | |
411 struct Lisp_Process_Data | |
412 #else /* not USE_KKCC */ | |
314 struct process_data | 413 struct process_data |
315 { | 414 #endif /* not USE_KKCC */ |
415 { | |
416 #ifdef USE_KKCC | |
417 struct lrecord_header lheader; | |
418 #endif /* USE_KKCC */ | |
316 /* the XEmacs "process" object in question */ | 419 /* the XEmacs "process" object in question */ |
317 Lisp_Object process; | 420 Lisp_Object process; |
318 }; | 421 }; |
319 | 422 #ifdef USE_KKCC |
423 typedef struct Lisp_Process_Data Lisp_Process_Data; | |
424 | |
425 DECLARE_LRECORD (process_data, Lisp_Process_Data); | |
426 #define XPROCESS_DATA(x) XRECORD (x, process_data, Lisp_Process_Data) | |
427 #define wrap_process_data(p) wrap_record (p, process_data) | |
428 #define PROCESS_DATAP(x) RECORDP (x, process_data) | |
429 #define CHECK_PROCESS_DATA(x) CHECK_RECORD (x, process_data) | |
430 #define CONCHECK_PROCESS_DATA(x) CONCHECK_RECORD (x, process_data) | |
431 | |
432 #define XPROCESS_DATA_PROCESS(d) (XPROCESS_DATA (d)->process) | |
433 #define XSET_PROCESS_DATA_PROCESS(d, p) (XPROCESS_DATA (d)->process = (p)) | |
434 #endif /* USE_KKCC */ | |
435 | |
436 #ifdef USE_KKCC | |
437 struct Lisp_Timeout_Data | |
438 #else /* not USE_KKCC */ | |
320 struct timeout_data | 439 struct timeout_data |
440 #endif /* not USE_KKCC */ | |
321 { | 441 { |
322 /* | 442 /* |
323 interval_id The ID returned when the associated call to | 443 interval_id The ID returned when the associated call to |
324 add_timeout_cb() was made | 444 add_timeout_cb() was made |
325 ------ the rest of the fields are filled in by XEmacs ----- | 445 ------ the rest of the fields are filled in by XEmacs ----- |
330 themselves) | 450 themselves) |
331 function An elisp function to call when this timeout is | 451 function An elisp function to call when this timeout is |
332 processed. | 452 processed. |
333 object The object passed to that function. | 453 object The object passed to that function. |
334 */ | 454 */ |
455 #ifdef USE_KKCC | |
456 struct lrecord_header lheader; | |
457 #endif /* USE_KKCC */ | |
335 int interval_id; | 458 int interval_id; |
336 int id_number; | 459 int id_number; |
337 Lisp_Object function; | 460 Lisp_Object function; |
338 Lisp_Object object; | 461 Lisp_Object object; |
339 }; | 462 }; |
340 | 463 #ifdef USE_KKCC |
464 typedef struct Lisp_Timeout_Data Lisp_Timeout_Data; | |
465 | |
466 DECLARE_LRECORD (timeout_data, Lisp_Timeout_Data); | |
467 #define XTIMEOUT_DATA(x) XRECORD (x, timeout_data, Lisp_Timeout_Data) | |
468 #define wrap_timeout_data(p) wrap_record(p, timeout_data) | |
469 #define TIMEOUT_DATAP(x) RECORDP (x, timeout_data) | |
470 #define CHECK_TIMEOUT_DATA(x) CHECK_RECORD (x, timeout_data) | |
471 #define CONCHECK_TIMEOUT_DATA(x) CONCHECK_RECORD (x, timeout_data) | |
472 | |
473 #define XTIMEOUT_DATA_INTERVAL_ID(d) XTIMEOUT_DATA (d)->interval_id | |
474 #define XTIMEOUT_DATA_ID_NUMBER(d) XTIMEOUT_DATA (d)->id_number | |
475 #define XTIMEOUT_DATA_FUNCTION(d) XTIMEOUT_DATA (d)->function | |
476 #define XTIMEOUT_DATA_OBJECT(d) XTIMEOUT_DATA (d)->object | |
477 | |
478 #define XSET_TIMEOUT_DATA_INTERVAL_ID(d, i) XTIMEOUT_DATA (d)->interval_id = (i) | |
479 #define XSET_TIMEOUT_DATA_ID_NUMBER(d, n) XTIMEOUT_DATA (d)->id_number = (n) | |
480 #define XSET_TIMEOUT_DATA_FUNCTION(d, f) XTIMEOUT_DATA (d)->function = f | |
481 #define XSET_TIMEOUT_DATA_OBJECT(d, o) XTIMEOUT_DATA (d)->object = o | |
482 #endif /* USE_KKCC */ | |
483 | |
484 #ifdef USE_KKCC | |
485 struct Lisp_Eval_Data | |
486 #else /* not USE_KKCC */ | |
341 struct eval_data | 487 struct eval_data |
488 #endif /* not USE_KKCC */ | |
342 { | 489 { |
343 /* This kind of event is used internally; sometimes the window system | 490 /* This kind of event is used internally; sometimes the window system |
344 interface would like to inform XEmacs of some user action (such as | 491 interface would like to inform XEmacs of some user action (such as |
345 focusing on another frame) but needs that to happen synchronously | 492 focusing on another frame) but needs that to happen synchronously |
346 with the other user input, like keypresses. This is useful when | 493 with the other user input, like keypresses. This is useful when |
348 event stream. | 495 event stream. |
349 | 496 |
350 function An elisp function to call with this event object. | 497 function An elisp function to call with this event object. |
351 object Argument of function. | 498 object Argument of function. |
352 */ | 499 */ |
500 #ifdef USE_KKCC | |
501 struct lrecord_header lheader; | |
502 #endif /* USE_KKCC */ | |
353 Lisp_Object function; | 503 Lisp_Object function; |
354 Lisp_Object object; | 504 Lisp_Object object; |
355 }; | 505 }; |
356 | 506 #ifdef USE_KKCC |
507 typedef struct Lisp_Eval_Data Lisp_Eval_Data; | |
508 | |
509 DECLARE_LRECORD (eval_data, Lisp_Eval_Data); | |
510 #define XEVAL_DATA(x) XRECORD (x, eval_data, Lisp_Eval_Data) | |
511 #define wrap_eval_data(p) wrap_record(p, eval_data) | |
512 #define EVAL_DATAP(x) RECORDP (x, eval_data) | |
513 #define CHECK_EVAL_DATA(x) CHECK_RECORD (x, eval_data) | |
514 #define CONCHECK_EVAL_DATA(x) CONCHECK_RECORD (x, eval_data) | |
515 | |
516 #define XEVAL_DATA_FUNCTION(d) (XEVAL_DATA (d)->function) | |
517 #define XEVAL_DATA_OBJECT(d) (XEVAL_DATA (d)->object) | |
518 | |
519 #define XSET_EVAL_DATA_FUNCTION(d, f) (XEVAL_DATA (d)->function = f) | |
520 #define XSET_EVAL_DATA_OBJECT(d, o) (XEVAL_DATA (d)->object = o) | |
521 #endif /* USE_KKCC */ | |
522 | |
523 #ifdef USE_KKCC | |
524 struct Lisp_Misc_User_Data | |
525 #else /* not USE_KKCC */ | |
357 struct misc_user_data | 526 struct misc_user_data |
527 #endif /* not USE_KKCC */ | |
358 { | 528 { |
359 /* #### The misc-user type is serious junk. It should be separated | 529 /* #### The misc-user type is serious junk. It should be separated |
360 out into different events. There's no reason to create | 530 out into different events. There's no reason to create |
361 sub-subtypes of events. | 531 sub-subtypes of events. |
362 | 532 |
374 are not the same as keypresses or misc_user_events. | 544 are not the same as keypresses or misc_user_events. |
375 The button, modifiers, x, and y parts are only used | 545 The button, modifiers, x, and y parts are only used |
376 by the XEmacs Drag'n'Drop system. Don't depend on their | 546 by the XEmacs Drag'n'Drop system. Don't depend on their |
377 values for other types of misc_user_events. | 547 values for other types of misc_user_events. |
378 */ | 548 */ |
549 #ifdef USE_KKCC | |
550 struct lrecord_header lheader; | |
551 #endif /* USE_KKCC */ | |
379 Lisp_Object function; | 552 Lisp_Object function; |
380 Lisp_Object object; | 553 Lisp_Object object; |
381 int button; | 554 int button; |
382 int modifiers; | 555 int modifiers; |
383 int x, y; | 556 int x, y; |
384 }; | 557 }; |
385 | 558 #ifdef USE_KKCC |
559 typedef struct Lisp_Misc_User_Data Lisp_Misc_User_Data; | |
560 | |
561 DECLARE_LRECORD (misc_user_data, Lisp_Misc_User_Data); | |
562 #define XMISC_USER_DATA(x) XRECORD (x, misc_user_data, Lisp_Misc_User_Data) | |
563 #define wrap_misc_user_data(p) wrap_record(p, misc_user_data) | |
564 #define MISC_USER_DATAP(x) RECORDP (x, misc_user_data) | |
565 #define CHECK_MISC_USER_DATA(x) CHECK_RECORD (x, misc_user_data) | |
566 #define CONCHECK_MISC_USER_DATA(x) CONCHECK_RECORD (x, misc_user_data) | |
567 | |
568 #define XMISC_USER_DATA_FUNCTION(d) (XMISC_USER_DATA (d)->function) | |
569 #define XMISC_USER_DATA_OBJECT(d) (XMISC_USER_DATA (d)->object) | |
570 #define XMISC_USER_DATA_BUTTON(d) (XMISC_USER_DATA (d)->button) | |
571 #define XMISC_USER_DATA_MODIFIERS(d) (XMISC_USER_DATA (d)->modifiers) | |
572 #define XMISC_USER_DATA_X(d) (XMISC_USER_DATA (d)->x) | |
573 #define XMISC_USER_DATA_Y(d) (XMISC_USER_DATA (d)->y) | |
574 | |
575 #define XSET_MISC_USER_DATA_FUNCTION(d, f) (XMISC_USER_DATA (d)->function = (f)) | |
576 #define XSET_MISC_USER_DATA_OBJECT(d, o) (XMISC_USER_DATA (d)->object = (o)) | |
577 #define XSET_MISC_USER_DATA_BUTTON(d, b) (XMISC_USER_DATA (d)->button = (b)) | |
578 #define XSET_MISC_USER_DATA_MODIFIERS(d, m) (XMISC_USER_DATA (d)->modifiers = (m)) | |
579 #define XSET_MISC_USER_DATA_X(d, new_x) (XMISC_USER_DATA (d)->x = (new_x)) | |
580 #define XSET_MISC_USER_DATA_Y(d, new_y) (XMISC_USER_DATA (d)->y = (new_y)) | |
581 #endif /* USE_KKCC */ | |
582 | |
583 #ifdef USE_KKCC | |
584 typedef void (*lisp_obj_arg_fun) (Lisp_Object); | |
585 | |
586 | |
587 struct Lisp_Magic_Eval_Data | |
588 #else /* not USE_KKCC */ | |
386 struct magic_eval_data | 589 struct magic_eval_data |
590 #endif /* not USE_KKCC */ | |
387 { | 591 { |
388 /* This is like an eval event but its contents are not | 592 /* This is like an eval event but its contents are not |
389 Lisp-accessible. This allows for "internal eval events" that call | 593 Lisp-accessible. This allows for "internal eval events" that call |
390 non-Lisp-accessible functions. Externally, a magic_eval_event just | 594 non-Lisp-accessible functions. Externally, a magic_eval_event just |
391 appears as a magic_event; the Lisp programmer need not know | 595 appears as a magic_event; the Lisp programmer need not know |
396 functions. For a normal eval event, this field | 600 functions. For a normal eval event, this field |
397 will always be 0. | 601 will always be 0. |
398 object Argument of function. | 602 object Argument of function. |
399 | 603 |
400 */ | 604 */ |
605 #ifdef USE_KKCC | |
606 struct lrecord_header lheader; | |
607 #endif /* USE_KKCC */ | |
401 void (*internal_function) (Lisp_Object); | 608 void (*internal_function) (Lisp_Object); |
402 Lisp_Object object; | 609 Lisp_Object object; |
403 }; | 610 }; |
611 #ifdef USE_KKCC | |
612 typedef struct Lisp_Magic_Eval_Data Lisp_Magic_Eval_Data; | |
613 | |
614 DECLARE_LRECORD (magic_eval_data, Lisp_Magic_Eval_Data); | |
615 #define XMAGIC_EVAL_DATA(x) XRECORD (x, magic_eval_data, Lisp_Magic_Eval_Data) | |
616 #define wrap_magic_eval_data(p) wrap_record(p, magic_eval_data) | |
617 #define MAGIC_EVAL_DATAP(x) RECORDP (x, magic_eval_data) | |
618 #define CHECK_MAGIC_EVAL_DATA(x) CHECK_RECORD (x, magic_eval_data) | |
619 #define CONCHECK_MAGIC_EVAL_DATA(x) CONCHECK_RECORD (x, magic_eval_data) | |
620 | |
621 #define XMAGIC_EVAL_DATA_INTERNAL_FUNCTION(d) \ | |
622 XMAGIC_EVAL_DATA (d)->internal_function | |
623 #define XMAGIC_EVAL_DATA_INTERNAL_FUNOBJ(d) (XMAGIC_EVAL_DATA (d)->internal_function) | |
624 #define XMAGIC_EVAL_DATA_OBJECT(d) (XMAGIC_EVAL_DATA (d)->object) | |
625 | |
626 #define XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION(d, f) \ | |
627 (XMAGIC_EVAL_DATA (d)->internal_function = f) | |
628 #define XSET_MAGIC_EVAL_DATA_INTERNAL_FUNOBJ(d, f) (XMAGIC_EVAL_DATA (d)->internal_function = (f)) | |
629 #define XSET_MAGIC_EVAL_DATA_OBJECT(d, o) (XMAGIC_EVAL_DATA (d)->object = (o)) | |
630 #endif /* USE_KKCC */ | |
404 | 631 |
405 #if defined (HAVE_X_WINDOWS) && defined(emacs) | 632 #if defined (HAVE_X_WINDOWS) && defined(emacs) |
406 # include <X11/Xlib.h> | 633 # include <X11/Xlib.h> |
407 #endif | 634 #endif |
408 | 635 |
409 #ifdef HAVE_GTK | 636 #ifdef HAVE_GTK |
410 #include <gdk/gdk.h> | 637 #include <gdk/gdk.h> |
411 #endif | 638 #endif |
412 | 639 |
640 | |
641 #ifdef USE_KKCC | |
642 struct Lisp_Magic_Data | |
643 { | |
644 struct lrecord_header lheader; | |
645 | |
646 union { | |
647 #ifdef HAVE_GTK | |
648 GdkEvent gdk_event; | |
649 #endif | |
650 #ifdef HAVE_X_WINDOWS | |
651 XEvent x_event; | |
652 #endif | |
653 #ifdef HAVE_MS_WINDOWS | |
654 int mswindows_event; | |
655 #endif | |
656 } underlying; | |
657 }; | |
658 | |
659 typedef struct Lisp_Magic_Data Lisp_Magic_Data; | |
660 | |
661 DECLARE_LRECORD (magic_data, Lisp_Magic_Data); | |
662 #define XMAGIC_DATA(x) XRECORD (x, magic_data, Lisp_Magic_Data) | |
663 #define wrap_magic_data(p) wrap_record(p, magic_data) | |
664 #define MAGIC_DATAP(x) RECORDP (x, magic_data) | |
665 #define CHECK_MAGIC_DATA(x) CHECK_RECORD (x, magic_data) | |
666 #define CONCHECK_MAGIC_DATA(x) CONCHECK_RECORD (x, magic_data) | |
667 | |
668 #define XMAGIC_DATA_UNDERLYING(d) (XMAGIC_DATA (d)->underlying) | |
669 #define XSET_MAGIC_DATA_UNDERLYING(d, u) (XMAGIC_DATA (d)->underlying = (u)) | |
670 | |
671 #ifdef HAVE_GTK | |
672 #define XMAGIC_DATA_GDK_EVENT(d) (XMAGIC_DATA (d)->underlying.gdk_event) | |
673 #define XSET_MAGIC_DATA_GDK_EVENT(d, e) (XMAGIC_DATA (d)->underlying.gdk_event = (e)) | |
674 #endif /*HAVE_GTK*/ | |
675 | |
676 #ifdef HAVE_X_WINDOWS | |
677 #define XMAGIC_DATA_X_EVENT(d) (XMAGIC_DATA (d)->underlying.x_event) | |
678 #define XSET_MAGIC_DATA_X_EVENT(d, e) (XMAGIC_DATA (d)->underlying.x_event = (e)) | |
679 #endif | |
680 | |
681 #ifdef HAVE_MS_WINDOWS | |
682 #define XMAGIC_DATA_MSWINDOWS_EVENT(d) (XMAGIC_DATA (d)->underlying.mswindows_event) | |
683 #define XSET_MAGIC_DATA_MSWINDOWS_EVENT(d, e) (XMAGIC_DATA (d)->underlying.mswindows_event = (e)) | |
684 #endif | |
685 | |
686 #else /* not USE_KKCC */ | |
413 union magic_data | 687 union magic_data |
414 { | 688 { |
415 /* No user-serviceable parts within. This is for things like | 689 /* No user-serviceable parts within. This is for things like |
416 KeymapNotify and ExposeRegion events and so on that XEmacs itself | 690 KeymapNotify and ExposeRegion events and so on that XEmacs itself |
417 doesn't care about, but which it must do something with for proper | 691 doesn't care about, but which it must do something with for proper |
434 #endif | 708 #endif |
435 #ifdef HAVE_MS_WINDOWS | 709 #ifdef HAVE_MS_WINDOWS |
436 int underlying_mswindows_event; | 710 int underlying_mswindows_event; |
437 #endif | 711 #endif |
438 }; | 712 }; |
713 #endif /* not USE_KKCC */ | |
714 | |
439 | 715 |
440 struct Lisp_Timeout | 716 struct Lisp_Timeout |
441 { | 717 { |
442 struct lcrecord_header header; | 718 struct lcrecord_header header; |
443 int id; /* Id we use to identify the timeout over its lifetime */ | 719 int id; /* Id we use to identify the timeout over its lifetime */ |
504 /* When this event occurred -- if not known, this is made up. #### | 780 /* When this event occurred -- if not known, this is made up. #### |
505 All timestamps should be measured as milliseconds since XEmacs | 781 All timestamps should be measured as milliseconds since XEmacs |
506 started. Currently they are raw server timestamps. (The X | 782 started. Currently they are raw server timestamps. (The X |
507 protocol doesn't provide any easy way of translating between | 783 protocol doesn't provide any easy way of translating between |
508 server time and real process time; yuck.) */ | 784 server time and real process time; yuck.) */ |
509 | |
510 unsigned int timestamp; | 785 unsigned int timestamp; |
786 | |
787 #ifdef USE_KKCC | |
788 Lisp_Object event_data; | |
789 #else /* not USE_KKCC */ | |
511 union | 790 union |
512 { | 791 { |
513 struct key_data key; | 792 struct key_data key; |
514 struct button_data button; | 793 struct button_data button; |
515 struct motion_data motion; | 794 struct motion_data motion; |
518 struct eval_data eval; /* misc_user_event no longer uses this */ | 797 struct eval_data eval; /* misc_user_event no longer uses this */ |
519 struct misc_user_data misc; /* because it needs position information */ | 798 struct misc_user_data misc; /* because it needs position information */ |
520 union magic_data magic; | 799 union magic_data magic; |
521 struct magic_eval_data magic_eval; | 800 struct magic_eval_data magic_eval; |
522 } event; | 801 } event; |
802 #endif /* not USE_KKCC */ | |
523 }; | 803 }; |
524 | 804 |
525 DECLARE_LRECORD (event, Lisp_Event); | 805 DECLARE_LRECORD (event, Lisp_Event); |
526 #define XEVENT(x) XRECORD (x, event, Lisp_Event) | 806 #define XEVENT(x) XRECORD (x, event, Lisp_Event) |
527 #define wrap_event(p) wrap_record (p, event) | 807 #define wrap_event(p) wrap_record (p, event) |
534 #define EVENT_CHANNEL(a) ((a)->channel) | 814 #define EVENT_CHANNEL(a) ((a)->channel) |
535 #define EVENT_TYPE(a) ((a)->event_type) | 815 #define EVENT_TYPE(a) ((a)->event_type) |
536 #define XEVENT_TYPE(a) (XEVENT (a)->event_type) | 816 #define XEVENT_TYPE(a) (XEVENT (a)->event_type) |
537 #define EVENT_NEXT(a) ((a)->next) | 817 #define EVENT_NEXT(a) ((a)->next) |
538 #define XEVENT_NEXT(e) (XEVENT (e)->next) | 818 #define XEVENT_NEXT(e) (XEVENT (e)->next) |
819 #ifdef USE_KKCC | |
820 #else /* not USE_KKCC */ | |
539 #define XSET_EVENT_NEXT(e, n) do { (XEVENT (e)->next = (n)); } while (0) | 821 #define XSET_EVENT_NEXT(e, n) do { (XEVENT (e)->next = (n)); } while (0) |
822 #endif /* not USE_KKCC */ | |
823 | |
824 #ifdef USE_KKCC | |
825 #define XEVENT_DATA(ev) (XEVENT (ev)->event_data) | |
826 #define EVENT_DATA(ev) ((ev)->event_data) | |
827 #define XEVENT_CHANNEL(ev) (XEVENT (ev)->channel) | |
828 #define EVENT_CHANNEL(ev) ((ev)->channel) | |
829 #define EVENT_TIMESTAMP(ev) \ | |
830 ((ev)->timestamp) | |
831 #define XEVENT_TIMESTAMP(ev) EVENT_TIMESTAMP (XEVENT (ev)) | |
832 | |
833 #define SET_EVENT_TIMESTAMP_ZERO(ev) \ | |
834 ((ev)->timestamp = Qzero) | |
835 #define SET_EVENT_TIMESTAMP(ev, t) \ | |
836 (ev)->timestamp = (t) | |
837 #define XSET_EVENT_TIMESTAMP(ev, t) SET_EVENT_TIMESTAMP (XEVENT (ev), t) | |
838 | |
839 | |
840 #define SET_EVENT_CHANNEL(ev, c) \ | |
841 do { \ | |
842 Lisp_Event *mac_event = (ev); \ | |
843 mac_event->channel = (c); \ | |
844 } while (0) | |
845 #define XSET_EVENT_CHANNEL(ev, c) SET_EVENT_CHANNEL (XEVENT (ev), c) | |
846 | |
847 #define SET_EVENT_DATA(ev, d) \ | |
848 do { \ | |
849 Lisp_Event *mac_event = (ev); \ | |
850 mac_event->event_data = (d); \ | |
851 } while (0) | |
852 #define XSET_EVENT_DATA(ev, d) SET_EVENT_DATA (XEVENT (ev), d) | |
853 | |
854 INLINE_HEADER void set_event_type(struct Lisp_Event *event, emacs_event_type t); | |
855 INLINE_HEADER void | |
856 set_event_type(struct Lisp_Event *event, emacs_event_type t) | |
857 { | |
858 event->event_type = t; | |
859 | |
860 switch (t) { | |
861 case key_press_event: | |
862 event->event_data = make_key_data (); | |
863 break; | |
864 case button_press_event: | |
865 case button_release_event: | |
866 event->event_data = make_button_data (); | |
867 break; | |
868 case pointer_motion_event: | |
869 event->event_data = make_motion_data (); | |
870 break; | |
871 case process_event: | |
872 event->event_data = make_process_data (); | |
873 break; | |
874 case timeout_event: | |
875 event->event_data = make_timeout_data (); | |
876 break; | |
877 case magic_event: | |
878 event->event_data = make_magic_data (); | |
879 break; | |
880 case magic_eval_event: | |
881 event->event_data = make_magic_eval_data (); | |
882 break; | |
883 case eval_event: | |
884 event->event_data = make_eval_data (); | |
885 break; | |
886 case misc_user_event: | |
887 event->event_data = make_misc_user_data (); | |
888 break; | |
889 default: | |
890 break; | |
891 } | |
892 } | |
893 #define XSET_EVENT_TYPE(ev, t) set_event_type (XEVENT (ev), t) | |
894 #define SET_EVENT_TYPE(ev, t) set_event_type (ev, t) | |
895 | |
896 | |
897 #define SET_EVENT_NEXT(ev, n) \ | |
898 do { \ | |
899 Lisp_Event *mac_event = (ev); \ | |
900 mac_event->next = (n); \ | |
901 } while (0) | |
902 #define XSET_EVENT_NEXT(ev, n) SET_EVENT_NEXT (XEVENT (ev), n) | |
903 | |
904 #endif /* USE_KKCC */ | |
905 | |
540 | 906 |
541 #define EVENT_CHAIN_LOOP(event, chain) \ | 907 #define EVENT_CHAIN_LOOP(event, chain) \ |
542 for (event = chain; !NILP (event); event = XEVENT_NEXT (event)) | 908 for (event = chain; !NILP (event); event = XEVENT_NEXT (event)) |
543 | 909 |
544 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event) | 910 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event) |
592 | 958 |
593 /* Maybe this should be trickier */ | 959 /* Maybe this should be trickier */ |
594 #define KEYSYM(x) (intern (x)) | 960 #define KEYSYM(x) (intern (x)) |
595 | 961 |
596 /* from events.c */ | 962 /* from events.c */ |
963 #ifdef USE_KKCC | |
964 void format_event_object (Eistring *buf, Lisp_Object event, int brief); | |
965 #else /* not USE_KKCC */ | |
597 void format_event_object (Eistring *buf, Lisp_Event *event, int brief); | 966 void format_event_object (Eistring *buf, Lisp_Event *event, int brief); |
967 #endif /* not USE_KKCC */ | |
968 #ifdef USE_KKCC | |
969 //void format_event_data_object (Eistring *buf, Lisp_Object data, int brief); | |
970 void copy_event_data (Lisp_Object dest, Lisp_Object src); | |
971 #endif /* USE_KKCC */ | |
598 void character_to_event (Ichar c, Lisp_Event *event, | 972 void character_to_event (Ichar c, Lisp_Event *event, |
599 struct console *con, | 973 struct console *con, |
600 int use_console_meta_flag, | 974 int use_console_meta_flag, |
601 int do_backspace_mapping); | 975 int do_backspace_mapping); |
602 void zero_event (Lisp_Event *e); | 976 void zero_event (Lisp_Event *e); |
781 things could get really screwed up (e.g. if the user created a | 1155 things could get really screwed up (e.g. if the user created a |
782 translation loop). If this is nil, then the next-read event is | 1156 translation loop). If this is nil, then the next-read event is |
783 the first that can begin a function key sequence. */ | 1157 the first that can begin a function key sequence. */ |
784 Lisp_Object first_mungeable_event; | 1158 Lisp_Object first_mungeable_event; |
785 } munge_me[2]; | 1159 } munge_me[2]; |
786 | |
787 Ibyte *echo_buf; | 1160 Ibyte *echo_buf; |
1161 | |
788 Bytecount echo_buf_length; /* size of echo_buf */ | 1162 Bytecount echo_buf_length; /* size of echo_buf */ |
789 Bytecount echo_buf_index; /* index into echo_buf | 1163 Bytecount echo_buf_index; /* index into echo_buf |
790 * -1 before doing echoing for new cmd */ | 1164 * -1 before doing echoing for new cmd */ |
791 /* Self-insert-command is magic in that it doesn't always push an undo- | 1165 /* Self-insert-command is magic in that it doesn't always push an undo- |
792 boundary: up to 20 consecutive self-inserts can happen before an undo- | 1166 boundary: up to 20 consecutive self-inserts can happen before an undo- |