comparison src/events.c @ 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 79c6ff3eef26
children c891972d07fa
comparison
equal deleted inserted replaced
933:f6bc42928b34 934:c925bacdda60
39 #include "toolbar.h" 39 #include "toolbar.h"
40 #include "window.h" 40 #include "window.h"
41 41
42 #include "console-tty-impl.h" /* for stuff in character_to_event */ 42 #include "console-tty-impl.h" /* for stuff in character_to_event */
43 43
44 #ifdef USE_KKCC
45 #include "console-x.h"
46 #endif /* USE_KKCC */
47
44 /* Where old events go when they are explicitly deallocated. 48 /* Where old events go when they are explicitly deallocated.
45 The event chain here is cut loose before GC, so these will be freed 49 The event chain here is cut loose before GC, so these will be freed
46 eventually. 50 eventually.
47 */ 51 */
48 static Lisp_Object Vevent_resource; 52 static Lisp_Object Vevent_resource;
67 clear_event_resource (void) 71 clear_event_resource (void)
68 { 72 {
69 Vevent_resource = Qnil; 73 Vevent_resource = Qnil;
70 } 74 }
71 75
76 #ifdef USE_KKCC
77 /* Make sure we lose quickly if we try to use this event */
78 static void
79 deinitialize_event (Lisp_Object ev)
80 {
81 Lisp_Event *event = XEVENT (ev);
82
83 set_event_type (event, dead_event);
84 SET_EVENT_CHANNEL (event, Qnil);
85 set_lheader_implementation (&event->lheader, &lrecord_event);
86 XSET_EVENT_NEXT (ev, Qnil);
87 XSET_EVENT_DATA (ev, Qnil);
88 }
89
90 /* Set everything to zero or nil so that it's predictable. */
91 void
92 zero_event (Lisp_Event *e)
93 {
94 SET_EVENT_DATA (e, Qnil);
95 set_event_type (e, empty_event);
96 SET_EVENT_NEXT (e, Qnil);
97 SET_EVENT_CHANNEL (e, Qnil);
98 SET_EVENT_TIMESTAMP_ZERO (e);
99 }
100
101 static const struct lrecord_description event_description [] = {
102 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, next) },
103 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, channel) },
104 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, event_data) },
105 { XD_END }
106 };
107
108 static Lisp_Object
109 mark_event (Lisp_Object obj)
110 {
111 mark_object (XEVENT_DATA(obj));
112 mark_object (XEVENT_CHANNEL(obj));
113 return (XEVENT_NEXT(obj));
114 }
115
116
117 static const struct lrecord_description key_data_description [] = {
118 { XD_LISP_OBJECT, offsetof (struct Lisp_Key_Data, keysym) },
119 { XD_END }
120 };
121
122 static Lisp_Object
123 mark_key_data (Lisp_Object obj)
124 {
125 return (XKEY_DATA_KEYSYM(obj));
126 }
127
128
129 static const struct lrecord_description button_data_description [] = {
130 { XD_END }
131 };
132
133 static Lisp_Object
134 mark_button_data (Lisp_Object obj)
135 {
136 return Qnil;
137 }
138
139
140 static const struct lrecord_description motion_data_description [] = {
141 { XD_END }
142 };
143
144 static Lisp_Object
145 mark_motion_data (Lisp_Object obj)
146 {
147 return Qnil;
148 }
149
150
151 static const struct lrecord_description process_data_description [] = {
152 { XD_LISP_OBJECT, offsetof (struct Lisp_Process_Data, process) },
153 { XD_END }
154 };
155
156 static Lisp_Object
157 mark_process_data (Lisp_Object obj)
158 {
159 return (XPROCESS_DATA_PROCESS(obj));
160 }
161
162
163 static const struct lrecord_description timeout_data_description [] = {
164 { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, function) },
165 { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, object) },
166 { XD_END }
167 };
168
169 static Lisp_Object
170 mark_timeout_data (Lisp_Object obj)
171 {
172 mark_object (XTIMEOUT_DATA_FUNCTION(obj));
173 return (XTIMEOUT_DATA_OBJECT(obj));
174 }
175
176
177 static const struct lrecord_description eval_data_description [] = {
178 { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, function) },
179 { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, object) },
180 { XD_END }
181 };
182
183 static Lisp_Object
184 mark_eval_data (Lisp_Object obj)
185 {
186 mark_object (XEVAL_DATA_FUNCTION(obj));
187 return (XEVAL_DATA_OBJECT(obj));
188 }
189
190
191 static const struct lrecord_description misc_user_data_description [] = {
192 { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, function) },
193 { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, object) },
194 { XD_END }
195 };
196
197 static Lisp_Object
198 mark_misc_user_data (Lisp_Object obj)
199 {
200 mark_object (XMISC_USER_DATA_FUNCTION(obj));
201 return (XMISC_USER_DATA_OBJECT(obj));
202 }
203
204
205 static const struct lrecord_description magic_eval_data_description [] = {
206 { XD_LISP_OBJECT, offsetof (struct Lisp_Magic_Eval_Data, object) },
207 { XD_END }
208 };
209
210 static Lisp_Object
211 mark_magic_eval_data (Lisp_Object obj)
212 {
213 return (XMAGIC_EVAL_DATA_OBJECT(obj));
214 }
215
216
217 static const struct lrecord_description magic_data_description [] = {
218 { XD_END }
219 };
220
221 static Lisp_Object
222 mark_magic_data (Lisp_Object obj)
223 {
224 return Qnil;
225 }
226
227
228
229 static void
230 print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
231 {
232 if (print_readably)
233 printing_unreadable_object ("#<event>");
234
235 switch (XEVENT_TYPE (obj))
236 {
237 case key_press_event:
238 write_c_string (printcharfun, "#<keypress-event ");
239 break;
240 case button_press_event:
241 write_c_string (printcharfun, "#<buttondown-event ");
242 break;
243 case button_release_event:
244 write_c_string (printcharfun, "#<buttonup-event ");
245 break;
246 case magic_eval_event:
247 write_c_string (printcharfun, "#<magic-eval-event ");
248 break;
249 case magic_event:
250 write_c_string (printcharfun, "#<magic-event ");
251 break;
252 case pointer_motion_event:
253 write_c_string (printcharfun, "#<motion-event ");
254 break;
255 case process_event:
256 write_c_string (printcharfun, "#<process-event ");
257 break;
258 case timeout_event:
259 write_c_string (printcharfun, "#<timeout-event ");
260 break;
261 case misc_user_event:
262 write_c_string (printcharfun, "#<misc-user-event ");
263 break;
264 case eval_event:
265 write_c_string (printcharfun, "#<eval-event ");
266 break;
267 case empty_event:
268 write_c_string (printcharfun, "#<empty-event>");
269 return;
270 case dead_event:
271 write_c_string (printcharfun, "#<DEALLOCATED-EVENT>");
272 return;
273 default:
274 write_c_string (printcharfun, "#<UNKNOWN-EVENT-TYPE>");
275 return;
276 }
277
278 print_internal (XEVENT_DATA (obj), printcharfun, 1);
279 write_c_string (printcharfun, ">");
280 }
281
282
283 static void
284 print_key_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
285 {
286 char buf[128];
287 if (print_readably)
288 printing_unreadable_object ("#<key_data>");
289
290 sprintf (buf, "#<key_data ");
291 /* format_event_data_object (buf + 11, obj, 0);
292 sprintf (buf + strlen (buf), ">");
293 write_c_string (printcharfun, buf);*/
294 }
295
296 static void
297 print_button_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
298 {
299 char buf[128];
300 if (print_readably)
301 printing_unreadable_object ("#<button_data>");
302
303 sprintf (buf, "#<button_data ");
304 /* format_event_data_object (buf + 14, obj, 0);
305 sprintf (buf + strlen (buf), ">");
306 write_c_string (printcharfun, buf);*/
307 }
308
309
310 static void
311 print_motion_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
312 {
313 char buf[64];
314 Lisp_Object Vx, Vy;
315
316 if (print_readably)
317 printing_unreadable_object ("#<motion_data>");
318
319 Vx = XMOTION_DATA_X (obj);
320 Vy = XMOTION_DATA_Y (obj);
321 sprintf (buf, "#<motion-data %ld, %ld>", (long) XINT (Vx), (long) XINT (Vy));
322 write_c_string (printcharfun, buf);
323 }
324
325
326 static void
327 print_process_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
328 {
329 if (print_readably)
330 printing_unreadable_object ("#<process_data>");
331
332 write_c_string (print_readably, "#<process-data ");
333 print_internal (XPROCESS_DATA_PROCESS (obj), printcharfun, 1);
334 write_c_string (printcharfun, ">");
335 }
336
337
338 static void
339 print_timeout_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
340 {
341 if (print_readably)
342 printing_unreadable_object ("#<timeout_data>");
343
344 write_c_string (printcharfun, "#<timeout-data ");
345 print_internal (XTIMEOUT_DATA_OBJECT (obj), printcharfun, 1);
346 write_c_string (printcharfun, ">");
347 }
348
349
350 static void
351 print_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
352 {
353 if (print_readably)
354 printing_unreadable_object ("#<eval_data>");
355
356 write_c_string (printcharfun, "#<eval-data ");
357 print_internal (XEVAL_DATA_FUNCTION (obj), printcharfun, 1);
358 write_c_string (printcharfun, " ");
359 print_internal (XEVAL_DATA_OBJECT (obj), printcharfun, 1);
360 write_c_string (printcharfun, ">");
361 }
362
363
364 static void
365 print_misc_user_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
366 {
367 if (print_readably)
368 printing_unreadable_object ("#<misc_user_data>");
369
370 write_c_string (printcharfun, "#<misc-user-data ");
371 print_internal (XMISC_USER_DATA_FUNCTION (obj), printcharfun, 1);
372 write_c_string (printcharfun, " ");
373 print_internal (XMISC_USER_DATA_OBJECT (obj), printcharfun, 1);
374 write_c_string (printcharfun, ">");
375 }
376
377
378 static void
379 print_magic_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
380 {
381 // char buf[128];
382
383 if (print_readably)
384 printing_unreadable_object ("#<magic_eval_data>");
385
386 /* format_event_data_object (buf + 18, obj, 0);*/
387 }
388
389
390 static void
391 print_magic_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
392 {
393 char buf[128];
394
395 if (print_readably)
396 printing_unreadable_object ("#<magic_data>");
397
398 sprintf (buf, "#<magic-data ");
399 /* format_event_data_object (buf + 13, obj, 0);
400 sprintf (buf + strlen (buf), ">");
401 write_c_string (print_readably, buf);*/
402 }
403
404
405 static int
406 event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
407 {
408 Lisp_Event *e1 = XEVENT (obj1);
409 Lisp_Event *e2 = XEVENT (obj2);
410
411 if (EVENT_TYPE (e1) != EVENT_TYPE (e2)) return 0;
412 if (!EQ (EVENT_CHANNEL (e1), EVENT_CHANNEL (e2))) return 0;
413 /* if (EVENT_TIMESTAMP (e1) != EVENT_TIMESTAMP (e2)) return 0; */
414 switch (EVENT_TYPE (e1))
415 {
416 default: abort ();
417
418 case process_event:
419 case timeout_event:
420 case pointer_motion_event:
421 case key_press_event:
422 case button_press_event:
423 case button_release_event:
424 case misc_user_event:
425 case eval_event:
426 case magic_eval_event:
427 return internal_equal (EVENT_DATA (e1), EVENT_DATA (e2), 0);
428
429 case magic_event:
430 {
431 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)));
432
433 #ifdef HAVE_X_WINDOWS
434 if (CONSOLE_X_P (con))
435 return (XMAGIC_DATA_X_EVENT (EVENT_DATA (e1)).xany.serial ==
436 XMAGIC_DATA_X_EVENT (EVENT_DATA (e2)).xany.serial);
437 #endif
438 #ifdef HAVE_GTK
439 if (CONSOLE_GTK_P (con))
440 return (XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e1)) ==
441 XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e2)));
442 #endif
443 #ifdef HAVE_MS_WINDOWS
444 if (CONSOLE_MSWINDOWS_P (con))
445 return (!memcmp(&XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e1)),
446 &XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e2)),
447 sizeof (union magic_data)));
448 #endif
449 abort ();
450 return 1; /* not reached */
451 }
452
453 case empty_event: /* Empty and deallocated events are equal. */
454 case dead_event:
455 return 1;
456 }
457 }
458
459 static int
460 key_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
461 {
462 return (EQ (XKEY_DATA_KEYSYM (obj1), XKEY_DATA_KEYSYM (obj2)) &&
463 (XKEY_DATA_MODIFIERS (obj1) == XKEY_DATA_MODIFIERS (obj2)));
464 }
465
466 static int
467 button_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
468 {
469 return (XBUTTON_DATA_BUTTON (obj1) == XBUTTON_DATA_BUTTON (obj2) &&
470 XBUTTON_DATA_MODIFIERS (obj1) == XBUTTON_DATA_MODIFIERS (obj2));
471 }
472
473 static int
474 motion_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
475 {
476 return (XMOTION_DATA_X (obj1) == XMOTION_DATA_X (obj2) &&
477 XMOTION_DATA_Y (obj1) == XMOTION_DATA_Y (obj2));
478 }
479
480 static int
481 process_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
482 {
483 return EQ (XPROCESS_DATA_PROCESS (obj1), XPROCESS_DATA_PROCESS (obj2));
484 }
485
486 static int
487 timeout_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
488 {
489 return (internal_equal (XTIMEOUT_DATA_FUNCTION (obj1),
490 XTIMEOUT_DATA_FUNCTION (obj2), 0) &&
491 internal_equal (XTIMEOUT_DATA_OBJECT (obj1),
492 XTIMEOUT_DATA_OBJECT (obj2), 0));
493 }
494
495 static int
496 eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
497 {
498 return (internal_equal (XEVAL_DATA_FUNCTION (obj1),
499 XEVAL_DATA_FUNCTION (obj2), 0) &&
500 internal_equal (XEVAL_DATA_OBJECT (obj1),
501 XEVAL_DATA_OBJECT (obj2), 0));
502 }
503
504 static int
505 misc_user_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
506 {
507 return (internal_equal (XMISC_USER_DATA_FUNCTION (obj1),
508 XMISC_USER_DATA_FUNCTION (obj2), 0) &&
509 internal_equal (XMISC_USER_DATA_OBJECT (obj1),
510 XMISC_USER_DATA_OBJECT (obj2), 0) &&
511 /* is this really needed for equality
512 or is x and y also important? */
513 XMISC_USER_DATA_BUTTON (obj1) == XMISC_USER_DATA_BUTTON (obj2) &&
514 XMISC_USER_DATA_MODIFIERS (obj1) ==
515 XMISC_USER_DATA_MODIFIERS (obj2));
516 }
517
518 static int
519 magic_eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
520 {
521 return (XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj1) ==
522 XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj2) &&
523 internal_equal (XMAGIC_EVAL_DATA_OBJECT (obj1),
524 XMAGIC_EVAL_DATA_OBJECT (obj2), 0));
525 }
526
527 static int
528 magic_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
529 {assert (0); return 0;}
530
531 static unsigned long
532 event_hash (Lisp_Object obj, int depth)
533 {
534 Lisp_Event *e = XEVENT (obj);
535 unsigned long hash;
536
537 hash = HASH2 (EVENT_TYPE (e), LISP_HASH (EVENT_CHANNEL (e)));
538 switch (EVENT_TYPE (e))
539 {
540 case process_event:
541 case timeout_event:
542 case key_press_event:
543 case button_press_event:
544 case button_release_event:
545 case pointer_motion_event:
546 case misc_user_event:
547 case eval_event:
548 case magic_eval_event:
549 return HASH2 (hash, internal_hash (EVENT_DATA (e), depth + 1));
550
551 case magic_event:
552 {
553 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e)));
554 #ifdef HAVE_X_WINDOWS
555 if (CONSOLE_X_P (con))
556 return HASH2 (hash, XMAGIC_DATA_X_EVENT (EVENT_DATA (e)).xany.serial);
557 #endif
558 #ifdef HAVE_GTK
559 if (CONSOLE_GTK_P (con))
560 return HASH2 (hash, XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e)));
561 #endif
562 #ifdef HAVE_MS_WINDOWS
563 if (CONSOLE_MSWINDOWS_P (con))
564 return HASH2 (hash, XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e)));
565 #endif
566 abort ();
567 return 0;
568 }
569
570 case empty_event:
571 case dead_event:
572 return hash;
573
574 default:
575 abort ();
576 }
577
578 return 0; /* unreached */
579 }
580
581 static unsigned long
582 key_data_hash (Lisp_Object obj, int depth)
583 {
584 return HASH2 (LISP_HASH (XKEY_DATA_KEYSYM (obj)),
585 XKEY_DATA_MODIFIERS (obj));
586 }
587
588 static unsigned long
589 button_data_hash (Lisp_Object obj, int depth)
590 {
591 return HASH2 (XBUTTON_DATA_BUTTON (obj), XBUTTON_DATA_MODIFIERS (obj));
592 }
593
594 static unsigned long
595 motion_data_hash (Lisp_Object obj, int depth)
596 {
597 return HASH2 (XMOTION_DATA_X (obj), XMOTION_DATA_Y (obj));
598 }
599
600 static unsigned long
601 process_data_hash (Lisp_Object obj, int depth)
602 {
603 return LISP_HASH (XPROCESS_DATA_PROCESS (obj));
604 }
605
606 static unsigned long
607 timeout_data_hash (Lisp_Object obj, int depth)
608 {
609 return HASH2 (internal_hash (XTIMEOUT_DATA_FUNCTION (obj), depth + 1),
610 internal_hash (XTIMEOUT_DATA_OBJECT (obj), depth + 1));
611 }
612
613 static unsigned long
614 eval_data_hash (Lisp_Object obj, int depth)
615 {
616 return HASH2 (internal_hash (XEVAL_DATA_FUNCTION (obj), depth + 1),
617 internal_hash (XEVAL_DATA_OBJECT (obj), depth + 1));
618 }
619
620 static unsigned long
621 misc_user_data_hash (Lisp_Object obj, int depth)
622 {
623 return HASH4 (internal_hash (XMISC_USER_DATA_FUNCTION (obj), depth + 1),
624 internal_hash (XMISC_USER_DATA_OBJECT (obj), depth + 1),
625 XMISC_USER_DATA_BUTTON (obj), XMISC_USER_DATA_MODIFIERS (obj));
626 }
627
628 static unsigned long
629 magic_eval_data_hash (Lisp_Object obj, int depth)
630 {
631 return HASH2 ((unsigned long) XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj),
632 internal_hash (XMAGIC_EVAL_DATA_OBJECT (obj), depth + 1));
633 }
634
635 static unsigned long
636 magic_data_hash (Lisp_Object obj, int depth)
637 {assert(0); return 1;}
638
639 DEFINE_LRECORD_IMPLEMENTATION ("key-data", key_data,
640 0, /*dumpable-flag*/
641 mark_key_data,
642 print_key_data, 0,
643 key_data_equal, key_data_hash, key_data_description,
644 Lisp_Key_Data);
645
646 DEFINE_LRECORD_IMPLEMENTATION ("button-data", button_data,
647 0, /*dumpable-flag*/
648 mark_button_data, print_button_data, 0,
649 button_data_equal, button_data_hash, button_data_description,
650 Lisp_Button_Data);
651
652 DEFINE_LRECORD_IMPLEMENTATION ("motion-data", motion_data,
653 0, /*dumpable-flag*/
654 mark_motion_data, print_motion_data, 0,
655 motion_data_equal, motion_data_hash, motion_data_description,
656 Lisp_Motion_Data);
657
658 DEFINE_LRECORD_IMPLEMENTATION ("process-data", process_data,
659 0, /*dumpable-flag*/
660 mark_process_data,
661 print_process_data, 0,
662 process_data_equal, process_data_hash, process_data_description,
663 Lisp_Process_Data);
664
665 DEFINE_LRECORD_IMPLEMENTATION ("timeout-data", timeout_data,
666 0, /*dumpable-flag*/
667 mark_timeout_data,
668 print_timeout_data, 0,
669 timeout_data_equal, timeout_data_hash, timeout_data_description,
670 Lisp_Timeout_Data);
671
672 DEFINE_LRECORD_IMPLEMENTATION ("eval-data", eval_data,
673 0, /*dumpable-flag*/
674 mark_eval_data,
675 print_eval_data, 0,
676 eval_data_equal, eval_data_hash, eval_data_description,
677 Lisp_Eval_Data);
678
679 DEFINE_LRECORD_IMPLEMENTATION ("misc-user-data", misc_user_data,
680 0, /*dumpable-flag*/
681 mark_misc_user_data,
682 print_misc_user_data,
683 0, misc_user_data_equal,
684 misc_user_data_hash, misc_user_data_description,
685 Lisp_Misc_User_Data);
686
687 DEFINE_LRECORD_IMPLEMENTATION ("magic-eval-data", magic_eval_data,
688 0, /*dumpable-flag*/
689 mark_magic_eval_data,
690 print_magic_eval_data, 0,
691 magic_eval_data_equal,
692 magic_eval_data_hash, magic_eval_data_description,
693 Lisp_Magic_Eval_Data);
694
695 DEFINE_LRECORD_IMPLEMENTATION ("magic-data", magic_data,
696 0, /*dumpable-flag*/
697 mark_magic_data, print_magic_data, 0,
698 magic_data_equal, magic_data_hash, magic_data_description,
699 Lisp_Magic_Data);
700
701
702
703 #else /* not USE_KKCC */
72 /* Make sure we lose quickly if we try to use this event */ 704 /* Make sure we lose quickly if we try to use this event */
73 static void 705 static void
74 deinitialize_event (Lisp_Object ev) 706 deinitialize_event (Lisp_Object ev)
75 { 707 {
76 int i; 708 int i;
321 abort (); 953 abort ();
322 } 954 }
323 955
324 return 0; /* unreached */ 956 return 0; /* unreached */
325 } 957 }
326 958 #endif /* not USE_KKCC */
959
960
961 #ifdef USE_KKCC
962 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
963 0, /*dumpable-flag*/
964 mark_event, print_event, 0, event_equal,
965 event_hash, 0/*event_description*/, Lisp_Event);
966 #else /* not USE_KKCC */
327 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event, 967 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
328 mark_event, print_event, 0, event_equal, 968 mark_event, print_event, 0, event_equal,
329 event_hash, 0, Lisp_Event); 969 event_hash, 0, Lisp_Event);
970 #endif /* not USE_KKCC */
330 971
331 DEFUN ("make-event", Fmake_event, 0, 2, 0, /* 972 DEFUN ("make-event", Fmake_event, 0, 2, 0, /*
332 Return a new event of type TYPE, with properties described by PLIST. 973 Return a new event of type TYPE, with properties described by PLIST.
333 974
334 TYPE is a symbol, either `empty', `key-press', `button-press', 975 TYPE is a symbol, either `empty', `key-press', `button-press',
402 { 1043 {
403 /* For empty event, we return immediately, without processing 1044 /* For empty event, we return immediately, without processing
404 PLIST. In fact, processing PLIST would be wrong, because the 1045 PLIST. In fact, processing PLIST would be wrong, because the
405 sanitizing process would fill in the properties 1046 sanitizing process would fill in the properties
406 (e.g. CHANNEL), which we don't want in empty events. */ 1047 (e.g. CHANNEL), which we don't want in empty events. */
1048 #ifdef USE_KKCC
1049 set_event_type (e, empty_event);
1050 #else /* not USE_KKCC */
407 e->event_type = empty_event; 1051 e->event_type = empty_event;
1052 #endif /* not USE_KKCC */
408 if (!NILP (plist)) 1053 if (!NILP (plist))
409 invalid_operation ("Cannot set properties of empty event", plist); 1054 invalid_operation ("Cannot set properties of empty event", plist);
410 UNGCPRO; 1055 UNGCPRO;
411 return event; 1056 return event;
412 } 1057 }
413 else if (EQ (type, Qkey_press)) 1058 else if (EQ (type, Qkey_press))
414 { 1059 {
1060 #ifdef USE_KKCC
1061 set_event_type (e, key_press_event);
1062 XSET_KEY_DATA_KEYSYM (EVENT_DATA (e), Qunbound);
1063 #else /* not USE_KKCC */
415 e->event_type = key_press_event; 1064 e->event_type = key_press_event;
416 e->event.key.keysym = Qunbound; 1065 e->event.key.keysym = Qunbound;
1066 #endif /* not USE_KKCC */
417 } 1067 }
418 else if (EQ (type, Qbutton_press)) 1068 else if (EQ (type, Qbutton_press))
1069 #ifdef USE_KKCC
1070 set_event_type (e, button_press_event);
1071 #else /* not USE_KKCC */
419 e->event_type = button_press_event; 1072 e->event_type = button_press_event;
1073 #endif /* not USE_KKCC */
420 else if (EQ (type, Qbutton_release)) 1074 else if (EQ (type, Qbutton_release))
1075 #ifdef USE_KKCC
1076 set_event_type (e, button_release_event);
1077 #else /* not USE_KKCC */
421 e->event_type = button_release_event; 1078 e->event_type = button_release_event;
1079 #endif /* not USE_KKCC */
422 else if (EQ (type, Qmotion)) 1080 else if (EQ (type, Qmotion))
1081 #ifdef USE_KKCC
1082 set_event_type (e, pointer_motion_event);
1083 #else /* not USE_KKCC */
423 e->event_type = pointer_motion_event; 1084 e->event_type = pointer_motion_event;
1085 #endif /* not USE_KKCC */
424 else if (EQ (type, Qmisc_user)) 1086 else if (EQ (type, Qmisc_user))
425 { 1087 {
1088 #ifdef USE_KKCC
1089 set_event_type (e, misc_user_event);
1090 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), Qnil);
1091 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), Qnil);
1092 #else /* not USE_KKCC */
426 e->event_type = misc_user_event; 1093 e->event_type = misc_user_event;
427 e->event.eval.function = e->event.eval.object = Qnil; 1094 e->event.eval.function = e->event.eval.object = Qnil;
1095 #endif /* not USE_KKCC */
428 } 1096 }
429 else 1097 else
430 { 1098 {
431 /* Not allowed: Qprocess, Qtimeout, Qmagic, Qeval, Qmagic_eval. */ 1099 /* Not allowed: Qprocess, Qtimeout, Qmagic, Qeval, Qmagic_eval. */
432 invalid_constant ("Invalid event type", type); 1100 invalid_constant ("Invalid event type", type);
443 { 1111 {
444 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist) 1112 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist)
445 { 1113 {
446 if (EQ (keyword, Qchannel)) 1114 if (EQ (keyword, Qchannel))
447 { 1115 {
1116 #ifdef USE_KKCC
1117 if (EVENT_TYPE(e) == key_press_event)
1118 #else /* not USE_KKCC */
448 if (e->event_type == key_press_event) 1119 if (e->event_type == key_press_event)
1120 #endif /* not USE_KKCC */
449 { 1121 {
450 if (!CONSOLEP (value)) 1122 if (!CONSOLEP (value))
451 value = wrong_type_argument (Qconsolep, value); 1123 value = wrong_type_argument (Qconsolep, value);
452 } 1124 }
453 else 1125 else
457 } 1129 }
458 EVENT_CHANNEL (e) = value; 1130 EVENT_CHANNEL (e) = value;
459 } 1131 }
460 else if (EQ (keyword, Qkey)) 1132 else if (EQ (keyword, Qkey))
461 { 1133 {
1134 #ifdef USE_KKCC
1135 switch (EVENT_TYPE(e))
1136 #else /* not USE_KKCC */
462 switch (e->event_type) 1137 switch (e->event_type)
1138 #endif /* not USE_KKCC */
463 { 1139 {
464 case key_press_event: 1140 case key_press_event:
465 if (!SYMBOLP (value) && !CHARP (value)) 1141 if (!SYMBOLP (value) && !CHARP (value))
466 invalid_argument ("Invalid event key", value); 1142 invalid_argument ("Invalid event key", value);
1143 #ifdef USE_KKCC
1144 XSET_KEY_DATA_KEYSYM (EVENT_DATA(e), value);
1145 #else /* not USE_KKCC */
467 e->event.key.keysym = value; 1146 e->event.key.keysym = value;
1147 #endif /* not USE_KKCC */
468 break; 1148 break;
469 default: 1149 default:
470 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); 1150 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
471 break; 1151 break;
472 } 1152 }
474 else if (EQ (keyword, Qbutton)) 1154 else if (EQ (keyword, Qbutton))
475 { 1155 {
476 CHECK_NATNUM (value); 1156 CHECK_NATNUM (value);
477 check_int_range (XINT (value), 0, 7); 1157 check_int_range (XINT (value), 0, 7);
478 1158
1159 #ifdef USE_KKCC
1160 switch (EVENT_TYPE(e))
1161 #else /* not USE_KKCC */
479 switch (e->event_type) 1162 switch (e->event_type)
1163 #endif /* not USE_KKCC */
480 { 1164 {
481 case button_press_event: 1165 case button_press_event:
482 case button_release_event: 1166 case button_release_event:
1167 #ifdef USE_KKCC
1168 XSET_BUTTON_DATA_BUTTON (EVENT_DATA (e), XINT (value));
1169 #else /* not USE_KKCC */
483 e->event.button.button = XINT (value); 1170 e->event.button.button = XINT (value);
1171 #endif /* not USE_KKCC */
484 break; 1172 break;
485 case misc_user_event: 1173 case misc_user_event:
1174 #ifdef USE_KKCC
1175 XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (e), XINT (value));
1176 #else /* not USE_KKCC */
486 e->event.misc.button = XINT (value); 1177 e->event.misc.button = XINT (value);
1178 #endif /* not USE_KKCC */
487 break; 1179 break;
488 default: 1180 default:
489 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); 1181 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
490 break; 1182 break;
491 } 1183 }
510 else if (EQ (sym, Qbutton5)) modifiers |= XEMACS_MOD_BUTTON5; 1202 else if (EQ (sym, Qbutton5)) modifiers |= XEMACS_MOD_BUTTON5;
511 else 1203 else
512 invalid_constant ("Invalid key modifier", sym); 1204 invalid_constant ("Invalid key modifier", sym);
513 } 1205 }
514 1206
1207 #ifdef USE_KKCC
1208 switch (EVENT_TYPE(e))
1209 #else /* not USE_KKCC */
515 switch (e->event_type) 1210 switch (e->event_type)
1211 #endif /* not USE_KKCC */
516 { 1212 {
517 case key_press_event: 1213 case key_press_event:
1214 #ifdef USE_KKCC
1215 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
1216 #else /* not USE_KKCC */
518 e->event.key.modifiers = modifiers; 1217 e->event.key.modifiers = modifiers;
1218 #endif /* not USE_KKCC */
519 break; 1219 break;
520 case button_press_event: 1220 case button_press_event:
521 case button_release_event: 1221 case button_release_event:
1222 #ifdef USE_KKCC
1223 XSET_BUTTON_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
1224 #else /* not USE_KKCC */
522 e->event.button.modifiers = modifiers; 1225 e->event.button.modifiers = modifiers;
1226 #endif /* not USE_KKCC */
523 break; 1227 break;
524 case pointer_motion_event: 1228 case pointer_motion_event:
1229 #ifdef USE_KKCC
1230 XSET_MOTION_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
1231 #else /* not USE_KKCC */
525 e->event.motion.modifiers = modifiers; 1232 e->event.motion.modifiers = modifiers;
1233 #endif /* not USE_KKCC */
526 break; 1234 break;
527 case misc_user_event: 1235 case misc_user_event:
1236 #ifdef USE_KKCC
1237 XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
1238 #else /* not USE_KKCC */
528 e->event.misc.modifiers = modifiers; 1239 e->event.misc.modifiers = modifiers;
1240 #endif /* not USE_KKCC */
529 break; 1241 break;
530 default: 1242 default:
531 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); 1243 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
532 break; 1244 break;
533 } 1245 }
534 } 1246 }
535 else if (EQ (keyword, Qx)) 1247 else if (EQ (keyword, Qx))
536 { 1248 {
1249 #ifdef USE_KKCC
1250 switch (EVENT_TYPE(e))
1251 #else /* not USE_KKCC */
537 switch (e->event_type) 1252 switch (e->event_type)
1253 #endif /* not USE_KKCC */
538 { 1254 {
539 case pointer_motion_event: 1255 case pointer_motion_event:
540 case button_press_event: 1256 case button_press_event:
541 case button_release_event: 1257 case button_release_event:
542 case misc_user_event: 1258 case misc_user_event:
550 break; 1266 break;
551 } 1267 }
552 } 1268 }
553 else if (EQ (keyword, Qy)) 1269 else if (EQ (keyword, Qy))
554 { 1270 {
1271 #ifdef USE_KKCC
1272 switch (EVENT_TYPE(e))
1273 #else /* not USE_KKCC */
555 switch (e->event_type) 1274 switch (e->event_type)
1275 #endif /* not USE_KKCC */
556 { 1276 {
557 case pointer_motion_event: 1277 case pointer_motion_event:
558 case button_press_event: 1278 case button_press_event:
559 case button_release_event: 1279 case button_release_event:
560 case misc_user_event: 1280 case misc_user_event:
568 } 1288 }
569 } 1289 }
570 else if (EQ (keyword, Qtimestamp)) 1290 else if (EQ (keyword, Qtimestamp))
571 { 1291 {
572 CHECK_NATNUM (value); 1292 CHECK_NATNUM (value);
1293 #ifdef USE_KKCC
1294 SET_EVENT_TIMESTAMP (e, XINT (value));
1295 #else /* not USE_KKCC */
573 e->timestamp = XINT (value); 1296 e->timestamp = XINT (value);
1297 #endif /* not USE_KKCC */
574 } 1298 }
575 else if (EQ (keyword, Qfunction)) 1299 else if (EQ (keyword, Qfunction))
576 { 1300 {
1301 #ifdef USE_KKCC
1302 switch (EVENT_TYPE(e))
1303 #else /* not USE_KKCC */
577 switch (e->event_type) 1304 switch (e->event_type)
1305 #endif /* not USE_KKCC */
578 { 1306 {
579 case misc_user_event: 1307 case misc_user_event:
1308 #ifdef USE_KKCC
1309 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), value);
1310 #else /* not USE_KKCC */
580 e->event.eval.function = value; 1311 e->event.eval.function = value;
1312 #endif /* not USE_KKCC */
581 break; 1313 break;
582 default: 1314 default:
583 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); 1315 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
584 break; 1316 break;
585 } 1317 }
586 } 1318 }
587 else if (EQ (keyword, Qobject)) 1319 else if (EQ (keyword, Qobject))
588 { 1320 {
1321 #ifdef USE_KKCC
1322 switch (EVENT_TYPE(e))
1323 #else /* not USE_KKCC */
589 switch (e->event_type) 1324 switch (e->event_type)
1325 #endif /* not USE_KKCC */
590 { 1326 {
591 case misc_user_event: 1327 case misc_user_event:
1328 #ifdef USE_KKCC
1329 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), value);
1330 #else /* not USE_KKCC */
592 e->event.eval.object = value; 1331 e->event.eval.object = value;
1332 #endif /* not USE_KKCC */
593 break; 1333 break;
594 default: 1334 default:
595 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); 1335 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
596 break; 1336 break;
597 } 1337 }
602 } 1342 }
603 1343
604 /* Insert the channel, if missing. */ 1344 /* Insert the channel, if missing. */
605 if (NILP (EVENT_CHANNEL (e))) 1345 if (NILP (EVENT_CHANNEL (e)))
606 { 1346 {
1347 #ifdef USE_KKCC
1348 if (EVENT_TYPE (e) == key_press_event)
1349 #else /* not USE_KKCC */
607 if (e->event_type == key_press_event) 1350 if (e->event_type == key_press_event)
1351 #endif /* not USE_KKCC */
608 EVENT_CHANNEL (e) = Vselected_console; 1352 EVENT_CHANNEL (e) = Vselected_console;
609 else 1353 else
610 EVENT_CHANNEL (e) = Fselected_frame (Qnil); 1354 EVENT_CHANNEL (e) = Fselected_frame (Qnil);
611 } 1355 }
612 1356
618 coord_y += FRAME_REAL_TOP_TOOLBAR_HEIGHT (XFRAME (EVENT_CHANNEL (e))); 1362 coord_y += FRAME_REAL_TOP_TOOLBAR_HEIGHT (XFRAME (EVENT_CHANNEL (e)));
619 1363
620 switch (e->event_type) 1364 switch (e->event_type)
621 { 1365 {
622 case pointer_motion_event: 1366 case pointer_motion_event:
1367 #ifdef USE_KKCC
1368 XSET_MOTION_DATA_X (EVENT_DATA (e), coord_x);
1369 XSET_MOTION_DATA_Y (EVENT_DATA (e), coord_y);
1370 #else /* not USE_KKCC */
623 e->event.motion.x = coord_x; 1371 e->event.motion.x = coord_x;
624 e->event.motion.y = coord_y; 1372 e->event.motion.y = coord_y;
1373 #endif /* not USE_KKCC */
625 break; 1374 break;
626 case button_press_event: 1375 case button_press_event:
627 case button_release_event: 1376 case button_release_event:
1377 #ifdef USE_KKCC
1378 XSET_BUTTON_DATA_X (EVENT_DATA (e), coord_x);
1379 XSET_BUTTON_DATA_Y (EVENT_DATA (e), coord_y);
1380 #else /* not USE_KKCC */
628 e->event.button.x = coord_x; 1381 e->event.button.x = coord_x;
629 e->event.button.y = coord_y; 1382 e->event.button.y = coord_y;
1383 #endif /* not USE_KKCC */
630 break; 1384 break;
631 case misc_user_event: 1385 case misc_user_event:
1386 #ifdef USE_KKCC
1387 XSET_MISC_USER_DATA_X (EVENT_DATA (e), coord_x);
1388 XSET_MISC_USER_DATA_Y (EVENT_DATA (e), coord_y);
1389 #else /* not USE_KKCC */
632 e->event.misc.x = coord_x; 1390 e->event.misc.x = coord_x;
633 e->event.misc.y = coord_y; 1391 e->event.misc.y = coord_y;
1392 #endif /* not USE_KKCC */
634 break; 1393 break;
635 default: 1394 default:
636 abort(); 1395 abort();
637 } 1396 }
638 } 1397 }
639 1398
640 /* Finally, do some more validation. */ 1399 /* Finally, do some more validation. */
1400 #ifdef USE_KKCC
1401 switch (EVENT_TYPE(e))
1402 #else /* not USE_KKCC */
641 switch (e->event_type) 1403 switch (e->event_type)
1404 #endif /* not USE_KKCC */
642 { 1405 {
643 case key_press_event: 1406 case key_press_event:
1407 #ifdef USE_KKCC
1408 if (UNBOUNDP (XKEY_DATA_KEYSYM (EVENT_DATA (e))))
1409 #else /* not USE_KKCC */
644 if (UNBOUNDP (e->event.key.keysym)) 1410 if (UNBOUNDP (e->event.key.keysym))
1411 #endif /* not USE_KKCC */
645 sferror ("A key must be specified to make a keypress event", 1412 sferror ("A key must be specified to make a keypress event",
646 plist); 1413 plist);
647 break; 1414 break;
648 case button_press_event: 1415 case button_press_event:
1416 #ifdef USE_KKCC
1417 if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e)))
1418 #else /* not USE_KKCC */
649 if (!e->event.button.button) 1419 if (!e->event.button.button)
1420 #endif /* not USE_KKCC */
650 sferror 1421 sferror
651 ("A button must be specified to make a button-press event", 1422 ("A button must be specified to make a button-press event",
652 plist); 1423 plist);
653 break; 1424 break;
654 case button_release_event: 1425 case button_release_event:
1426 #ifdef USE_KKCC
1427 if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e)))
1428 #else /* not USE_KKCC */
655 if (!e->event.button.button) 1429 if (!e->event.button.button)
1430 #endif /* not USE_KKCC */
656 sferror 1431 sferror
657 ("A button must be specified to make a button-release event", 1432 ("A button must be specified to make a button-release event",
658 plist); 1433 plist);
659 break; 1434 break;
660 case misc_user_event: 1435 case misc_user_event:
1436 #ifdef USE_KKCC
1437 if (NILP (XMISC_USER_DATA_FUNCTION (EVENT_DATA (e))))
1438 #else /* not USE_KKCC */
661 if (NILP (e->event.misc.function)) 1439 if (NILP (e->event.misc.function))
1440 #endif /* not USE_KKCC */
662 sferror ("A function must be specified to make a misc-user event", 1441 sferror ("A function must be specified to make a misc-user event",
663 plist); 1442 plist);
664 break; 1443 break;
665 default: 1444 default:
666 break; 1445 break;
667 } 1446 }
668 1447
669 UNGCPRO; 1448 UNGCPRO;
670 return event; 1449 return event;
671 } 1450 }
1451
1452
1453 #ifdef USE_KKCC
1454
1455 Lisp_Object
1456 make_key_data (void)
1457 {
1458 Lisp_Object data = allocate_key_data ();
1459
1460 XSET_KEY_DATA_KEYSYM (data, Qnil);
1461 XSET_KEY_DATA_MODIFIERS (data, 0);
1462
1463 return data;
1464 }
1465
1466 Lisp_Object
1467 make_button_data (void)
1468 {
1469 Lisp_Object data = allocate_button_data ();
1470
1471 XSET_BUTTON_DATA_BUTTON (data, 0);
1472 XSET_BUTTON_DATA_MODIFIERS (data, 0);
1473 XSET_BUTTON_DATA_X (data, 0);
1474 XSET_BUTTON_DATA_Y (data, 0);
1475
1476 return data;
1477 }
1478
1479 Lisp_Object
1480 make_motion_data (void)
1481 {
1482 Lisp_Object data = allocate_motion_data ();
1483
1484 XSET_MOTION_DATA_X (data, 0);
1485 XSET_MOTION_DATA_Y (data, 0);
1486 XSET_MOTION_DATA_MODIFIERS (data, 0);
1487
1488 return data;
1489 }
1490
1491 Lisp_Object
1492 make_process_data (void)
1493 {
1494 Lisp_Object data = allocate_process_data ();
1495
1496 XSET_PROCESS_DATA_PROCESS (data, Qnil);
1497
1498 return data;
1499 }
1500
1501 Lisp_Object
1502 make_timeout_data (void)
1503 {
1504 Lisp_Object data = allocate_timeout_data ();
1505
1506 XSET_TIMEOUT_DATA_INTERVAL_ID (data, 0);
1507 XSET_TIMEOUT_DATA_ID_NUMBER(data, 0);
1508 XSET_TIMEOUT_DATA_FUNCTION(data, Qnil);
1509 XSET_TIMEOUT_DATA_OBJECT (data, Qnil);
1510
1511 return data;
1512 }
1513
1514 Lisp_Object
1515 make_magic_eval_data (void)
1516 {
1517 Lisp_Object data = allocate_magic_eval_data ();
1518
1519 XSET_MAGIC_EVAL_DATA_OBJECT (data, Qnil);
1520 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNOBJ (data, 0);
1521
1522 return data;
1523 }
1524
1525 Lisp_Object
1526 make_eval_data (void)
1527 {
1528 Lisp_Object data = allocate_eval_data ();
1529
1530 XSET_EVAL_DATA_FUNCTION (data, Qnil);
1531 XSET_EVAL_DATA_OBJECT (data, Qnil);
1532
1533 return data;
1534 }
1535
1536 Lisp_Object
1537 make_magic_data (void)
1538 {
1539 return allocate_magic_data ();
1540 }
1541
1542 Lisp_Object
1543 make_misc_user_data (void)
1544 {
1545 Lisp_Object data = allocate_misc_user_data ();
1546
1547 XSET_MISC_USER_DATA_FUNCTION (data, Qnil);
1548 XSET_MISC_USER_DATA_OBJECT (data, Qnil);
1549 XSET_MISC_USER_DATA_BUTTON (data, Qnil);
1550 XSET_MISC_USER_DATA_MODIFIERS (data, 0);
1551 XSET_MISC_USER_DATA_X (data, 0);
1552 XSET_MISC_USER_DATA_Y (data, 0);
1553
1554 return data;
1555 }
1556 #endif /* USE_KKCC */
1557
1558
672 1559
673 DEFUN ("deallocate-event", Fdeallocate_event, 1, 1, 0, /* 1560 DEFUN ("deallocate-event", Fdeallocate_event, 1, 1, 0, /*
674 Allow the given event structure to be reused. 1561 Allow the given event structure to be reused.
675 You MUST NOT use this event object after calling this function with it. 1562 You MUST NOT use this event object after calling this function with it.
676 You will lose. It is not necessary to call this function, as event 1563 You will lose. It is not necessary to call this function, as event
717 Vevent_resource = event; 1604 Vevent_resource = event;
718 #endif 1605 #endif
719 return Qnil; 1606 return Qnil;
720 } 1607 }
721 1608
1609 #ifdef USE_KKCC
1610 void
1611 copy_event_data (Lisp_Object dest, Lisp_Object src)
1612 {
1613 switch (XRECORD_LHEADER (dest)->type) {
1614 case lrecord_type_key_data:
1615 XSET_KEY_DATA_KEYSYM (dest, XKEY_DATA_KEYSYM (src));
1616 XSET_KEY_DATA_MODIFIERS (dest, XKEY_DATA_MODIFIERS (src));
1617 break;
1618 case lrecord_type_button_data:
1619 XSET_BUTTON_DATA_BUTTON (dest, XBUTTON_DATA_BUTTON (src));
1620 XSET_BUTTON_DATA_MODIFIERS (dest, XBUTTON_DATA_MODIFIERS (src));
1621 XSET_BUTTON_DATA_X (dest, XBUTTON_DATA_X (src));
1622 XSET_BUTTON_DATA_Y (dest, XBUTTON_DATA_Y (src));
1623 break;
1624 case lrecord_type_motion_data:
1625 XSET_MOTION_DATA_X (dest, XMOTION_DATA_X (src));
1626 XSET_MOTION_DATA_Y (dest, XMOTION_DATA_Y (src));
1627 XSET_MOTION_DATA_MODIFIERS (dest, XMOTION_DATA_MODIFIERS (src));
1628 break;
1629 case lrecord_type_process_data:
1630 XSET_PROCESS_DATA_PROCESS (dest, XPROCESS_DATA_PROCESS (src));
1631 break;
1632 case lrecord_type_timeout_data:
1633 XSET_TIMEOUT_DATA_INTERVAL_ID (dest, XTIMEOUT_DATA_INTERVAL_ID (src));
1634 XSET_TIMEOUT_DATA_ID_NUMBER (dest, XTIMEOUT_DATA_ID_NUMBER (src));
1635 XSET_TIMEOUT_DATA_FUNCTION (dest, XTIMEOUT_DATA_FUNCTION (src));
1636 XSET_TIMEOUT_DATA_OBJECT (dest, XTIMEOUT_DATA_OBJECT (src));
1637 break;
1638 case lrecord_type_eval_data:
1639 XSET_EVAL_DATA_FUNCTION (dest, XEVAL_DATA_FUNCTION (src));
1640 XSET_EVAL_DATA_OBJECT (dest, XEVAL_DATA_OBJECT (src));
1641 break;
1642 case lrecord_type_misc_user_data:
1643 XSET_MISC_USER_DATA_FUNCTION (dest, XMISC_USER_DATA_FUNCTION (src));
1644 XSET_MISC_USER_DATA_OBJECT (dest, XMISC_USER_DATA_OBJECT (src));
1645 XSET_MISC_USER_DATA_BUTTON (dest, XMISC_USER_DATA_BUTTON (src));
1646 XSET_MISC_USER_DATA_MODIFIERS (dest, XMISC_USER_DATA_MODIFIERS (src));
1647 XSET_MISC_USER_DATA_X (dest, XMISC_USER_DATA_X (src));
1648 XSET_MISC_USER_DATA_Y (dest, XMISC_USER_DATA_Y (src));
1649 break;
1650 case lrecord_type_magic_eval_data:
1651 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION (dest, XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (src));
1652 XSET_MAGIC_EVAL_DATA_OBJECT (dest, XMAGIC_EVAL_DATA_OBJECT (src));
1653 break;
1654 case lrecord_type_magic_data:
1655 XSET_MAGIC_DATA_UNDERLYING (dest, XMAGIC_DATA_UNDERLYING (src));
1656 break;
1657 default:
1658 break;
1659 }
1660 }
1661 #endif /* USE_KKCC */
1662
722 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /* 1663 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /*
723 Make a copy of the event object EVENT1. 1664 Make a copy of the event object EVENT1.
724 If a second event argument EVENT2 is given, EVENT1 is copied into 1665 If a second event argument EVENT2 is given, EVENT1 is copied into
725 EVENT2 and EVENT2 is returned. If EVENT2 is not supplied (or is nil) 1666 EVENT2 and EVENT2 is returned. If EVENT2 is not supplied (or is nil)
726 then a new event will be made as with `make-event'. See also the 1667 then a new event will be made as with `make-event'. See also the
741 } 1682 }
742 1683
743 assert (XEVENT_TYPE (event1) <= last_event_type); 1684 assert (XEVENT_TYPE (event1) <= last_event_type);
744 assert (XEVENT_TYPE (event2) <= last_event_type); 1685 assert (XEVENT_TYPE (event2) <= last_event_type);
745 1686
1687 #ifdef USE_KKCC
1688 XSET_EVENT_TYPE (event2, XEVENT_TYPE (event1));
1689 XSET_EVENT_CHANNEL (event2, XEVENT_CHANNEL (event1));
1690 XSET_EVENT_TIMESTAMP (event2, XEVENT_TIMESTAMP (event1));
1691 copy_event_data (XEVENT_DATA (event2), XEVENT_DATA (event1));
1692
1693 return event2;
1694 #else /* not USE_KKCC */
746 { 1695 {
747 Lisp_Event *ev2 = XEVENT (event2); 1696 Lisp_Event *ev2 = XEVENT (event2);
748 Lisp_Event *ev1 = XEVENT (event1); 1697 Lisp_Event *ev1 = XEVENT (event1);
749 1698
750 ev2->event_type = ev1->event_type; 1699 ev2->event_type = ev1->event_type;
752 ev2->timestamp = ev1->timestamp; 1701 ev2->timestamp = ev1->timestamp;
753 ev2->event = ev1->event; 1702 ev2->event = ev1->event;
754 1703
755 return event2; 1704 return event2;
756 } 1705 }
1706 #endif /* not USE_KKCC */
757 } 1707 }
758 1708
759 1709
760 /************************************************************************/ 1710 /************************************************************************/
761 /* event chain functions */ 1711 /* event chain functions */
962 character_to_event (Ichar c, Lisp_Event *event, struct console *con, 1912 character_to_event (Ichar c, Lisp_Event *event, struct console *con,
963 int use_console_meta_flag, int do_backspace_mapping) 1913 int use_console_meta_flag, int do_backspace_mapping)
964 { 1914 {
965 Lisp_Object k = Qnil; 1915 Lisp_Object k = Qnil;
966 int m = 0; 1916 int m = 0;
1917 #ifdef USE_KKCC
1918 if (EVENT_TYPE (event) == dead_event)
1919 #else /* not USE_KKCC */
967 if (event->event_type == dead_event) 1920 if (event->event_type == dead_event)
1921 #endif /* not USE_KKCC */
968 invalid_argument ("character-to-event called with a deallocated event!", Qunbound); 1922 invalid_argument ("character-to-event called with a deallocated event!", Qunbound);
969 1923
970 #ifndef MULE 1924 #ifndef MULE
971 c &= 255; 1925 c &= 255;
972 #endif 1926 #endif
1019 else if (c == 127) 1973 else if (c == 127)
1020 k = QKdelete; 1974 k = QKdelete;
1021 else if (c == ' ') 1975 else if (c == ' ')
1022 k = QKspace; 1976 k = QKspace;
1023 1977
1978 #ifdef USE_KKCC
1979 set_event_type (event, key_press_event);
1980 SET_EVENT_TIMESTAMP_ZERO (event); /* #### */
1981 SET_EVENT_CHANNEL (event, wrap_console (con));
1982 XSET_KEY_DATA_KEYSYM (EVENT_DATA (event), (!NILP (k) ? k : make_char (c)));
1983 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (event), m);
1984 #else /* not USE_KKCC */
1024 event->event_type = key_press_event; 1985 event->event_type = key_press_event;
1025 event->timestamp = 0; /* #### */ 1986 event->timestamp = 0; /* #### */
1026 event->channel = wrap_console (con); 1987 event->channel = wrap_console (con);
1027 event->event.key.keysym = (!NILP (k) ? k : make_char (c)); 1988 event->event.key.keysym = (!NILP (k) ? k : make_char (c));
1028 event->event.key.modifiers = m; 1989 event->event.key.modifiers = m;
1990 #endif /* not USE_KKCC */
1029 } 1991 }
1030 1992
1031 /* This variable controls what character name -> character code mapping 1993 /* This variable controls what character name -> character code mapping
1032 we are using. Window-system-specific code sets this to some symbol, 1994 we are using. Window-system-specific code sets this to some symbol,
1033 and we use that symbol as the plist key to convert keysyms into 8-bit 1995 and we use that symbol as the plist key to convert keysyms into 8-bit
1045 int allow_non_ascii) 2007 int allow_non_ascii)
1046 { 2008 {
1047 Ichar c = 0; 2009 Ichar c = 0;
1048 Lisp_Object code; 2010 Lisp_Object code;
1049 2011
2012 #ifdef USE_KKCC
2013 if (EVENT_TYPE (event) != key_press_event)
2014 #else /* not USE_KKCC */
1050 if (event->event_type != key_press_event) 2015 if (event->event_type != key_press_event)
1051 { 2016 #endif /* not USE_KKCC */
2017 {
2018 #ifdef USE_KKCC
2019 assert (EVENT_TYPE (event) != dead_event);
2020 #else /* not USE_KKCC */
1052 assert (event->event_type != dead_event); 2021 assert (event->event_type != dead_event);
2022 #endif /* not USE_KKCC */
1053 return -1; 2023 return -1;
1054 } 2024 }
1055 if (!allow_extra_modifiers && 2025 if (!allow_extra_modifiers &&
2026 #ifdef USE_KKCC
2027 XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT))
2028 #else /* not USE_KKCC */
1056 event->event.key.modifiers & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT)) 2029 event->event.key.modifiers & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT))
2030 #endif /* not USE_KKCC */
1057 return -1; 2031 return -1;
2032 #ifdef USE_KKCC
2033 if (CHAR_OR_CHAR_INTP (XKEY_DATA_KEYSYM (EVENT_DATA (event))))
2034 c = XCHAR_OR_CHAR_INT (XKEY_DATA_KEYSYM (EVENT_DATA (event)));
2035 else if (!SYMBOLP (XKEY_DATA_KEYSYM (EVENT_DATA (event))))
2036 #else /* not USE_KKCC */
1058 if (CHAR_OR_CHAR_INTP (event->event.key.keysym)) 2037 if (CHAR_OR_CHAR_INTP (event->event.key.keysym))
1059 c = XCHAR_OR_CHAR_INT (event->event.key.keysym); 2038 c = XCHAR_OR_CHAR_INT (event->event.key.keysym);
1060 else if (!SYMBOLP (event->event.key.keysym)) 2039 else if (!SYMBOLP (event->event.key.keysym))
2040 #endif /* not USE_KKCC */
1061 abort (); 2041 abort ();
1062 else if (allow_non_ascii && !NILP (Vcharacter_set_property) 2042 else if (allow_non_ascii && !NILP (Vcharacter_set_property)
1063 /* Allow window-system-specific extensibility of 2043 /* Allow window-system-specific extensibility of
1064 keysym->code mapping */ 2044 keysym->code mapping */
2045 #ifdef USE_KKCC
2046 && CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)),
2047 Vcharacter_set_property,
2048 Qnil)))
2049 #else /* not USE_KKCC */
1065 && CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym, 2050 && CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym,
1066 Vcharacter_set_property, 2051 Vcharacter_set_property,
1067 Qnil))) 2052 Qnil)))
2053 #endif /* not USE_KKCC */
1068 c = XCHAR_OR_CHAR_INT (code); 2054 c = XCHAR_OR_CHAR_INT (code);
2055 #ifdef USE_KKCC
2056 else if (CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)),
2057 Qascii_character, Qnil)))
2058 #else /* not USE_KKCC */
1069 else if (CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym, 2059 else if (CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym,
1070 Qascii_character, Qnil))) 2060 Qascii_character, Qnil)))
2061 #endif /* not USE_KKCC */
1071 c = XCHAR_OR_CHAR_INT (code); 2062 c = XCHAR_OR_CHAR_INT (code);
1072 else 2063 else
1073 return -1; 2064 return -1;
1074 2065
2066 #ifdef USE_KKCC
2067 if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_CONTROL)
2068 #else /* not USE_KKCC */
1075 if (event->event.key.modifiers & XEMACS_MOD_CONTROL) 2069 if (event->event.key.modifiers & XEMACS_MOD_CONTROL)
2070 #endif /* not USE_KKCC */
1076 { 2071 {
1077 if (c >= 'a' && c <= 'z') 2072 if (c >= 'a' && c <= 'z')
1078 c -= ('a' - 'A'); 2073 c -= ('a' - 'A');
1079 else 2074 else
1080 /* reject Control-Shift- keys */ 2075 /* reject Control-Shift- keys */
1088 else 2083 else
1089 /* reject keys that can't take Control- modifiers */ 2084 /* reject keys that can't take Control- modifiers */
1090 if (! allow_extra_modifiers) return -1; 2085 if (! allow_extra_modifiers) return -1;
1091 } 2086 }
1092 2087
2088 #ifdef USE_KKCC
2089 if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_META)
2090 #else /* not USE_KKCC */
1093 if (event->event.key.modifiers & XEMACS_MOD_META) 2091 if (event->event.key.modifiers & XEMACS_MOD_META)
2092 #endif /* not USE_KKCC */
1094 { 2093 {
1095 if (! allow_meta) return -1; 2094 if (! allow_meta) return -1;
1096 if (c & 0200) return -1; /* don't allow M-oslash (overlap) */ 2095 if (c & 0200) return -1; /* don't allow M-oslash (overlap) */
1097 #ifdef MULE 2096 #ifdef MULE
1098 if (c >= 256) return -1; 2097 if (c >= 256) return -1;
1215 } 2214 }
1216 2215
1217 return head; 2216 return head;
1218 } 2217 }
1219 2218
2219
1220 /* Concatenate a string description of EVENT onto the end of BUF. If 2220 /* Concatenate a string description of EVENT onto the end of BUF. If
1221 BRIEF, use short forms for keys, e.g. C- instead of control-. */ 2221 BRIEF, use short forms for keys, e.g. C- instead of control-. */
1222 2222
2223 #ifdef USE_KKCC
2224 void
2225 format_event_object (Eistring *buf, Lisp_Object event, int brief)
2226 #else /* not USE_KKCC */
1223 void 2227 void
1224 format_event_object (Eistring *buf, Lisp_Event *event, int brief) 2228 format_event_object (Eistring *buf, Lisp_Event *event, int brief)
2229 #endif /* not USE_KKCC */
1225 { 2230 {
1226 int mouse_p = 0; 2231 int mouse_p = 0;
1227 int mod = 0; 2232 int mod = 0;
1228 Lisp_Object key; 2233 Lisp_Object key;
1229 2234
2235 #ifdef USE_KKCC
2236 switch (EVENT_TYPE (XEVENT(event)))
2237 #else /* not USE_KKCC */
1230 switch (event->event_type) 2238 switch (event->event_type)
2239 #endif /* not USE_KKCC */
1231 { 2240 {
1232 case key_press_event: 2241 case key_press_event:
1233 { 2242 {
2243 #ifdef USE_KKCC
2244 mod = XKEY_DATA_MODIFIERS (XEVENT_DATA(event));
2245 key = XKEY_DATA_KEYSYM (XEVENT_DATA(event));
2246 #else /* not USE_KKCC */
1234 mod = event->event.key.modifiers; 2247 mod = event->event.key.modifiers;
1235 key = event->event.key.keysym; 2248 key = event->event.key.keysym;
2249 #endif /* not USE_KKCC */
1236 /* Hack. */ 2250 /* Hack. */
1237 if (! brief && CHARP (key) && 2251 if (! brief && CHARP (key) &&
1238 mod & (XEMACS_MOD_CONTROL | XEMACS_MOD_META | XEMACS_MOD_SUPER | 2252 mod & (XEMACS_MOD_CONTROL | XEMACS_MOD_META | XEMACS_MOD_SUPER |
1239 XEMACS_MOD_HYPER)) 2253 XEMACS_MOD_HYPER))
1240 { 2254 {
1250 mouse_p++; 2264 mouse_p++;
1251 /* Fall through */ 2265 /* Fall through */
1252 case button_press_event: 2266 case button_press_event:
1253 { 2267 {
1254 mouse_p++; 2268 mouse_p++;
2269 #ifdef USE_KKCC
2270 mod = XBUTTON_DATA_MODIFIERS (XEVENT_DATA(event));
2271 key = make_char (XBUTTON_DATA_BUTTON (XEVENT_DATA(event)) + '0');
2272 #else /* not USE_KKCC */
1255 mod = event->event.button.modifiers; 2273 mod = event->event.button.modifiers;
1256 key = make_char (event->event.button.button + '0'); 2274 key = make_char (event->event.button.button + '0');
2275 #endif /* not USE_KKCC */
1257 break; 2276 break;
1258 } 2277 }
1259 case magic_event: 2278 case magic_event:
1260 { 2279 {
1261 Lisp_Object stream; 2280 Lisp_Object stream;
1262 struct gcpro gcpro1; 2281 struct gcpro gcpro1;
1263 GCPRO1 (stream); 2282 GCPRO1 (stream);
1264 2283
1265 stream = make_resizing_buffer_output_stream (); 2284 stream = make_resizing_buffer_output_stream ();
2285 #ifdef USE_KKCC
2286 event_stream_format_magic_event (XEVENT(event), stream);
2287 #else /* not USE_KKCC */
1266 event_stream_format_magic_event (event, stream); 2288 event_stream_format_magic_event (event, stream);
2289 #endif /* not USE_KKCC */
1267 Lstream_flush (XLSTREAM (stream)); 2290 Lstream_flush (XLSTREAM (stream));
1268 eicat_raw (buf, resizing_buffer_stream_ptr (XLSTREAM (stream)), 2291 eicat_raw (buf, resizing_buffer_stream_ptr (XLSTREAM (stream)),
1269 Lstream_byte_count (XLSTREAM (stream))); 2292 Lstream_byte_count (XLSTREAM (stream)));
1270 Lstream_delete (XLSTREAM (stream)); 2293 Lstream_delete (XLSTREAM (stream));
1271 UNGCPRO; 2294 UNGCPRO;
1323 abort (); 2346 abort ();
1324 if (mouse_p) 2347 if (mouse_p)
1325 eicat_c (buf, "up"); 2348 eicat_c (buf, "up");
1326 } 2349 }
1327 2350
2351
1328 DEFUN ("eventp", Feventp, 1, 1, 0, /* 2352 DEFUN ("eventp", Feventp, 1, 1, 0, /*
1329 True if OBJECT is an event object. 2353 True if OBJECT is an event object.
1330 */ 2354 */
1331 (object)) 2355 (object))
1332 { 2356 {
1336 DEFUN ("event-live-p", Fevent_live_p, 1, 1, 0, /* 2360 DEFUN ("event-live-p", Fevent_live_p, 1, 1, 0, /*
1337 True if OBJECT is an event object that has not been deallocated. 2361 True if OBJECT is an event object that has not been deallocated.
1338 */ 2362 */
1339 (object)) 2363 (object))
1340 { 2364 {
2365 #ifdef USE_KKCC
2366 return EVENTP (object) && XEVENT_TYPE (object) != dead_event ?
2367 Qt : Qnil;
2368 #else /* not USE_KKCC */
1341 return EVENTP (object) && XEVENT (object)->event_type != dead_event ? 2369 return EVENTP (object) && XEVENT (object)->event_type != dead_event ?
1342 Qt : Qnil; 2370 Qt : Qnil;
2371 #endif /* not USE_KKCC */
1343 } 2372 }
1344 2373
1345 #if 0 /* debugging functions */ 2374 #if 0 /* debugging functions */
1346 2375
1347 DEFUN ("event-next", Fevent_next, 1, 1, 0, /* 2376 DEFUN ("event-next", Fevent_next, 1, 1, 0, /*
1403 2432
1404 */ 2433 */
1405 (event)) 2434 (event))
1406 { 2435 {
1407 CHECK_LIVE_EVENT (event); 2436 CHECK_LIVE_EVENT (event);
2437 #ifdef USE_KKCC
2438 switch (XEVENT_TYPE (event))
2439 #else /* not USE_KKCC */
1408 switch (XEVENT (event)->event_type) 2440 switch (XEVENT (event)->event_type)
2441 #endif /* not USE_KKCC */
1409 { 2442 {
1410 case key_press_event: return Qkey_press; 2443 case key_press_event: return Qkey_press;
1411 case button_press_event: return Qbutton_press; 2444 case button_press_event: return Qbutton_press;
1412 case button_release_event: return Qbutton_release; 2445 case button_release_event: return Qbutton_release;
1413 case misc_user_event: return Qmisc_user; 2446 case misc_user_event: return Qmisc_user;
1439 { 2472 {
1440 CHECK_LIVE_EVENT (event); 2473 CHECK_LIVE_EVENT (event);
1441 /* This junk is so that timestamps don't get to be negative, but contain 2474 /* This junk is so that timestamps don't get to be negative, but contain
1442 as many bits as this particular emacs will allow. 2475 as many bits as this particular emacs will allow.
1443 */ 2476 */
2477 #ifdef USE_KKCC
2478 return make_int (((1L << (VALBITS - 1)) - 1) &
2479 XEVENT_TIMESTAMP (event));
2480 #else /* not USE_KKCC */
1444 return make_int (((1L << (VALBITS - 1)) - 1) & 2481 return make_int (((1L << (VALBITS - 1)) - 1) &
1445 XEVENT (event)->timestamp); 2482 XEVENT (event)->timestamp);
2483 #endif /* not USE_KKCC */
1446 } 2484 }
1447 2485
1448 #define TIMESTAMP_HALFSPACE (1L << (VALBITS - 2)) 2486 #define TIMESTAMP_HALFSPACE (1L << (VALBITS - 2))
1449 2487
1450 DEFUN ("event-timestamp<", Fevent_timestamp_lessp, 2, 2, 0, /* 2488 DEFUN ("event-timestamp<", Fevent_timestamp_lessp, 2, 2, 0, /*
1465 return t2 - t1 < TIMESTAMP_HALFSPACE ? Qt : Qnil; 2503 return t2 - t1 < TIMESTAMP_HALFSPACE ? Qt : Qnil;
1466 else 2504 else
1467 return t1 - t2 < TIMESTAMP_HALFSPACE ? Qnil : Qt; 2505 return t1 - t2 < TIMESTAMP_HALFSPACE ? Qnil : Qt;
1468 } 2506 }
1469 2507
2508 #ifdef USE_KKCC
2509 #define CHECK_EVENT_TYPE(e,t1,sym) do { \
2510 CHECK_LIVE_EVENT (e); \
2511 if (XEVENT_TYPE (e) != (t1)) \
2512 e = wrong_type_argument (sym,e); \
2513 } while (0)
2514 #else /* not USE_KKCC */
1470 #define CHECK_EVENT_TYPE(e,t1,sym) do { \ 2515 #define CHECK_EVENT_TYPE(e,t1,sym) do { \
1471 CHECK_LIVE_EVENT (e); \ 2516 CHECK_LIVE_EVENT (e); \
1472 if (XEVENT(e)->event_type != (t1)) \ 2517 if (XEVENT(e)->event_type != (t1)) \
1473 e = wrong_type_argument (sym,e); \ 2518 e = wrong_type_argument (sym,e); \
1474 } while (0) 2519 } while (0)
1475 2520 #endif /* not USE_KKCC */
2521
2522 #ifdef USE_KKCC
2523 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \
2524 CHECK_LIVE_EVENT (e); \
2525 { \
2526 emacs_event_type CET_type = XEVENT_TYPE (e); \
2527 if (CET_type != (t1) && \
2528 CET_type != (t2)) \
2529 e = wrong_type_argument (sym,e); \
2530 } \
2531 } while (0)
2532 #else /* not USE_KKCC */
1476 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \ 2533 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \
1477 CHECK_LIVE_EVENT (e); \ 2534 CHECK_LIVE_EVENT (e); \
1478 { \ 2535 { \
1479 emacs_event_type CET_type = XEVENT (e)->event_type; \ 2536 emacs_event_type CET_type = XEVENT (e)->event_type; \
1480 if (CET_type != (t1) && \ 2537 if (CET_type != (t1) && \
1481 CET_type != (t2)) \ 2538 CET_type != (t2)) \
1482 e = wrong_type_argument (sym,e); \ 2539 e = wrong_type_argument (sym,e); \
1483 } \ 2540 } \
1484 } while (0) 2541 } while (0)
1485 2542 #endif /* not USE_KKCC */
2543
2544 #ifdef USE_KKCC
2545 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \
2546 CHECK_LIVE_EVENT (e); \
2547 { \
2548 emacs_event_type CET_type = XEVENT_TYPE (e); \
2549 if (CET_type != (t1) && \
2550 CET_type != (t2) && \
2551 CET_type != (t3)) \
2552 e = wrong_type_argument (sym,e); \
2553 } \
2554 } while (0)
2555 #else /* not USE_KKCC */
1486 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \ 2556 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \
1487 CHECK_LIVE_EVENT (e); \ 2557 CHECK_LIVE_EVENT (e); \
1488 { \ 2558 { \
1489 emacs_event_type CET_type = XEVENT (e)->event_type; \ 2559 emacs_event_type CET_type = XEVENT (e)->event_type; \
1490 if (CET_type != (t1) && \ 2560 if (CET_type != (t1) && \
1491 CET_type != (t2) && \ 2561 CET_type != (t2) && \
1492 CET_type != (t3)) \ 2562 CET_type != (t3)) \
1493 e = wrong_type_argument (sym,e); \ 2563 e = wrong_type_argument (sym,e); \
1494 } \ 2564 } \
1495 } while (0) 2565 } while (0)
2566 #endif /* not USE_KKCC */
1496 2567
1497 DEFUN ("event-key", Fevent_key, 1, 1, 0, /* 2568 DEFUN ("event-key", Fevent_key, 1, 1, 0, /*
1498 Return the Keysym of the key-press event EVENT. 2569 Return the Keysym of the key-press event EVENT.
1499 This will be a character if the event is associated with one, else a symbol. 2570 This will be a character if the event is associated with one, else a symbol.
1500 */ 2571 */
1501 (event)) 2572 (event))
1502 { 2573 {
1503 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p); 2574 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p);
2575 #ifdef USE_KKCC
2576 return XKEY_DATA_KEYSYM (XEVENT_DATA (event));
2577 #else /* not USE_KKCC */
1504 return XEVENT (event)->event.key.keysym; 2578 return XEVENT (event)->event.key.keysym;
2579 #endif /* not USE_KKCC */
1505 } 2580 }
1506 2581
1507 DEFUN ("event-button", Fevent_button, 1, 1, 0, /* 2582 DEFUN ("event-button", Fevent_button, 1, 1, 0, /*
1508 Return the button-number of the button-press or button-release event EVENT. 2583 Return the button-number of the button-press or button-release event EVENT.
1509 */ 2584 */
1511 { 2586 {
1512 2587
1513 CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event, 2588 CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event,
1514 misc_user_event, Qbutton_event_p); 2589 misc_user_event, Qbutton_event_p);
1515 #ifdef HAVE_WINDOW_SYSTEM 2590 #ifdef HAVE_WINDOW_SYSTEM
2591 #ifdef USE_KKCC
2592 if ( XEVENT_TYPE (event) == misc_user_event)
2593 return make_int (XMISC_USER_DATA_BUTTON (XEVENT_DATA (event)));
2594 else
2595 return make_int (XBUTTON_DATA_BUTTON (XEVENT_DATA (event)));
2596 #else /* not USE_KKCC */
1516 if ( XEVENT (event)->event_type == misc_user_event) 2597 if ( XEVENT (event)->event_type == misc_user_event)
1517 return make_int (XEVENT (event)->event.misc.button); 2598 return make_int (XEVENT (event)->event.misc.button);
1518 else 2599 else
1519 return make_int (XEVENT (event)->event.button.button); 2600 return make_int (XEVENT (event)->event.button.button);
2601 #endif /* not USE_KKCC */
1520 #else /* !HAVE_WINDOW_SYSTEM */ 2602 #else /* !HAVE_WINDOW_SYSTEM */
1521 return Qzero; 2603 return Qzero;
1522 #endif /* !HAVE_WINDOW_SYSTEM */ 2604 #endif /* !HAVE_WINDOW_SYSTEM */
1523 2605
1524 } 2606 }
1530 */ 2612 */
1531 (event)) 2613 (event))
1532 { 2614 {
1533 again: 2615 again:
1534 CHECK_LIVE_EVENT (event); 2616 CHECK_LIVE_EVENT (event);
2617 #ifdef USE_KKCC
2618 switch (XEVENT_TYPE (event))
2619 {
2620 case key_press_event:
2621 return make_int (XKEY_DATA_MODIFIERS (XEVENT_DATA (event)));
2622 case button_press_event:
2623 case button_release_event:
2624 return make_int (XBUTTON_DATA_MODIFIERS (XEVENT_DATA (event)));
2625 case pointer_motion_event:
2626 return make_int (XMOTION_DATA_MODIFIERS (XEVENT_DATA (event)));
2627 case misc_user_event:
2628 return make_int (XMISC_USER_DATA_MODIFIERS (XEVENT_DATA (event)));
2629 default:
2630 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event);
2631 goto again;
2632 }
2633 #else /* not USE_KKCC */
1535 switch (XEVENT (event)->event_type) 2634 switch (XEVENT (event)->event_type)
1536 { 2635 {
1537 case key_press_event: 2636 case key_press_event:
1538 return make_int (XEVENT (event)->event.key.modifiers); 2637 return make_int (XEVENT (event)->event.key.modifiers);
1539 case button_press_event: 2638 case button_press_event:
1545 return make_int (XEVENT (event)->event.misc.modifiers); 2644 return make_int (XEVENT (event)->event.misc.modifiers);
1546 default: 2645 default:
1547 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event); 2646 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event);
1548 goto again; 2647 goto again;
1549 } 2648 }
2649 #endif /* not USE_KKCC */
1550 } 2650 }
1551 2651
1552 DEFUN ("event-modifiers", Fevent_modifiers, 1, 1, 0, /* 2652 DEFUN ("event-modifiers", Fevent_modifiers, 1, 1, 0, /*
1553 Return a list of symbols, the names of the modifier keys and buttons 2653 Return a list of symbols, the names of the modifier keys and buttons
1554 which were down when the given mouse or keyboard event was produced. 2654 which were down when the given mouse or keyboard event was produced.
1617 event_x_y_pixel_internal (Lisp_Object event, int *x, int *y, int relative) 2717 event_x_y_pixel_internal (Lisp_Object event, int *x, int *y, int relative)
1618 { 2718 {
1619 struct window *w; 2719 struct window *w;
1620 struct frame *f; 2720 struct frame *f;
1621 2721
2722 #ifdef USE_KKCC
2723 if (XEVENT_TYPE (event) == pointer_motion_event)
2724 {
2725 *x = XMOTION_DATA_X (XEVENT_DATA (event));
2726 *y = XMOTION_DATA_Y (XEVENT_DATA (event));
2727 }
2728 else if (XEVENT_TYPE (event) == button_press_event ||
2729 XEVENT_TYPE (event) == button_release_event)
2730 {
2731 *x = XBUTTON_DATA_X (XEVENT_DATA (event));
2732 *y = XBUTTON_DATA_Y (XEVENT_DATA (event));
2733 }
2734 else if (XEVENT_TYPE (event) == misc_user_event)
2735 {
2736 *x = XMISC_USER_DATA_X (XEVENT_DATA (event));
2737 *y = XMISC_USER_DATA_Y (XEVENT_DATA (event));
2738 }
2739 else
2740 return 0;
2741 #else /* not USE_KKCC */
1622 if (XEVENT (event)->event_type == pointer_motion_event) 2742 if (XEVENT (event)->event_type == pointer_motion_event)
1623 { 2743 {
1624 *x = XEVENT (event)->event.motion.x; 2744 *x = XEVENT (event)->event.motion.x;
1625 *y = XEVENT (event)->event.motion.y; 2745 *y = XEVENT (event)->event.motion.y;
1626 } 2746 }
1635 *x = XEVENT (event)->event.misc.x; 2755 *x = XEVENT (event)->event.misc.x;
1636 *y = XEVENT (event)->event.misc.y; 2756 *y = XEVENT (event)->event.misc.y;
1637 } 2757 }
1638 else 2758 else
1639 return 0; 2759 return 0;
1640 2760 #endif /* not USE_KKCC */
1641 f = XFRAME (EVENT_CHANNEL (XEVENT (event))); 2761 f = XFRAME (EVENT_CHANNEL (XEVENT (event)));
1642 2762
1643 if (relative) 2763 if (relative)
1644 { 2764 {
1645 w = find_window_by_pixel_pos (*x, *y, f->root_window); 2765 w = find_window_by_pixel_pos (*x, *y, f->root_window);
1772 Charbpos ret_bufp, ret_closest; 2892 Charbpos ret_bufp, ret_closest;
1773 Charcount ret_modeline_closest; 2893 Charcount ret_modeline_closest;
1774 Lisp_Object ret_obj1, ret_obj2; 2894 Lisp_Object ret_obj1, ret_obj2;
1775 2895
1776 CHECK_LIVE_EVENT (event); 2896 CHECK_LIVE_EVENT (event);
2897 #ifdef USE_KKCC
2898 frame = XEVENT_CHANNEL (event);
2899 switch (XEVENT_TYPE (event))
2900 {
2901 case pointer_motion_event :
2902 pix_x = XMOTION_DATA_X (XEVENT_DATA (event));
2903 pix_y = XMOTION_DATA_Y (XEVENT_DATA (event));
2904 break;
2905 case button_press_event :
2906 case button_release_event :
2907 pix_x = XBUTTON_DATA_X (XEVENT_DATA (event));
2908 pix_y = XBUTTON_DATA_Y (XEVENT_DATA (event));
2909 break;
2910 case misc_user_event :
2911 pix_x = XMISC_USER_DATA_X (XEVENT_DATA (event));
2912 pix_y = XMISC_USER_DATA_Y (XEVENT_DATA (event));
2913 break;
2914 default:
2915 dead_wrong_type_argument (Qmouse_event_p, event);
2916 }
2917 #else /* not USE_KKCC */
1777 frame = XEVENT (event)->channel; 2918 frame = XEVENT (event)->channel;
1778 switch (XEVENT (event)->event_type) 2919 switch (XEVENT (event)->event_type)
1779 { 2920 {
1780 case pointer_motion_event : 2921 case pointer_motion_event :
1781 pix_x = XEVENT (event)->event.motion.x; 2922 pix_x = XEVENT (event)->event.motion.x;
1791 pix_y = XEVENT (event)->event.misc.y; 2932 pix_y = XEVENT (event)->event.misc.y;
1792 break; 2933 break;
1793 default: 2934 default:
1794 dead_wrong_type_argument (Qmouse_event_p, event); 2935 dead_wrong_type_argument (Qmouse_event_p, event);
1795 } 2936 }
2937 #endif /* not USE_KKCC */
1796 2938
1797 result = pixel_to_glyph_translation (XFRAME (frame), pix_x, pix_y, 2939 result = pixel_to_glyph_translation (XFRAME (frame), pix_x, pix_y,
1798 &ret_x, &ret_y, &ret_obj_x, &ret_obj_y, 2940 &ret_x, &ret_y, &ret_obj_x, &ret_obj_y,
1799 &ret_w, &ret_bufp, &ret_closest, 2941 &ret_w, &ret_bufp, &ret_closest,
1800 &ret_modeline_closest, 2942 &ret_modeline_closest,
2099 DEFUN ("event-process", Fevent_process, 1, 1, 0, /* 3241 DEFUN ("event-process", Fevent_process, 1, 1, 0, /*
2100 Return the process of the process-output event EVENT. 3242 Return the process of the process-output event EVENT.
2101 */ 3243 */
2102 (event)) 3244 (event))
2103 { 3245 {
3246 #ifdef USE_KKCC
3247 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p);
3248 return XPROCESS_DATA_PROCESS (XEVENT_DATA (event));
3249 #else /* not USE_KKCC */
2104 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p); 3250 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p);
2105 return XEVENT (event)->event.process.process; 3251 return XEVENT (event)->event.process.process;
3252 #endif /* not USE_KKCC */
2106 } 3253 }
2107 3254
2108 DEFUN ("event-function", Fevent_function, 1, 1, 0, /* 3255 DEFUN ("event-function", Fevent_function, 1, 1, 0, /*
2109 Return the callback function of EVENT. 3256 Return the callback function of EVENT.
2110 EVENT should be a timeout, misc-user, or eval event. 3257 EVENT should be a timeout, misc-user, or eval event.
2111 */ 3258 */
2112 (event)) 3259 (event))
2113 { 3260 {
2114 again: 3261 again:
2115 CHECK_LIVE_EVENT (event); 3262 CHECK_LIVE_EVENT (event);
3263 #ifdef USE_KKCC
3264 switch (XEVENT_TYPE (event))
3265 {
3266 case timeout_event:
3267 return XTIMEOUT_DATA_FUNCTION (XEVENT_DATA (event));
3268 case misc_user_event:
3269 return XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event));
3270 case eval_event:
3271 return XEVAL_DATA_FUNCTION (XEVENT_DATA (event));
3272 default:
3273 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
3274 goto again;
3275 }
3276 #else /* not USE_KKCC */
2116 switch (XEVENT (event)->event_type) 3277 switch (XEVENT (event)->event_type)
2117 { 3278 {
2118 case timeout_event: 3279 case timeout_event:
2119 return XEVENT (event)->event.timeout.function; 3280 return XEVENT (event)->event.timeout.function;
2120 case misc_user_event: 3281 case misc_user_event:
2123 return XEVENT (event)->event.eval.function; 3284 return XEVENT (event)->event.eval.function;
2124 default: 3285 default:
2125 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); 3286 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
2126 goto again; 3287 goto again;
2127 } 3288 }
3289 #endif /* not USE_KKCC */
2128 } 3290 }
2129 3291
2130 DEFUN ("event-object", Fevent_object, 1, 1, 0, /* 3292 DEFUN ("event-object", Fevent_object, 1, 1, 0, /*
2131 Return the callback function argument of EVENT. 3293 Return the callback function argument of EVENT.
2132 EVENT should be a timeout, misc-user, or eval event. 3294 EVENT should be a timeout, misc-user, or eval event.
2133 */ 3295 */
2134 (event)) 3296 (event))
2135 { 3297 {
2136 again: 3298 again:
2137 CHECK_LIVE_EVENT (event); 3299 CHECK_LIVE_EVENT (event);
3300 #ifdef USE_KKCC
3301 switch (XEVENT_TYPE (event))
3302 {
3303 case timeout_event:
3304 return XTIMEOUT_DATA_OBJECT (XEVENT_DATA (event));
3305 case misc_user_event:
3306 return XMISC_USER_DATA_OBJECT (XEVENT_DATA (event));
3307 case eval_event:
3308 return XEVAL_DATA_OBJECT (XEVENT_DATA (event));
3309 default:
3310 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
3311 goto again;
3312 }
3313 #else /* not USE_KKCC */
2138 switch (XEVENT (event)->event_type) 3314 switch (XEVENT (event)->event_type)
2139 { 3315 {
2140 case timeout_event: 3316 case timeout_event:
2141 return XEVENT (event)->event.timeout.object; 3317 return XEVENT (event)->event.timeout.object;
2142 case misc_user_event: 3318 case misc_user_event:
2145 return XEVENT (event)->event.eval.object; 3321 return XEVENT (event)->event.eval.object;
2146 default: 3322 default:
2147 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); 3323 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
2148 goto again; 3324 goto again;
2149 } 3325 }
3326 #endif /* not USE_KKCC */
2150 } 3327 }
2151 3328
2152 DEFUN ("event-properties", Fevent_properties, 1, 1, 0, /* 3329 DEFUN ("event-properties", Fevent_properties, 1, 1, 0, /*
2153 Return a list of all of the properties of EVENT. 3330 Return a list of all of the properties of EVENT.
2154 This is in the form of a property list (alternating keyword/value pairs). 3331 This is in the form of a property list (alternating keyword/value pairs).
2163 e = XEVENT (event); 3340 e = XEVENT (event);
2164 GCPRO1 (props); 3341 GCPRO1 (props);
2165 3342
2166 props = cons3 (Qtimestamp, Fevent_timestamp (event), props); 3343 props = cons3 (Qtimestamp, Fevent_timestamp (event), props);
2167 3344
3345 #ifdef USE_KKCC
3346 switch (EVENT_TYPE (e))
3347 #else /* not USE_KKCC */
2168 switch (e->event_type) 3348 switch (e->event_type)
3349 #endif /* not USE_KKCC */
2169 { 3350 {
2170 default: abort (); 3351 default: abort ();
2171 3352
2172 case process_event: 3353 case process_event:
3354 #ifdef USE_KKCC
3355 props = cons3 (Qprocess, XPROCESS_DATA_PROCESS (EVENT_DATA (e)), props);
3356 #else /* not USE_KKCC */
2173 props = cons3 (Qprocess, e->event.process.process, props); 3357 props = cons3 (Qprocess, e->event.process.process, props);
3358 #endif /* not USE_KKCC */
2174 break; 3359 break;
2175 3360
2176 case timeout_event: 3361 case timeout_event:
2177 props = cons3 (Qobject, Fevent_object (event), props); 3362 props = cons3 (Qobject, Fevent_object (event), props);
2178 props = cons3 (Qfunction, Fevent_function (event), props); 3363 props = cons3 (Qfunction, Fevent_function (event), props);
3364 #ifdef USE_KKCC
3365 props = cons3 (Qid, make_int (XTIMEOUT_DATA_ID_NUMBER (EVENT_DATA (e))), props);
3366 #else /* not USE_KKCC */
2179 props = cons3 (Qid, make_int (e->event.timeout.id_number), props); 3367 props = cons3 (Qid, make_int (e->event.timeout.id_number), props);
3368 #endif /* not USE_KKCC */
2180 break; 3369 break;
2181 3370
2182 case key_press_event: 3371 case key_press_event:
2183 props = cons3 (Qmodifiers, Fevent_modifiers (event), props); 3372 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
2184 props = cons3 (Qkey, Fevent_key (event), props); 3373 props = cons3 (Qkey, Fevent_key (event), props);
2234 3423
2235 void 3424 void
2236 syms_of_events (void) 3425 syms_of_events (void)
2237 { 3426 {
2238 INIT_LRECORD_IMPLEMENTATION (event); 3427 INIT_LRECORD_IMPLEMENTATION (event);
3428 #ifdef USE_KKCC
3429 INIT_LRECORD_IMPLEMENTATION (key_data);
3430 INIT_LRECORD_IMPLEMENTATION (button_data);
3431 INIT_LRECORD_IMPLEMENTATION (motion_data);
3432 INIT_LRECORD_IMPLEMENTATION (process_data);
3433 INIT_LRECORD_IMPLEMENTATION (timeout_data);
3434 INIT_LRECORD_IMPLEMENTATION (eval_data);
3435 INIT_LRECORD_IMPLEMENTATION (misc_user_data);
3436 INIT_LRECORD_IMPLEMENTATION (magic_eval_data);
3437 INIT_LRECORD_IMPLEMENTATION (magic_data);
3438 #endif /* USE_KKCC */
2239 3439
2240 DEFSUBR (Fcharacter_to_event); 3440 DEFSUBR (Fcharacter_to_event);
2241 DEFSUBR (Fevent_to_character); 3441 DEFSUBR (Fevent_to_character);
2242 3442
2243 DEFSUBR (Fmake_event); 3443 DEFSUBR (Fmake_event);