428
|
1 /* Events: printing them, converting them to and from characters.
|
|
2 Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
788
|
4 Copyright (C) 2001, 2002 Ben Wing.
|
428
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25 /* This file has been Mule-ized. */
|
|
26
|
|
27 #include <config.h>
|
|
28 #include "lisp.h"
|
|
29 #include "buffer.h"
|
|
30 #include "console.h"
|
|
31 #include "device.h"
|
788
|
32 #include "extents.h"
|
428
|
33 #include "events.h"
|
872
|
34 #include "frame-impl.h"
|
428
|
35 #include "glyphs.h"
|
|
36 #include "keymap.h" /* for key_desc_list_to_event() */
|
788
|
37 #include "lstream.h"
|
428
|
38 #include "redisplay.h"
|
800
|
39 #include "toolbar.h"
|
428
|
40 #include "window.h"
|
|
41
|
872
|
42 #include "console-tty-impl.h" /* for stuff in character_to_event */
|
800
|
43
|
934
|
44 #ifdef USE_KKCC
|
|
45 #include "console-x.h"
|
|
46 #endif /* USE_KKCC */
|
|
47
|
428
|
48 /* Where old events go when they are explicitly deallocated.
|
|
49 The event chain here is cut loose before GC, so these will be freed
|
|
50 eventually.
|
|
51 */
|
|
52 static Lisp_Object Vevent_resource;
|
|
53
|
|
54 Lisp_Object Qeventp;
|
|
55 Lisp_Object Qevent_live_p;
|
|
56 Lisp_Object Qkey_press_event_p;
|
|
57 Lisp_Object Qbutton_event_p;
|
|
58 Lisp_Object Qmouse_event_p;
|
|
59 Lisp_Object Qprocess_event_p;
|
|
60
|
|
61 Lisp_Object Qkey_press, Qbutton_press, Qbutton_release, Qmisc_user;
|
|
62 Lisp_Object Qascii_character;
|
|
63
|
771
|
64
|
|
65 /************************************************************************/
|
|
66 /* definition of event object */
|
|
67 /************************************************************************/
|
428
|
68
|
|
69 /* #### Ad-hoc hack. Should be part of define_lrecord_implementation */
|
|
70 void
|
|
71 clear_event_resource (void)
|
|
72 {
|
|
73 Vevent_resource = Qnil;
|
|
74 }
|
|
75
|
934
|
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
|
|
315 if (print_readably)
|
|
316 printing_unreadable_object ("#<motion_data>");
|
|
317
|
943
|
318 sprintf (buf, "#<motion-data %ld, %ld>",
|
|
319 (long) XMOTION_DATA_X (obj),
|
|
320 (long) XMOTION_DATA_Y (obj));
|
934
|
321 write_c_string (printcharfun, buf);
|
|
322 }
|
|
323
|
|
324
|
|
325 static void
|
|
326 print_process_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
327 {
|
|
328 if (print_readably)
|
|
329 printing_unreadable_object ("#<process_data>");
|
|
330
|
943
|
331 write_c_string (printcharfun, "#<process-data ");
|
934
|
332 print_internal (XPROCESS_DATA_PROCESS (obj), printcharfun, 1);
|
|
333 write_c_string (printcharfun, ">");
|
|
334 }
|
|
335
|
|
336
|
|
337 static void
|
|
338 print_timeout_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
339 {
|
|
340 if (print_readably)
|
|
341 printing_unreadable_object ("#<timeout_data>");
|
|
342
|
|
343 write_c_string (printcharfun, "#<timeout-data ");
|
|
344 print_internal (XTIMEOUT_DATA_OBJECT (obj), printcharfun, 1);
|
|
345 write_c_string (printcharfun, ">");
|
|
346 }
|
|
347
|
|
348
|
|
349 static void
|
|
350 print_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
351 {
|
|
352 if (print_readably)
|
|
353 printing_unreadable_object ("#<eval_data>");
|
|
354
|
|
355 write_c_string (printcharfun, "#<eval-data ");
|
|
356 print_internal (XEVAL_DATA_FUNCTION (obj), printcharfun, 1);
|
|
357 write_c_string (printcharfun, " ");
|
|
358 print_internal (XEVAL_DATA_OBJECT (obj), printcharfun, 1);
|
|
359 write_c_string (printcharfun, ">");
|
|
360 }
|
|
361
|
|
362
|
|
363 static void
|
|
364 print_misc_user_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
365 {
|
|
366 if (print_readably)
|
|
367 printing_unreadable_object ("#<misc_user_data>");
|
|
368
|
|
369 write_c_string (printcharfun, "#<misc-user-data ");
|
|
370 print_internal (XMISC_USER_DATA_FUNCTION (obj), printcharfun, 1);
|
|
371 write_c_string (printcharfun, " ");
|
|
372 print_internal (XMISC_USER_DATA_OBJECT (obj), printcharfun, 1);
|
|
373 write_c_string (printcharfun, ">");
|
|
374 }
|
|
375
|
|
376
|
|
377 static void
|
|
378 print_magic_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
379 {
|
|
380 // char buf[128];
|
|
381
|
|
382 if (print_readably)
|
|
383 printing_unreadable_object ("#<magic_eval_data>");
|
|
384
|
|
385 /* format_event_data_object (buf + 18, obj, 0);*/
|
|
386 }
|
|
387
|
|
388
|
|
389 static void
|
|
390 print_magic_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
391 {
|
|
392 char buf[128];
|
|
393
|
|
394 if (print_readably)
|
|
395 printing_unreadable_object ("#<magic_data>");
|
|
396
|
|
397 sprintf (buf, "#<magic-data ");
|
|
398 /* format_event_data_object (buf + 13, obj, 0);
|
|
399 sprintf (buf + strlen (buf), ">");
|
|
400 write_c_string (print_readably, buf);*/
|
|
401 }
|
|
402
|
|
403
|
|
404 static int
|
|
405 event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
406 {
|
|
407 Lisp_Event *e1 = XEVENT (obj1);
|
|
408 Lisp_Event *e2 = XEVENT (obj2);
|
|
409
|
|
410 if (EVENT_TYPE (e1) != EVENT_TYPE (e2)) return 0;
|
|
411 if (!EQ (EVENT_CHANNEL (e1), EVENT_CHANNEL (e2))) return 0;
|
|
412 /* if (EVENT_TIMESTAMP (e1) != EVENT_TIMESTAMP (e2)) return 0; */
|
|
413 switch (EVENT_TYPE (e1))
|
|
414 {
|
|
415 default: abort ();
|
|
416
|
|
417 case process_event:
|
|
418 case timeout_event:
|
|
419 case pointer_motion_event:
|
|
420 case key_press_event:
|
|
421 case button_press_event:
|
|
422 case button_release_event:
|
|
423 case misc_user_event:
|
|
424 case eval_event:
|
|
425 case magic_eval_event:
|
|
426 return internal_equal (EVENT_DATA (e1), EVENT_DATA (e2), 0);
|
|
427
|
|
428 case magic_event:
|
|
429 {
|
|
430 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)));
|
|
431
|
|
432 #ifdef HAVE_X_WINDOWS
|
|
433 if (CONSOLE_X_P (con))
|
|
434 return (XMAGIC_DATA_X_EVENT (EVENT_DATA (e1)).xany.serial ==
|
|
435 XMAGIC_DATA_X_EVENT (EVENT_DATA (e2)).xany.serial);
|
|
436 #endif
|
|
437 #ifdef HAVE_GTK
|
|
438 if (CONSOLE_GTK_P (con))
|
|
439 return (XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e1)) ==
|
|
440 XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e2)));
|
|
441 #endif
|
|
442 #ifdef HAVE_MS_WINDOWS
|
|
443 if (CONSOLE_MSWINDOWS_P (con))
|
941
|
444 return (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e1)) ==
|
|
445 XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e2)));
|
934
|
446 #endif
|
|
447 abort ();
|
|
448 return 1; /* not reached */
|
|
449 }
|
|
450
|
|
451 case empty_event: /* Empty and deallocated events are equal. */
|
|
452 case dead_event:
|
|
453 return 1;
|
|
454 }
|
|
455 }
|
|
456
|
|
457 static int
|
|
458 key_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
459 {
|
|
460 return (EQ (XKEY_DATA_KEYSYM (obj1), XKEY_DATA_KEYSYM (obj2)) &&
|
|
461 (XKEY_DATA_MODIFIERS (obj1) == XKEY_DATA_MODIFIERS (obj2)));
|
|
462 }
|
|
463
|
|
464 static int
|
|
465 button_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
466 {
|
|
467 return (XBUTTON_DATA_BUTTON (obj1) == XBUTTON_DATA_BUTTON (obj2) &&
|
|
468 XBUTTON_DATA_MODIFIERS (obj1) == XBUTTON_DATA_MODIFIERS (obj2));
|
|
469 }
|
|
470
|
|
471 static int
|
|
472 motion_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
473 {
|
|
474 return (XMOTION_DATA_X (obj1) == XMOTION_DATA_X (obj2) &&
|
|
475 XMOTION_DATA_Y (obj1) == XMOTION_DATA_Y (obj2));
|
|
476 }
|
|
477
|
|
478 static int
|
|
479 process_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
480 {
|
|
481 return EQ (XPROCESS_DATA_PROCESS (obj1), XPROCESS_DATA_PROCESS (obj2));
|
|
482 }
|
|
483
|
|
484 static int
|
|
485 timeout_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
486 {
|
|
487 return (internal_equal (XTIMEOUT_DATA_FUNCTION (obj1),
|
|
488 XTIMEOUT_DATA_FUNCTION (obj2), 0) &&
|
|
489 internal_equal (XTIMEOUT_DATA_OBJECT (obj1),
|
|
490 XTIMEOUT_DATA_OBJECT (obj2), 0));
|
|
491 }
|
|
492
|
|
493 static int
|
|
494 eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
495 {
|
|
496 return (internal_equal (XEVAL_DATA_FUNCTION (obj1),
|
|
497 XEVAL_DATA_FUNCTION (obj2), 0) &&
|
|
498 internal_equal (XEVAL_DATA_OBJECT (obj1),
|
|
499 XEVAL_DATA_OBJECT (obj2), 0));
|
|
500 }
|
|
501
|
|
502 static int
|
|
503 misc_user_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
504 {
|
|
505 return (internal_equal (XMISC_USER_DATA_FUNCTION (obj1),
|
|
506 XMISC_USER_DATA_FUNCTION (obj2), 0) &&
|
|
507 internal_equal (XMISC_USER_DATA_OBJECT (obj1),
|
|
508 XMISC_USER_DATA_OBJECT (obj2), 0) &&
|
|
509 /* is this really needed for equality
|
|
510 or is x and y also important? */
|
|
511 XMISC_USER_DATA_BUTTON (obj1) == XMISC_USER_DATA_BUTTON (obj2) &&
|
|
512 XMISC_USER_DATA_MODIFIERS (obj1) ==
|
|
513 XMISC_USER_DATA_MODIFIERS (obj2));
|
|
514 }
|
|
515
|
|
516 static int
|
|
517 magic_eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
518 {
|
|
519 return (XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj1) ==
|
|
520 XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj2) &&
|
|
521 internal_equal (XMAGIC_EVAL_DATA_OBJECT (obj1),
|
|
522 XMAGIC_EVAL_DATA_OBJECT (obj2), 0));
|
|
523 }
|
|
524
|
|
525 static int
|
|
526 magic_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
527 {assert (0); return 0;}
|
|
528
|
|
529 static unsigned long
|
|
530 event_hash (Lisp_Object obj, int depth)
|
|
531 {
|
|
532 Lisp_Event *e = XEVENT (obj);
|
|
533 unsigned long hash;
|
|
534
|
|
535 hash = HASH2 (EVENT_TYPE (e), LISP_HASH (EVENT_CHANNEL (e)));
|
|
536 switch (EVENT_TYPE (e))
|
|
537 {
|
|
538 case process_event:
|
|
539 case timeout_event:
|
|
540 case key_press_event:
|
|
541 case button_press_event:
|
|
542 case button_release_event:
|
|
543 case pointer_motion_event:
|
|
544 case misc_user_event:
|
|
545 case eval_event:
|
|
546 case magic_eval_event:
|
|
547 return HASH2 (hash, internal_hash (EVENT_DATA (e), depth + 1));
|
|
548
|
|
549 case magic_event:
|
|
550 {
|
|
551 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e)));
|
|
552 #ifdef HAVE_X_WINDOWS
|
|
553 if (CONSOLE_X_P (con))
|
|
554 return HASH2 (hash, XMAGIC_DATA_X_EVENT (EVENT_DATA (e)).xany.serial);
|
|
555 #endif
|
|
556 #ifdef HAVE_GTK
|
|
557 if (CONSOLE_GTK_P (con))
|
|
558 return HASH2 (hash, XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e)));
|
|
559 #endif
|
|
560 #ifdef HAVE_MS_WINDOWS
|
|
561 if (CONSOLE_MSWINDOWS_P (con))
|
|
562 return HASH2 (hash, XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e)));
|
|
563 #endif
|
|
564 abort ();
|
|
565 return 0;
|
|
566 }
|
|
567
|
|
568 case empty_event:
|
|
569 case dead_event:
|
|
570 return hash;
|
|
571
|
|
572 default:
|
|
573 abort ();
|
|
574 }
|
|
575
|
|
576 return 0; /* unreached */
|
|
577 }
|
|
578
|
|
579 static unsigned long
|
|
580 key_data_hash (Lisp_Object obj, int depth)
|
|
581 {
|
|
582 return HASH2 (LISP_HASH (XKEY_DATA_KEYSYM (obj)),
|
|
583 XKEY_DATA_MODIFIERS (obj));
|
|
584 }
|
|
585
|
|
586 static unsigned long
|
|
587 button_data_hash (Lisp_Object obj, int depth)
|
|
588 {
|
|
589 return HASH2 (XBUTTON_DATA_BUTTON (obj), XBUTTON_DATA_MODIFIERS (obj));
|
|
590 }
|
|
591
|
|
592 static unsigned long
|
|
593 motion_data_hash (Lisp_Object obj, int depth)
|
|
594 {
|
|
595 return HASH2 (XMOTION_DATA_X (obj), XMOTION_DATA_Y (obj));
|
|
596 }
|
|
597
|
|
598 static unsigned long
|
|
599 process_data_hash (Lisp_Object obj, int depth)
|
|
600 {
|
|
601 return LISP_HASH (XPROCESS_DATA_PROCESS (obj));
|
|
602 }
|
|
603
|
|
604 static unsigned long
|
|
605 timeout_data_hash (Lisp_Object obj, int depth)
|
|
606 {
|
|
607 return HASH2 (internal_hash (XTIMEOUT_DATA_FUNCTION (obj), depth + 1),
|
|
608 internal_hash (XTIMEOUT_DATA_OBJECT (obj), depth + 1));
|
|
609 }
|
|
610
|
|
611 static unsigned long
|
|
612 eval_data_hash (Lisp_Object obj, int depth)
|
|
613 {
|
|
614 return HASH2 (internal_hash (XEVAL_DATA_FUNCTION (obj), depth + 1),
|
|
615 internal_hash (XEVAL_DATA_OBJECT (obj), depth + 1));
|
|
616 }
|
|
617
|
|
618 static unsigned long
|
|
619 misc_user_data_hash (Lisp_Object obj, int depth)
|
|
620 {
|
|
621 return HASH4 (internal_hash (XMISC_USER_DATA_FUNCTION (obj), depth + 1),
|
|
622 internal_hash (XMISC_USER_DATA_OBJECT (obj), depth + 1),
|
|
623 XMISC_USER_DATA_BUTTON (obj), XMISC_USER_DATA_MODIFIERS (obj));
|
|
624 }
|
|
625
|
|
626 static unsigned long
|
|
627 magic_eval_data_hash (Lisp_Object obj, int depth)
|
|
628 {
|
|
629 return HASH2 ((unsigned long) XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj),
|
|
630 internal_hash (XMAGIC_EVAL_DATA_OBJECT (obj), depth + 1));
|
|
631 }
|
|
632
|
|
633 static unsigned long
|
|
634 magic_data_hash (Lisp_Object obj, int depth)
|
|
635 {assert(0); return 1;}
|
|
636
|
|
637 DEFINE_LRECORD_IMPLEMENTATION ("key-data", key_data,
|
|
638 0, /*dumpable-flag*/
|
|
639 mark_key_data,
|
|
640 print_key_data, 0,
|
|
641 key_data_equal, key_data_hash, key_data_description,
|
|
642 Lisp_Key_Data);
|
|
643
|
|
644 DEFINE_LRECORD_IMPLEMENTATION ("button-data", button_data,
|
|
645 0, /*dumpable-flag*/
|
|
646 mark_button_data, print_button_data, 0,
|
|
647 button_data_equal, button_data_hash, button_data_description,
|
|
648 Lisp_Button_Data);
|
|
649
|
|
650 DEFINE_LRECORD_IMPLEMENTATION ("motion-data", motion_data,
|
|
651 0, /*dumpable-flag*/
|
|
652 mark_motion_data, print_motion_data, 0,
|
|
653 motion_data_equal, motion_data_hash, motion_data_description,
|
|
654 Lisp_Motion_Data);
|
|
655
|
|
656 DEFINE_LRECORD_IMPLEMENTATION ("process-data", process_data,
|
|
657 0, /*dumpable-flag*/
|
|
658 mark_process_data,
|
|
659 print_process_data, 0,
|
|
660 process_data_equal, process_data_hash, process_data_description,
|
|
661 Lisp_Process_Data);
|
|
662
|
|
663 DEFINE_LRECORD_IMPLEMENTATION ("timeout-data", timeout_data,
|
|
664 0, /*dumpable-flag*/
|
|
665 mark_timeout_data,
|
|
666 print_timeout_data, 0,
|
|
667 timeout_data_equal, timeout_data_hash, timeout_data_description,
|
|
668 Lisp_Timeout_Data);
|
|
669
|
|
670 DEFINE_LRECORD_IMPLEMENTATION ("eval-data", eval_data,
|
|
671 0, /*dumpable-flag*/
|
|
672 mark_eval_data,
|
|
673 print_eval_data, 0,
|
|
674 eval_data_equal, eval_data_hash, eval_data_description,
|
|
675 Lisp_Eval_Data);
|
|
676
|
|
677 DEFINE_LRECORD_IMPLEMENTATION ("misc-user-data", misc_user_data,
|
|
678 0, /*dumpable-flag*/
|
|
679 mark_misc_user_data,
|
|
680 print_misc_user_data,
|
|
681 0, misc_user_data_equal,
|
|
682 misc_user_data_hash, misc_user_data_description,
|
|
683 Lisp_Misc_User_Data);
|
|
684
|
|
685 DEFINE_LRECORD_IMPLEMENTATION ("magic-eval-data", magic_eval_data,
|
|
686 0, /*dumpable-flag*/
|
|
687 mark_magic_eval_data,
|
|
688 print_magic_eval_data, 0,
|
|
689 magic_eval_data_equal,
|
|
690 magic_eval_data_hash, magic_eval_data_description,
|
|
691 Lisp_Magic_Eval_Data);
|
|
692
|
|
693 DEFINE_LRECORD_IMPLEMENTATION ("magic-data", magic_data,
|
|
694 0, /*dumpable-flag*/
|
|
695 mark_magic_data, print_magic_data, 0,
|
|
696 magic_data_equal, magic_data_hash, magic_data_description,
|
|
697 Lisp_Magic_Data);
|
|
698
|
|
699
|
|
700
|
|
701 #else /* not USE_KKCC */
|
428
|
702 /* Make sure we lose quickly if we try to use this event */
|
|
703 static void
|
|
704 deinitialize_event (Lisp_Object ev)
|
|
705 {
|
|
706 int i;
|
440
|
707 Lisp_Event *event = XEVENT (ev);
|
428
|
708
|
440
|
709 for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++)
|
428
|
710 ((int *) event) [i] = 0xdeadbeef;
|
|
711 event->event_type = dead_event;
|
|
712 event->channel = Qnil;
|
442
|
713 set_lheader_implementation (&event->lheader, &lrecord_event);
|
428
|
714 XSET_EVENT_NEXT (ev, Qnil);
|
|
715 }
|
|
716
|
|
717 /* Set everything to zero or nil so that it's predictable. */
|
|
718 void
|
440
|
719 zero_event (Lisp_Event *e)
|
428
|
720 {
|
|
721 xzero (*e);
|
442
|
722 set_lheader_implementation (&e->lheader, &lrecord_event);
|
428
|
723 e->event_type = empty_event;
|
|
724 e->next = Qnil;
|
|
725 e->channel = Qnil;
|
|
726 }
|
|
727
|
|
728 static Lisp_Object
|
|
729 mark_event (Lisp_Object obj)
|
|
730 {
|
440
|
731 Lisp_Event *event = XEVENT (obj);
|
428
|
732
|
|
733 switch (event->event_type)
|
|
734 {
|
|
735 case key_press_event:
|
|
736 mark_object (event->event.key.keysym);
|
|
737 break;
|
|
738 case process_event:
|
|
739 mark_object (event->event.process.process);
|
|
740 break;
|
|
741 case timeout_event:
|
|
742 mark_object (event->event.timeout.function);
|
|
743 mark_object (event->event.timeout.object);
|
|
744 break;
|
|
745 case eval_event:
|
|
746 case misc_user_event:
|
|
747 mark_object (event->event.eval.function);
|
|
748 mark_object (event->event.eval.object);
|
|
749 break;
|
|
750 case magic_eval_event:
|
|
751 mark_object (event->event.magic_eval.object);
|
|
752 break;
|
|
753 case button_press_event:
|
|
754 case button_release_event:
|
|
755 case pointer_motion_event:
|
|
756 case magic_event:
|
|
757 case empty_event:
|
|
758 case dead_event:
|
|
759 break;
|
|
760 default:
|
|
761 abort ();
|
|
762 }
|
|
763 mark_object (event->channel);
|
|
764 return event->next;
|
|
765 }
|
|
766
|
|
767 static void
|
442
|
768 print_event_1 (const char *str, Lisp_Object obj, Lisp_Object printcharfun)
|
428
|
769 {
|
793
|
770 DECLARE_EISTRING_MALLOC (ei);
|
826
|
771 write_c_string (printcharfun, str);
|
793
|
772 format_event_object (ei, XEVENT (obj), 0);
|
826
|
773 write_eistring (printcharfun, ei);
|
793
|
774 eifree (ei);
|
428
|
775 }
|
|
776
|
|
777 static void
|
|
778 print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
779 {
|
|
780 if (print_readably)
|
563
|
781 printing_unreadable_object ("#<event>");
|
428
|
782
|
|
783 switch (XEVENT (obj)->event_type)
|
|
784 {
|
|
785 case key_press_event:
|
|
786 print_event_1 ("#<keypress-event ", obj, printcharfun);
|
|
787 break;
|
|
788 case button_press_event:
|
|
789 print_event_1 ("#<buttondown-event ", obj, printcharfun);
|
|
790 break;
|
|
791 case button_release_event:
|
|
792 print_event_1 ("#<buttonup-event ", obj, printcharfun);
|
|
793 break;
|
|
794 case magic_event:
|
|
795 case magic_eval_event:
|
|
796 print_event_1 ("#<magic-event ", obj, printcharfun);
|
|
797 break;
|
|
798 case pointer_motion_event:
|
|
799 {
|
|
800 Lisp_Object Vx, Vy;
|
|
801 Vx = Fevent_x_pixel (obj);
|
|
802 assert (INTP (Vx));
|
|
803 Vy = Fevent_y_pixel (obj);
|
|
804 assert (INTP (Vy));
|
793
|
805 write_fmt_string (printcharfun, "#<motion-event %ld, %ld",
|
|
806 (long) XINT (Vx), (long) XINT (Vy));
|
428
|
807 break;
|
|
808 }
|
|
809 case process_event:
|
800
|
810 write_fmt_string_lisp (printcharfun, "#<process-event %S", 1, XEVENT (obj)->event.process.process);
|
428
|
811 break;
|
|
812 case timeout_event:
|
800
|
813 write_fmt_string_lisp (printcharfun, "#<timeout-event %S", 1, XEVENT (obj)->event.timeout.object);
|
428
|
814 break;
|
|
815 case empty_event:
|
826
|
816 write_c_string (printcharfun, "#<empty-event");
|
428
|
817 break;
|
|
818 case misc_user_event:
|
800
|
819 write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S", 1, XEVENT (obj)->event.misc.function);
|
|
820 write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.misc.object);
|
428
|
821 break;
|
|
822 case eval_event:
|
800
|
823 write_fmt_string_lisp (printcharfun, "#<eval-event (%S", 1, XEVENT (obj)->event.eval.function);
|
|
824 write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.eval.object);
|
428
|
825 break;
|
|
826 case dead_event:
|
826
|
827 write_c_string (printcharfun, "#<DEALLOCATED-EVENT");
|
428
|
828 break;
|
|
829 default:
|
826
|
830 write_c_string (printcharfun, "#<UNKNOWN-EVENT-TYPE");
|
428
|
831 break;
|
|
832 }
|
826
|
833 write_c_string (printcharfun, ">");
|
428
|
834 }
|
|
835
|
|
836 static int
|
|
837 event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
|
|
838 {
|
440
|
839 Lisp_Event *e1 = XEVENT (obj1);
|
|
840 Lisp_Event *e2 = XEVENT (obj2);
|
428
|
841
|
|
842 if (e1->event_type != e2->event_type) return 0;
|
|
843 if (!EQ (e1->channel, e2->channel)) return 0;
|
|
844 /* if (e1->timestamp != e2->timestamp) return 0; */
|
|
845 switch (e1->event_type)
|
|
846 {
|
|
847 default: abort ();
|
|
848
|
|
849 case process_event:
|
|
850 return EQ (e1->event.process.process, e2->event.process.process);
|
|
851
|
|
852 case timeout_event:
|
|
853 return (internal_equal (e1->event.timeout.function,
|
|
854 e2->event.timeout.function, 0) &&
|
|
855 internal_equal (e1->event.timeout.object,
|
|
856 e2->event.timeout.object, 0));
|
|
857
|
|
858 case key_press_event:
|
|
859 return (EQ (e1->event.key.keysym, e2->event.key.keysym) &&
|
|
860 (e1->event.key.modifiers == e2->event.key.modifiers));
|
|
861
|
|
862 case button_press_event:
|
|
863 case button_release_event:
|
|
864 return (e1->event.button.button == e2->event.button.button &&
|
|
865 e1->event.button.modifiers == e2->event.button.modifiers);
|
|
866
|
|
867 case pointer_motion_event:
|
|
868 return (e1->event.motion.x == e2->event.motion.x &&
|
|
869 e1->event.motion.y == e2->event.motion.y);
|
|
870
|
|
871 case misc_user_event:
|
|
872 return (internal_equal (e1->event.eval.function,
|
|
873 e2->event.eval.function, 0) &&
|
|
874 internal_equal (e1->event.eval.object,
|
|
875 e2->event.eval.object, 0) &&
|
|
876 /* is this really needed for equality
|
|
877 or is x and y also important? */
|
|
878 e1->event.misc.button == e2->event.misc.button &&
|
|
879 e1->event.misc.modifiers == e2->event.misc.modifiers);
|
|
880
|
|
881 case eval_event:
|
|
882 return (internal_equal (e1->event.eval.function,
|
|
883 e2->event.eval.function, 0) &&
|
|
884 internal_equal (e1->event.eval.object,
|
|
885 e2->event.eval.object, 0));
|
|
886
|
|
887 case magic_eval_event:
|
|
888 return (e1->event.magic_eval.internal_function ==
|
|
889 e2->event.magic_eval.internal_function &&
|
|
890 internal_equal (e1->event.magic_eval.object,
|
|
891 e2->event.magic_eval.object, 0));
|
|
892
|
|
893 case magic_event:
|
788
|
894 return event_stream_compare_magic_event (e1, e2);
|
428
|
895
|
|
896 case empty_event: /* Empty and deallocated events are equal. */
|
|
897 case dead_event:
|
|
898 return 1;
|
|
899 }
|
|
900 }
|
|
901
|
665
|
902 static Hashcode
|
428
|
903 event_hash (Lisp_Object obj, int depth)
|
|
904 {
|
440
|
905 Lisp_Event *e = XEVENT (obj);
|
665
|
906 Hashcode hash;
|
428
|
907
|
|
908 hash = HASH2 (e->event_type, LISP_HASH (e->channel));
|
|
909 switch (e->event_type)
|
|
910 {
|
|
911 case process_event:
|
|
912 return HASH2 (hash, LISP_HASH (e->event.process.process));
|
|
913
|
|
914 case timeout_event:
|
|
915 return HASH3 (hash, internal_hash (e->event.timeout.function, depth + 1),
|
|
916 internal_hash (e->event.timeout.object, depth + 1));
|
|
917
|
|
918 case key_press_event:
|
|
919 return HASH3 (hash, LISP_HASH (e->event.key.keysym),
|
|
920 e->event.key.modifiers);
|
|
921
|
|
922 case button_press_event:
|
|
923 case button_release_event:
|
|
924 return HASH3 (hash, e->event.button.button, e->event.button.modifiers);
|
|
925
|
|
926 case pointer_motion_event:
|
|
927 return HASH3 (hash, e->event.motion.x, e->event.motion.y);
|
|
928
|
|
929 case misc_user_event:
|
|
930 return HASH5 (hash, internal_hash (e->event.misc.function, depth + 1),
|
|
931 internal_hash (e->event.misc.object, depth + 1),
|
|
932 e->event.misc.button, e->event.misc.modifiers);
|
|
933
|
|
934 case eval_event:
|
|
935 return HASH3 (hash, internal_hash (e->event.eval.function, depth + 1),
|
|
936 internal_hash (e->event.eval.object, depth + 1));
|
|
937
|
|
938 case magic_eval_event:
|
|
939 return HASH3 (hash,
|
665
|
940 (Hashcode) e->event.magic_eval.internal_function,
|
428
|
941 internal_hash (e->event.magic_eval.object, depth + 1));
|
|
942
|
|
943 case magic_event:
|
788
|
944 return HASH2 (hash, event_stream_hash_magic_event (e));
|
428
|
945
|
|
946 case empty_event:
|
|
947 case dead_event:
|
|
948 return hash;
|
|
949
|
|
950 default:
|
|
951 abort ();
|
|
952 }
|
|
953
|
|
954 return 0; /* unreached */
|
|
955 }
|
934
|
956 #endif /* not USE_KKCC */
|
|
957
|
|
958
|
|
959 #ifdef USE_KKCC
|
|
960 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
|
|
961 0, /*dumpable-flag*/
|
|
962 mark_event, print_event, 0, event_equal,
|
|
963 event_hash, 0/*event_description*/, Lisp_Event);
|
|
964 #else /* not USE_KKCC */
|
428
|
965 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
|
|
966 mark_event, print_event, 0, event_equal,
|
440
|
967 event_hash, 0, Lisp_Event);
|
934
|
968 #endif /* not USE_KKCC */
|
428
|
969
|
|
970 DEFUN ("make-event", Fmake_event, 0, 2, 0, /*
|
|
971 Return a new event of type TYPE, with properties described by PLIST.
|
|
972
|
|
973 TYPE is a symbol, either `empty', `key-press', `button-press',
|
|
974 `button-release', `misc-user' or `motion'. If TYPE is nil, it
|
|
975 defaults to `empty'.
|
|
976
|
|
977 PLIST is a property list, the properties being compatible to those
|
|
978 returned by `event-properties'. The following properties are
|
|
979 allowed:
|
|
980
|
|
981 channel -- The event channel, a frame or a console. For
|
|
982 button-press, button-release, misc-user and motion events,
|
|
983 this must be a frame. For key-press events, it must be
|
|
984 a console. If channel is unspecified, it will be set to
|
|
985 the selected frame or selected console, as appropriate.
|
|
986 key -- The event key, a symbol or character. Allowed only for
|
|
987 keypress events.
|
|
988 button -- The event button, integer 1, 2 or 3. Allowed for
|
|
989 button-press, button-release and misc-user events.
|
|
990 modifiers -- The event modifiers, a list of modifier symbols. Allowed
|
|
991 for key-press, button-press, button-release, motion and
|
|
992 misc-user events.
|
|
993 function -- Function. Allowed for misc-user events only.
|
|
994 object -- An object, function's parameter. Allowed for misc-user
|
|
995 events only.
|
|
996 x -- The event X coordinate, an integer. This is relative
|
|
997 to the left of CHANNEL's root window. Allowed for
|
|
998 motion, button-press, button-release and misc-user events.
|
|
999 y -- The event Y coordinate, an integer. This is relative
|
|
1000 to the top of CHANNEL's root window. Allowed for
|
|
1001 motion, button-press, button-release and misc-user events.
|
|
1002 timestamp -- The event timestamp, a non-negative integer. Allowed for
|
|
1003 all types of events. If unspecified, it will be set to 0
|
|
1004 by default.
|
|
1005
|
|
1006 For event type `empty', PLIST must be nil.
|
|
1007 `button-release', or `motion'. If TYPE is left out, it defaults to
|
|
1008 `empty'.
|
|
1009 PLIST is a list of properties, as returned by `event-properties'. Not
|
|
1010 all properties are allowed for all kinds of events, and some are
|
|
1011 required.
|
|
1012
|
|
1013 WARNING: the event object returned may be a reused one; see the function
|
|
1014 `deallocate-event'.
|
|
1015 */
|
|
1016 (type, plist))
|
|
1017 {
|
|
1018 Lisp_Object event = Qnil;
|
440
|
1019 Lisp_Event *e;
|
428
|
1020 EMACS_INT coord_x = 0, coord_y = 0;
|
|
1021 struct gcpro gcpro1;
|
|
1022
|
|
1023 GCPRO1 (event);
|
|
1024
|
|
1025 if (NILP (type))
|
|
1026 type = Qempty;
|
|
1027
|
|
1028 if (!NILP (Vevent_resource))
|
|
1029 {
|
|
1030 event = Vevent_resource;
|
|
1031 Vevent_resource = XEVENT_NEXT (event);
|
|
1032 }
|
|
1033 else
|
|
1034 {
|
|
1035 event = allocate_event ();
|
|
1036 }
|
|
1037 e = XEVENT (event);
|
|
1038 zero_event (e);
|
|
1039
|
|
1040 if (EQ (type, Qempty))
|
|
1041 {
|
|
1042 /* For empty event, we return immediately, without processing
|
|
1043 PLIST. In fact, processing PLIST would be wrong, because the
|
|
1044 sanitizing process would fill in the properties
|
|
1045 (e.g. CHANNEL), which we don't want in empty events. */
|
934
|
1046 #ifdef USE_KKCC
|
|
1047 set_event_type (e, empty_event);
|
|
1048 #else /* not USE_KKCC */
|
428
|
1049 e->event_type = empty_event;
|
934
|
1050 #endif /* not USE_KKCC */
|
428
|
1051 if (!NILP (plist))
|
563
|
1052 invalid_operation ("Cannot set properties of empty event", plist);
|
428
|
1053 UNGCPRO;
|
|
1054 return event;
|
|
1055 }
|
|
1056 else if (EQ (type, Qkey_press))
|
|
1057 {
|
934
|
1058 #ifdef USE_KKCC
|
|
1059 set_event_type (e, key_press_event);
|
|
1060 XSET_KEY_DATA_KEYSYM (EVENT_DATA (e), Qunbound);
|
|
1061 #else /* not USE_KKCC */
|
428
|
1062 e->event_type = key_press_event;
|
|
1063 e->event.key.keysym = Qunbound;
|
934
|
1064 #endif /* not USE_KKCC */
|
428
|
1065 }
|
|
1066 else if (EQ (type, Qbutton_press))
|
934
|
1067 #ifdef USE_KKCC
|
|
1068 set_event_type (e, button_press_event);
|
|
1069 #else /* not USE_KKCC */
|
428
|
1070 e->event_type = button_press_event;
|
934
|
1071 #endif /* not USE_KKCC */
|
428
|
1072 else if (EQ (type, Qbutton_release))
|
934
|
1073 #ifdef USE_KKCC
|
|
1074 set_event_type (e, button_release_event);
|
|
1075 #else /* not USE_KKCC */
|
428
|
1076 e->event_type = button_release_event;
|
934
|
1077 #endif /* not USE_KKCC */
|
428
|
1078 else if (EQ (type, Qmotion))
|
934
|
1079 #ifdef USE_KKCC
|
|
1080 set_event_type (e, pointer_motion_event);
|
|
1081 #else /* not USE_KKCC */
|
428
|
1082 e->event_type = pointer_motion_event;
|
934
|
1083 #endif /* not USE_KKCC */
|
428
|
1084 else if (EQ (type, Qmisc_user))
|
|
1085 {
|
934
|
1086 #ifdef USE_KKCC
|
|
1087 set_event_type (e, misc_user_event);
|
|
1088 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), Qnil);
|
|
1089 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), Qnil);
|
|
1090 #else /* not USE_KKCC */
|
428
|
1091 e->event_type = misc_user_event;
|
|
1092 e->event.eval.function = e->event.eval.object = Qnil;
|
934
|
1093 #endif /* not USE_KKCC */
|
428
|
1094 }
|
|
1095 else
|
|
1096 {
|
|
1097 /* Not allowed: Qprocess, Qtimeout, Qmagic, Qeval, Qmagic_eval. */
|
563
|
1098 invalid_constant ("Invalid event type", type);
|
428
|
1099 }
|
|
1100
|
|
1101 EVENT_CHANNEL (e) = Qnil;
|
|
1102
|
|
1103 plist = Fcopy_sequence (plist);
|
|
1104 Fcanonicalize_plist (plist, Qnil);
|
|
1105
|
442
|
1106 #define WRONG_EVENT_TYPE_FOR_PROPERTY(event_type, prop) \
|
563
|
1107 invalid_argument_2 ("Invalid property for event type", prop, event_type)
|
428
|
1108
|
442
|
1109 {
|
|
1110 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist)
|
|
1111 {
|
|
1112 if (EQ (keyword, Qchannel))
|
|
1113 {
|
934
|
1114 #ifdef USE_KKCC
|
|
1115 if (EVENT_TYPE(e) == key_press_event)
|
|
1116 #else /* not USE_KKCC */
|
442
|
1117 if (e->event_type == key_press_event)
|
934
|
1118 #endif /* not USE_KKCC */
|
442
|
1119 {
|
|
1120 if (!CONSOLEP (value))
|
|
1121 value = wrong_type_argument (Qconsolep, value);
|
|
1122 }
|
|
1123 else
|
|
1124 {
|
|
1125 if (!FRAMEP (value))
|
|
1126 value = wrong_type_argument (Qframep, value);
|
|
1127 }
|
|
1128 EVENT_CHANNEL (e) = value;
|
|
1129 }
|
|
1130 else if (EQ (keyword, Qkey))
|
|
1131 {
|
934
|
1132 #ifdef USE_KKCC
|
|
1133 switch (EVENT_TYPE(e))
|
|
1134 #else /* not USE_KKCC */
|
442
|
1135 switch (e->event_type)
|
934
|
1136 #endif /* not USE_KKCC */
|
442
|
1137 {
|
|
1138 case key_press_event:
|
|
1139 if (!SYMBOLP (value) && !CHARP (value))
|
563
|
1140 invalid_argument ("Invalid event key", value);
|
934
|
1141 #ifdef USE_KKCC
|
|
1142 XSET_KEY_DATA_KEYSYM (EVENT_DATA(e), value);
|
|
1143 #else /* not USE_KKCC */
|
442
|
1144 e->event.key.keysym = value;
|
934
|
1145 #endif /* not USE_KKCC */
|
442
|
1146 break;
|
|
1147 default:
|
|
1148 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
|
|
1149 break;
|
|
1150 }
|
|
1151 }
|
|
1152 else if (EQ (keyword, Qbutton))
|
|
1153 {
|
|
1154 CHECK_NATNUM (value);
|
|
1155 check_int_range (XINT (value), 0, 7);
|
428
|
1156
|
934
|
1157 #ifdef USE_KKCC
|
|
1158 switch (EVENT_TYPE(e))
|
|
1159 #else /* not USE_KKCC */
|
442
|
1160 switch (e->event_type)
|
934
|
1161 #endif /* not USE_KKCC */
|
442
|
1162 {
|
|
1163 case button_press_event:
|
|
1164 case button_release_event:
|
934
|
1165 #ifdef USE_KKCC
|
|
1166 XSET_BUTTON_DATA_BUTTON (EVENT_DATA (e), XINT (value));
|
|
1167 #else /* not USE_KKCC */
|
442
|
1168 e->event.button.button = XINT (value);
|
934
|
1169 #endif /* not USE_KKCC */
|
442
|
1170 break;
|
|
1171 case misc_user_event:
|
934
|
1172 #ifdef USE_KKCC
|
|
1173 XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (e), XINT (value));
|
|
1174 #else /* not USE_KKCC */
|
442
|
1175 e->event.misc.button = XINT (value);
|
934
|
1176 #endif /* not USE_KKCC */
|
442
|
1177 break;
|
|
1178 default:
|
|
1179 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
|
|
1180 break;
|
|
1181 }
|
|
1182 }
|
|
1183 else if (EQ (keyword, Qmodifiers))
|
|
1184 {
|
|
1185 int modifiers = 0;
|
428
|
1186
|
442
|
1187 EXTERNAL_LIST_LOOP_2 (sym, value)
|
|
1188 {
|
|
1189 if (EQ (sym, Qcontrol)) modifiers |= XEMACS_MOD_CONTROL;
|
|
1190 else if (EQ (sym, Qmeta)) modifiers |= XEMACS_MOD_META;
|
|
1191 else if (EQ (sym, Qsuper)) modifiers |= XEMACS_MOD_SUPER;
|
|
1192 else if (EQ (sym, Qhyper)) modifiers |= XEMACS_MOD_HYPER;
|
|
1193 else if (EQ (sym, Qalt)) modifiers |= XEMACS_MOD_ALT;
|
|
1194 else if (EQ (sym, Qsymbol)) modifiers |= XEMACS_MOD_ALT;
|
|
1195 else if (EQ (sym, Qshift)) modifiers |= XEMACS_MOD_SHIFT;
|
|
1196 else if (EQ (sym, Qbutton1)) modifiers |= XEMACS_MOD_BUTTON1;
|
|
1197 else if (EQ (sym, Qbutton2)) modifiers |= XEMACS_MOD_BUTTON2;
|
|
1198 else if (EQ (sym, Qbutton3)) modifiers |= XEMACS_MOD_BUTTON3;
|
|
1199 else if (EQ (sym, Qbutton4)) modifiers |= XEMACS_MOD_BUTTON4;
|
|
1200 else if (EQ (sym, Qbutton5)) modifiers |= XEMACS_MOD_BUTTON5;
|
|
1201 else
|
563
|
1202 invalid_constant ("Invalid key modifier", sym);
|
442
|
1203 }
|
428
|
1204
|
934
|
1205 #ifdef USE_KKCC
|
|
1206 switch (EVENT_TYPE(e))
|
|
1207 #else /* not USE_KKCC */
|
442
|
1208 switch (e->event_type)
|
934
|
1209 #endif /* not USE_KKCC */
|
442
|
1210 {
|
|
1211 case key_press_event:
|
934
|
1212 #ifdef USE_KKCC
|
|
1213 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
|
|
1214 #else /* not USE_KKCC */
|
442
|
1215 e->event.key.modifiers = modifiers;
|
934
|
1216 #endif /* not USE_KKCC */
|
442
|
1217 break;
|
|
1218 case button_press_event:
|
|
1219 case button_release_event:
|
934
|
1220 #ifdef USE_KKCC
|
|
1221 XSET_BUTTON_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
|
|
1222 #else /* not USE_KKCC */
|
442
|
1223 e->event.button.modifiers = modifiers;
|
934
|
1224 #endif /* not USE_KKCC */
|
442
|
1225 break;
|
|
1226 case pointer_motion_event:
|
934
|
1227 #ifdef USE_KKCC
|
|
1228 XSET_MOTION_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
|
|
1229 #else /* not USE_KKCC */
|
442
|
1230 e->event.motion.modifiers = modifiers;
|
934
|
1231 #endif /* not USE_KKCC */
|
442
|
1232 break;
|
|
1233 case misc_user_event:
|
934
|
1234 #ifdef USE_KKCC
|
|
1235 XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (e), modifiers);
|
|
1236 #else /* not USE_KKCC */
|
442
|
1237 e->event.misc.modifiers = modifiers;
|
934
|
1238 #endif /* not USE_KKCC */
|
442
|
1239 break;
|
|
1240 default:
|
|
1241 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
|
|
1242 break;
|
|
1243 }
|
|
1244 }
|
|
1245 else if (EQ (keyword, Qx))
|
|
1246 {
|
934
|
1247 #ifdef USE_KKCC
|
|
1248 switch (EVENT_TYPE(e))
|
|
1249 #else /* not USE_KKCC */
|
442
|
1250 switch (e->event_type)
|
934
|
1251 #endif /* not USE_KKCC */
|
442
|
1252 {
|
|
1253 case pointer_motion_event:
|
|
1254 case button_press_event:
|
|
1255 case button_release_event:
|
|
1256 case misc_user_event:
|
|
1257 /* Allow negative values, so we can specify toolbar
|
|
1258 positions. */
|
|
1259 CHECK_INT (value);
|
|
1260 coord_x = XINT (value);
|
|
1261 break;
|
|
1262 default:
|
|
1263 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
|
|
1264 break;
|
|
1265 }
|
|
1266 }
|
|
1267 else if (EQ (keyword, Qy))
|
|
1268 {
|
934
|
1269 #ifdef USE_KKCC
|
|
1270 switch (EVENT_TYPE(e))
|
|
1271 #else /* not USE_KKCC */
|
442
|
1272 switch (e->event_type)
|
934
|
1273 #endif /* not USE_KKCC */
|
442
|
1274 {
|
|
1275 case pointer_motion_event:
|
|
1276 case button_press_event:
|
|
1277 case button_release_event:
|
|
1278 case misc_user_event:
|
|
1279 /* Allow negative values; see above. */
|
|
1280 CHECK_INT (value);
|
|
1281 coord_y = XINT (value);
|
|
1282 break;
|
|
1283 default:
|
|
1284 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
|
|
1285 break;
|
|
1286 }
|
|
1287 }
|
|
1288 else if (EQ (keyword, Qtimestamp))
|
|
1289 {
|
|
1290 CHECK_NATNUM (value);
|
934
|
1291 #ifdef USE_KKCC
|
|
1292 SET_EVENT_TIMESTAMP (e, XINT (value));
|
|
1293 #else /* not USE_KKCC */
|
442
|
1294 e->timestamp = XINT (value);
|
934
|
1295 #endif /* not USE_KKCC */
|
442
|
1296 }
|
|
1297 else if (EQ (keyword, Qfunction))
|
|
1298 {
|
934
|
1299 #ifdef USE_KKCC
|
|
1300 switch (EVENT_TYPE(e))
|
|
1301 #else /* not USE_KKCC */
|
442
|
1302 switch (e->event_type)
|
934
|
1303 #endif /* not USE_KKCC */
|
442
|
1304 {
|
|
1305 case misc_user_event:
|
934
|
1306 #ifdef USE_KKCC
|
|
1307 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), value);
|
|
1308 #else /* not USE_KKCC */
|
442
|
1309 e->event.eval.function = value;
|
934
|
1310 #endif /* not USE_KKCC */
|
442
|
1311 break;
|
|
1312 default:
|
|
1313 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
|
|
1314 break;
|
|
1315 }
|
|
1316 }
|
|
1317 else if (EQ (keyword, Qobject))
|
|
1318 {
|
934
|
1319 #ifdef USE_KKCC
|
|
1320 switch (EVENT_TYPE(e))
|
|
1321 #else /* not USE_KKCC */
|
442
|
1322 switch (e->event_type)
|
934
|
1323 #endif /* not USE_KKCC */
|
442
|
1324 {
|
|
1325 case misc_user_event:
|
934
|
1326 #ifdef USE_KKCC
|
|
1327 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), value);
|
|
1328 #else /* not USE_KKCC */
|
442
|
1329 e->event.eval.object = value;
|
934
|
1330 #endif /* not USE_KKCC */
|
442
|
1331 break;
|
|
1332 default:
|
|
1333 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword);
|
|
1334 break;
|
|
1335 }
|
|
1336 }
|
|
1337 else
|
563
|
1338 invalid_constant_2 ("Invalid property", keyword, value);
|
442
|
1339 }
|
|
1340 }
|
428
|
1341
|
|
1342 /* Insert the channel, if missing. */
|
|
1343 if (NILP (EVENT_CHANNEL (e)))
|
|
1344 {
|
934
|
1345 #ifdef USE_KKCC
|
|
1346 if (EVENT_TYPE (e) == key_press_event)
|
|
1347 #else /* not USE_KKCC */
|
428
|
1348 if (e->event_type == key_press_event)
|
934
|
1349 #endif /* not USE_KKCC */
|
428
|
1350 EVENT_CHANNEL (e) = Vselected_console;
|
|
1351 else
|
|
1352 EVENT_CHANNEL (e) = Fselected_frame (Qnil);
|
|
1353 }
|
|
1354
|
|
1355 /* Fevent_properties, Fevent_x_pixel, etc. work with pixels relative
|
|
1356 to the frame, so we must adjust accordingly. */
|
|
1357 if (FRAMEP (EVENT_CHANNEL (e)))
|
|
1358 {
|
|
1359 coord_x += FRAME_REAL_LEFT_TOOLBAR_WIDTH (XFRAME (EVENT_CHANNEL (e)));
|
|
1360 coord_y += FRAME_REAL_TOP_TOOLBAR_HEIGHT (XFRAME (EVENT_CHANNEL (e)));
|
|
1361
|
|
1362 switch (e->event_type)
|
|
1363 {
|
|
1364 case pointer_motion_event:
|
934
|
1365 #ifdef USE_KKCC
|
|
1366 XSET_MOTION_DATA_X (EVENT_DATA (e), coord_x);
|
|
1367 XSET_MOTION_DATA_Y (EVENT_DATA (e), coord_y);
|
|
1368 #else /* not USE_KKCC */
|
428
|
1369 e->event.motion.x = coord_x;
|
|
1370 e->event.motion.y = coord_y;
|
934
|
1371 #endif /* not USE_KKCC */
|
428
|
1372 break;
|
|
1373 case button_press_event:
|
|
1374 case button_release_event:
|
934
|
1375 #ifdef USE_KKCC
|
|
1376 XSET_BUTTON_DATA_X (EVENT_DATA (e), coord_x);
|
|
1377 XSET_BUTTON_DATA_Y (EVENT_DATA (e), coord_y);
|
|
1378 #else /* not USE_KKCC */
|
428
|
1379 e->event.button.x = coord_x;
|
|
1380 e->event.button.y = coord_y;
|
934
|
1381 #endif /* not USE_KKCC */
|
428
|
1382 break;
|
|
1383 case misc_user_event:
|
934
|
1384 #ifdef USE_KKCC
|
|
1385 XSET_MISC_USER_DATA_X (EVENT_DATA (e), coord_x);
|
|
1386 XSET_MISC_USER_DATA_Y (EVENT_DATA (e), coord_y);
|
|
1387 #else /* not USE_KKCC */
|
428
|
1388 e->event.misc.x = coord_x;
|
|
1389 e->event.misc.y = coord_y;
|
934
|
1390 #endif /* not USE_KKCC */
|
428
|
1391 break;
|
|
1392 default:
|
|
1393 abort();
|
|
1394 }
|
|
1395 }
|
|
1396
|
|
1397 /* Finally, do some more validation. */
|
934
|
1398 #ifdef USE_KKCC
|
|
1399 switch (EVENT_TYPE(e))
|
|
1400 #else /* not USE_KKCC */
|
428
|
1401 switch (e->event_type)
|
934
|
1402 #endif /* not USE_KKCC */
|
428
|
1403 {
|
|
1404 case key_press_event:
|
934
|
1405 #ifdef USE_KKCC
|
|
1406 if (UNBOUNDP (XKEY_DATA_KEYSYM (EVENT_DATA (e))))
|
|
1407 #else /* not USE_KKCC */
|
428
|
1408 if (UNBOUNDP (e->event.key.keysym))
|
934
|
1409 #endif /* not USE_KKCC */
|
563
|
1410 sferror ("A key must be specified to make a keypress event",
|
442
|
1411 plist);
|
428
|
1412 break;
|
|
1413 case button_press_event:
|
934
|
1414 #ifdef USE_KKCC
|
|
1415 if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e)))
|
|
1416 #else /* not USE_KKCC */
|
428
|
1417 if (!e->event.button.button)
|
934
|
1418 #endif /* not USE_KKCC */
|
563
|
1419 sferror
|
442
|
1420 ("A button must be specified to make a button-press event",
|
|
1421 plist);
|
428
|
1422 break;
|
|
1423 case button_release_event:
|
934
|
1424 #ifdef USE_KKCC
|
|
1425 if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e)))
|
|
1426 #else /* not USE_KKCC */
|
428
|
1427 if (!e->event.button.button)
|
934
|
1428 #endif /* not USE_KKCC */
|
563
|
1429 sferror
|
442
|
1430 ("A button must be specified to make a button-release event",
|
|
1431 plist);
|
428
|
1432 break;
|
|
1433 case misc_user_event:
|
934
|
1434 #ifdef USE_KKCC
|
|
1435 if (NILP (XMISC_USER_DATA_FUNCTION (EVENT_DATA (e))))
|
|
1436 #else /* not USE_KKCC */
|
428
|
1437 if (NILP (e->event.misc.function))
|
934
|
1438 #endif /* not USE_KKCC */
|
563
|
1439 sferror ("A function must be specified to make a misc-user event",
|
442
|
1440 plist);
|
428
|
1441 break;
|
|
1442 default:
|
|
1443 break;
|
|
1444 }
|
|
1445
|
|
1446 UNGCPRO;
|
|
1447 return event;
|
|
1448 }
|
|
1449
|
934
|
1450
|
|
1451 #ifdef USE_KKCC
|
|
1452
|
|
1453 Lisp_Object
|
|
1454 make_key_data (void)
|
|
1455 {
|
|
1456 Lisp_Object data = allocate_key_data ();
|
|
1457
|
|
1458 XSET_KEY_DATA_KEYSYM (data, Qnil);
|
|
1459 XSET_KEY_DATA_MODIFIERS (data, 0);
|
|
1460
|
|
1461 return data;
|
|
1462 }
|
|
1463
|
|
1464 Lisp_Object
|
|
1465 make_button_data (void)
|
|
1466 {
|
|
1467 Lisp_Object data = allocate_button_data ();
|
|
1468
|
|
1469 XSET_BUTTON_DATA_BUTTON (data, 0);
|
|
1470 XSET_BUTTON_DATA_MODIFIERS (data, 0);
|
|
1471 XSET_BUTTON_DATA_X (data, 0);
|
|
1472 XSET_BUTTON_DATA_Y (data, 0);
|
|
1473
|
|
1474 return data;
|
|
1475 }
|
|
1476
|
|
1477 Lisp_Object
|
|
1478 make_motion_data (void)
|
|
1479 {
|
|
1480 Lisp_Object data = allocate_motion_data ();
|
|
1481
|
|
1482 XSET_MOTION_DATA_X (data, 0);
|
|
1483 XSET_MOTION_DATA_Y (data, 0);
|
|
1484 XSET_MOTION_DATA_MODIFIERS (data, 0);
|
|
1485
|
|
1486 return data;
|
|
1487 }
|
|
1488
|
|
1489 Lisp_Object
|
|
1490 make_process_data (void)
|
|
1491 {
|
|
1492 Lisp_Object data = allocate_process_data ();
|
|
1493
|
|
1494 XSET_PROCESS_DATA_PROCESS (data, Qnil);
|
|
1495
|
|
1496 return data;
|
|
1497 }
|
|
1498
|
|
1499 Lisp_Object
|
|
1500 make_timeout_data (void)
|
|
1501 {
|
|
1502 Lisp_Object data = allocate_timeout_data ();
|
|
1503
|
|
1504 XSET_TIMEOUT_DATA_INTERVAL_ID (data, 0);
|
|
1505 XSET_TIMEOUT_DATA_ID_NUMBER(data, 0);
|
|
1506 XSET_TIMEOUT_DATA_FUNCTION(data, Qnil);
|
|
1507 XSET_TIMEOUT_DATA_OBJECT (data, Qnil);
|
|
1508
|
|
1509 return data;
|
|
1510 }
|
|
1511
|
|
1512 Lisp_Object
|
|
1513 make_magic_eval_data (void)
|
|
1514 {
|
|
1515 Lisp_Object data = allocate_magic_eval_data ();
|
|
1516
|
|
1517 XSET_MAGIC_EVAL_DATA_OBJECT (data, Qnil);
|
|
1518 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNOBJ (data, 0);
|
|
1519
|
|
1520 return data;
|
|
1521 }
|
|
1522
|
|
1523 Lisp_Object
|
|
1524 make_eval_data (void)
|
|
1525 {
|
|
1526 Lisp_Object data = allocate_eval_data ();
|
|
1527
|
|
1528 XSET_EVAL_DATA_FUNCTION (data, Qnil);
|
|
1529 XSET_EVAL_DATA_OBJECT (data, Qnil);
|
|
1530
|
|
1531 return data;
|
|
1532 }
|
|
1533
|
|
1534 Lisp_Object
|
|
1535 make_magic_data (void)
|
|
1536 {
|
|
1537 return allocate_magic_data ();
|
|
1538 }
|
|
1539
|
|
1540 Lisp_Object
|
|
1541 make_misc_user_data (void)
|
|
1542 {
|
|
1543 Lisp_Object data = allocate_misc_user_data ();
|
|
1544
|
|
1545 XSET_MISC_USER_DATA_FUNCTION (data, Qnil);
|
|
1546 XSET_MISC_USER_DATA_OBJECT (data, Qnil);
|
943
|
1547 XSET_MISC_USER_DATA_BUTTON (data, 0);
|
934
|
1548 XSET_MISC_USER_DATA_MODIFIERS (data, 0);
|
|
1549 XSET_MISC_USER_DATA_X (data, 0);
|
|
1550 XSET_MISC_USER_DATA_Y (data, 0);
|
|
1551
|
|
1552 return data;
|
|
1553 }
|
|
1554 #endif /* USE_KKCC */
|
|
1555
|
|
1556
|
|
1557
|
428
|
1558 DEFUN ("deallocate-event", Fdeallocate_event, 1, 1, 0, /*
|
|
1559 Allow the given event structure to be reused.
|
|
1560 You MUST NOT use this event object after calling this function with it.
|
|
1561 You will lose. It is not necessary to call this function, as event
|
|
1562 objects are garbage-collected like all other objects; however, it may
|
|
1563 be more efficient to explicitly deallocate events when you are sure
|
|
1564 that it is safe to do so.
|
|
1565 */
|
|
1566 (event))
|
|
1567 {
|
|
1568 CHECK_EVENT (event);
|
|
1569
|
|
1570 if (XEVENT_TYPE (event) == dead_event)
|
563
|
1571 invalid_argument ("this event is already deallocated!", Qunbound);
|
428
|
1572
|
|
1573 assert (XEVENT_TYPE (event) <= last_event_type);
|
|
1574
|
|
1575 #if 0
|
|
1576 {
|
|
1577 int i, len;
|
|
1578
|
|
1579 if (EQ (event, Vlast_command_event) ||
|
|
1580 EQ (event, Vlast_input_event) ||
|
|
1581 EQ (event, Vunread_command_event))
|
|
1582 abort ();
|
|
1583
|
|
1584 len = XVECTOR_LENGTH (Vthis_command_keys);
|
|
1585 for (i = 0; i < len; i++)
|
|
1586 if (EQ (event, XVECTOR_DATA (Vthis_command_keys) [i]))
|
|
1587 abort ();
|
|
1588 if (!NILP (Vrecent_keys_ring))
|
|
1589 {
|
|
1590 int recent_ring_len = XVECTOR_LENGTH (Vrecent_keys_ring);
|
|
1591 for (i = 0; i < recent_ring_len; i++)
|
|
1592 if (EQ (event, XVECTOR_DATA (Vrecent_keys_ring) [i]))
|
|
1593 abort ();
|
|
1594 }
|
|
1595 }
|
|
1596 #endif /* 0 */
|
|
1597
|
|
1598 assert (!EQ (event, Vevent_resource));
|
|
1599 deinitialize_event (event);
|
|
1600 #ifndef ALLOC_NO_POOLS
|
|
1601 XSET_EVENT_NEXT (event, Vevent_resource);
|
|
1602 Vevent_resource = event;
|
|
1603 #endif
|
|
1604 return Qnil;
|
|
1605 }
|
|
1606
|
934
|
1607 #ifdef USE_KKCC
|
|
1608 void
|
|
1609 copy_event_data (Lisp_Object dest, Lisp_Object src)
|
|
1610 {
|
|
1611 switch (XRECORD_LHEADER (dest)->type) {
|
|
1612 case lrecord_type_key_data:
|
|
1613 XSET_KEY_DATA_KEYSYM (dest, XKEY_DATA_KEYSYM (src));
|
|
1614 XSET_KEY_DATA_MODIFIERS (dest, XKEY_DATA_MODIFIERS (src));
|
|
1615 break;
|
|
1616 case lrecord_type_button_data:
|
|
1617 XSET_BUTTON_DATA_BUTTON (dest, XBUTTON_DATA_BUTTON (src));
|
|
1618 XSET_BUTTON_DATA_MODIFIERS (dest, XBUTTON_DATA_MODIFIERS (src));
|
|
1619 XSET_BUTTON_DATA_X (dest, XBUTTON_DATA_X (src));
|
|
1620 XSET_BUTTON_DATA_Y (dest, XBUTTON_DATA_Y (src));
|
|
1621 break;
|
|
1622 case lrecord_type_motion_data:
|
|
1623 XSET_MOTION_DATA_X (dest, XMOTION_DATA_X (src));
|
|
1624 XSET_MOTION_DATA_Y (dest, XMOTION_DATA_Y (src));
|
|
1625 XSET_MOTION_DATA_MODIFIERS (dest, XMOTION_DATA_MODIFIERS (src));
|
|
1626 break;
|
|
1627 case lrecord_type_process_data:
|
|
1628 XSET_PROCESS_DATA_PROCESS (dest, XPROCESS_DATA_PROCESS (src));
|
|
1629 break;
|
|
1630 case lrecord_type_timeout_data:
|
|
1631 XSET_TIMEOUT_DATA_INTERVAL_ID (dest, XTIMEOUT_DATA_INTERVAL_ID (src));
|
|
1632 XSET_TIMEOUT_DATA_ID_NUMBER (dest, XTIMEOUT_DATA_ID_NUMBER (src));
|
|
1633 XSET_TIMEOUT_DATA_FUNCTION (dest, XTIMEOUT_DATA_FUNCTION (src));
|
|
1634 XSET_TIMEOUT_DATA_OBJECT (dest, XTIMEOUT_DATA_OBJECT (src));
|
|
1635 break;
|
|
1636 case lrecord_type_eval_data:
|
|
1637 XSET_EVAL_DATA_FUNCTION (dest, XEVAL_DATA_FUNCTION (src));
|
|
1638 XSET_EVAL_DATA_OBJECT (dest, XEVAL_DATA_OBJECT (src));
|
|
1639 break;
|
|
1640 case lrecord_type_misc_user_data:
|
|
1641 XSET_MISC_USER_DATA_FUNCTION (dest, XMISC_USER_DATA_FUNCTION (src));
|
|
1642 XSET_MISC_USER_DATA_OBJECT (dest, XMISC_USER_DATA_OBJECT (src));
|
|
1643 XSET_MISC_USER_DATA_BUTTON (dest, XMISC_USER_DATA_BUTTON (src));
|
|
1644 XSET_MISC_USER_DATA_MODIFIERS (dest, XMISC_USER_DATA_MODIFIERS (src));
|
|
1645 XSET_MISC_USER_DATA_X (dest, XMISC_USER_DATA_X (src));
|
|
1646 XSET_MISC_USER_DATA_Y (dest, XMISC_USER_DATA_Y (src));
|
|
1647 break;
|
|
1648 case lrecord_type_magic_eval_data:
|
|
1649 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION (dest, XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (src));
|
|
1650 XSET_MAGIC_EVAL_DATA_OBJECT (dest, XMAGIC_EVAL_DATA_OBJECT (src));
|
|
1651 break;
|
|
1652 case lrecord_type_magic_data:
|
|
1653 XSET_MAGIC_DATA_UNDERLYING (dest, XMAGIC_DATA_UNDERLYING (src));
|
|
1654 break;
|
|
1655 default:
|
|
1656 break;
|
|
1657 }
|
|
1658 }
|
|
1659 #endif /* USE_KKCC */
|
|
1660
|
428
|
1661 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /*
|
444
|
1662 Make a copy of the event object EVENT1.
|
|
1663 If a second event argument EVENT2 is given, EVENT1 is copied into
|
|
1664 EVENT2 and EVENT2 is returned. If EVENT2 is not supplied (or is nil)
|
|
1665 then a new event will be made as with `make-event'. See also the
|
|
1666 function `deallocate-event'.
|
428
|
1667 */
|
|
1668 (event1, event2))
|
|
1669 {
|
|
1670 CHECK_LIVE_EVENT (event1);
|
|
1671 if (NILP (event2))
|
|
1672 event2 = Fmake_event (Qnil, Qnil);
|
430
|
1673 else
|
|
1674 {
|
|
1675 CHECK_LIVE_EVENT (event2);
|
|
1676 if (EQ (event1, event2))
|
563
|
1677 return signal_continuable_error_2
|
|
1678 (Qinvalid_argument,
|
|
1679 "copy-event called with `eq' events", event1, event2);
|
430
|
1680 }
|
428
|
1681
|
|
1682 assert (XEVENT_TYPE (event1) <= last_event_type);
|
|
1683 assert (XEVENT_TYPE (event2) <= last_event_type);
|
|
1684
|
934
|
1685 #ifdef USE_KKCC
|
|
1686 XSET_EVENT_TYPE (event2, XEVENT_TYPE (event1));
|
|
1687 XSET_EVENT_CHANNEL (event2, XEVENT_CHANNEL (event1));
|
|
1688 XSET_EVENT_TIMESTAMP (event2, XEVENT_TIMESTAMP (event1));
|
|
1689 copy_event_data (XEVENT_DATA (event2), XEVENT_DATA (event1));
|
|
1690
|
|
1691 return event2;
|
|
1692 #else /* not USE_KKCC */
|
428
|
1693 {
|
430
|
1694 Lisp_Event *ev2 = XEVENT (event2);
|
|
1695 Lisp_Event *ev1 = XEVENT (event1);
|
428
|
1696
|
430
|
1697 ev2->event_type = ev1->event_type;
|
|
1698 ev2->channel = ev1->channel;
|
|
1699 ev2->timestamp = ev1->timestamp;
|
|
1700 ev2->event = ev1->event;
|
|
1701
|
428
|
1702 return event2;
|
|
1703 }
|
934
|
1704 #endif /* not USE_KKCC */
|
428
|
1705 }
|
|
1706
|
|
1707
|
771
|
1708 /************************************************************************/
|
|
1709 /* event chain functions */
|
|
1710 /************************************************************************/
|
428
|
1711
|
|
1712 /* Given a chain of events (or possibly nil), deallocate them all. */
|
|
1713
|
|
1714 void
|
|
1715 deallocate_event_chain (Lisp_Object event_chain)
|
|
1716 {
|
|
1717 while (!NILP (event_chain))
|
|
1718 {
|
|
1719 Lisp_Object next = XEVENT_NEXT (event_chain);
|
|
1720 Fdeallocate_event (event_chain);
|
|
1721 event_chain = next;
|
|
1722 }
|
|
1723 }
|
|
1724
|
|
1725 /* Return the last event in a chain.
|
|
1726 NOTE: You cannot pass nil as a value here! The routine will
|
|
1727 abort if you do. */
|
|
1728
|
|
1729 Lisp_Object
|
|
1730 event_chain_tail (Lisp_Object event_chain)
|
|
1731 {
|
|
1732 while (1)
|
|
1733 {
|
|
1734 Lisp_Object next = XEVENT_NEXT (event_chain);
|
|
1735 if (NILP (next))
|
|
1736 return event_chain;
|
|
1737 event_chain = next;
|
|
1738 }
|
|
1739 }
|
|
1740
|
|
1741 /* Enqueue a single event onto the end of a chain of events.
|
|
1742 HEAD points to the first event in the chain, TAIL to the last event.
|
|
1743 If the chain is empty, both values should be nil. */
|
|
1744
|
|
1745 void
|
|
1746 enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail)
|
|
1747 {
|
|
1748 assert (NILP (XEVENT_NEXT (event)));
|
|
1749 assert (!EQ (*tail, event));
|
|
1750
|
|
1751 if (!NILP (*tail))
|
|
1752 XSET_EVENT_NEXT (*tail, event);
|
|
1753 else
|
|
1754 *head = event;
|
|
1755 *tail = event;
|
|
1756
|
|
1757 assert (!EQ (event, XEVENT_NEXT (event)));
|
|
1758 }
|
|
1759
|
|
1760 /* Remove an event off the head of a chain of events and return it.
|
|
1761 HEAD points to the first event in the chain, TAIL to the last event. */
|
|
1762
|
|
1763 Lisp_Object
|
|
1764 dequeue_event (Lisp_Object *head, Lisp_Object *tail)
|
|
1765 {
|
|
1766 Lisp_Object event;
|
|
1767
|
|
1768 event = *head;
|
|
1769 *head = XEVENT_NEXT (event);
|
|
1770 XSET_EVENT_NEXT (event, Qnil);
|
|
1771 if (NILP (*head))
|
|
1772 *tail = Qnil;
|
|
1773 return event;
|
|
1774 }
|
|
1775
|
|
1776 /* Enqueue a chain of events (or possibly nil) onto the end of another
|
|
1777 chain of events. HEAD points to the first event in the chain being
|
|
1778 queued onto, TAIL to the last event. If the chain is empty, both values
|
|
1779 should be nil. */
|
|
1780
|
|
1781 void
|
|
1782 enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
|
|
1783 Lisp_Object *tail)
|
|
1784 {
|
|
1785 if (NILP (event_chain))
|
|
1786 return;
|
|
1787
|
|
1788 if (NILP (*head))
|
|
1789 {
|
|
1790 *head = event_chain;
|
|
1791 *tail = event_chain;
|
|
1792 }
|
|
1793 else
|
|
1794 {
|
|
1795 XSET_EVENT_NEXT (*tail, event_chain);
|
|
1796 *tail = event_chain_tail (event_chain);
|
|
1797 }
|
|
1798 }
|
|
1799
|
|
1800 /* Return the number of events (possibly 0) on an event chain. */
|
|
1801
|
|
1802 int
|
|
1803 event_chain_count (Lisp_Object event_chain)
|
|
1804 {
|
|
1805 Lisp_Object event;
|
|
1806 int n = 0;
|
|
1807
|
|
1808 EVENT_CHAIN_LOOP (event, event_chain)
|
|
1809 n++;
|
|
1810
|
|
1811 return n;
|
|
1812 }
|
|
1813
|
|
1814 /* Find the event before EVENT in an event chain. This aborts
|
|
1815 if the event is not in the chain. */
|
|
1816
|
|
1817 Lisp_Object
|
|
1818 event_chain_find_previous (Lisp_Object event_chain, Lisp_Object event)
|
|
1819 {
|
|
1820 Lisp_Object previous = Qnil;
|
|
1821
|
|
1822 while (!NILP (event_chain))
|
|
1823 {
|
|
1824 if (EQ (event_chain, event))
|
|
1825 return previous;
|
|
1826 previous = event_chain;
|
|
1827 event_chain = XEVENT_NEXT (event_chain);
|
|
1828 }
|
|
1829
|
|
1830 abort ();
|
|
1831 return Qnil;
|
|
1832 }
|
|
1833
|
|
1834 Lisp_Object
|
|
1835 event_chain_nth (Lisp_Object event_chain, int n)
|
|
1836 {
|
|
1837 Lisp_Object event;
|
|
1838 EVENT_CHAIN_LOOP (event, event_chain)
|
|
1839 {
|
|
1840 if (!n)
|
|
1841 return event;
|
|
1842 n--;
|
|
1843 }
|
|
1844 return Qnil;
|
|
1845 }
|
|
1846
|
771
|
1847 /* Return a freshly allocated copy of all events in the given chain. */
|
|
1848
|
428
|
1849 Lisp_Object
|
|
1850 copy_event_chain (Lisp_Object event_chain)
|
|
1851 {
|
|
1852 Lisp_Object new_chain = Qnil;
|
|
1853 Lisp_Object new_chain_tail = Qnil;
|
|
1854 Lisp_Object event;
|
|
1855
|
|
1856 EVENT_CHAIN_LOOP (event, event_chain)
|
|
1857 {
|
|
1858 Lisp_Object copy = Fcopy_event (event, Qnil);
|
|
1859 enqueue_event (copy, &new_chain, &new_chain_tail);
|
|
1860 }
|
|
1861
|
|
1862 return new_chain;
|
|
1863 }
|
|
1864
|
771
|
1865 /* Given a pointer (maybe nil) into an old chain (also maybe nil, if
|
|
1866 pointer is nil) and a new chain which is a copy of the old, return
|
|
1867 the corresponding new pointer. */
|
|
1868 Lisp_Object
|
|
1869 transfer_event_chain_pointer (Lisp_Object pointer, Lisp_Object old_chain,
|
|
1870 Lisp_Object new_chain)
|
|
1871 {
|
|
1872 if (NILP (pointer))
|
|
1873 return Qnil;
|
|
1874 assert (!NILP (old_chain));
|
800
|
1875 #ifdef ERROR_CHECK_STRUCTURES
|
771
|
1876 /* make sure we're actually in the chain */
|
|
1877 event_chain_find_previous (old_chain, pointer);
|
|
1878 assert (event_chain_count (old_chain) == event_chain_count (new_chain));
|
800
|
1879 #endif /* ERROR_CHECK_STRUCTURES */
|
771
|
1880 return event_chain_nth (new_chain,
|
|
1881 event_chain_count (old_chain) -
|
|
1882 event_chain_count (pointer));
|
|
1883 }
|
|
1884
|
428
|
1885
|
771
|
1886 /************************************************************************/
|
|
1887 /* higher level functions */
|
|
1888 /************************************************************************/
|
428
|
1889
|
|
1890 Lisp_Object QKbackspace, QKtab, QKlinefeed, QKreturn, QKescape,
|
|
1891 QKspace, QKdelete;
|
|
1892
|
|
1893 int
|
|
1894 command_event_p (Lisp_Object event)
|
|
1895 {
|
|
1896 switch (XEVENT_TYPE (event))
|
|
1897 {
|
|
1898 case key_press_event:
|
|
1899 case button_press_event:
|
|
1900 case button_release_event:
|
|
1901 case misc_user_event:
|
|
1902 return 1;
|
|
1903 default:
|
|
1904 return 0;
|
|
1905 }
|
|
1906 }
|
|
1907
|
|
1908
|
|
1909 void
|
867
|
1910 character_to_event (Ichar c, Lisp_Event *event, struct console *con,
|
428
|
1911 int use_console_meta_flag, int do_backspace_mapping)
|
|
1912 {
|
|
1913 Lisp_Object k = Qnil;
|
442
|
1914 int m = 0;
|
934
|
1915 #ifdef USE_KKCC
|
|
1916 if (EVENT_TYPE (event) == dead_event)
|
|
1917 #else /* not USE_KKCC */
|
428
|
1918 if (event->event_type == dead_event)
|
934
|
1919 #endif /* not USE_KKCC */
|
563
|
1920 invalid_argument ("character-to-event called with a deallocated event!", Qunbound);
|
428
|
1921
|
|
1922 #ifndef MULE
|
|
1923 c &= 255;
|
|
1924 #endif
|
|
1925 if (c > 127 && c <= 255)
|
|
1926 {
|
|
1927 int meta_flag = 1;
|
|
1928 if (use_console_meta_flag && CONSOLE_TTY_P (con))
|
|
1929 meta_flag = TTY_FLAGS (con).meta_key;
|
|
1930 switch (meta_flag)
|
|
1931 {
|
|
1932 case 0: /* ignore top bit; it's parity */
|
|
1933 c -= 128;
|
|
1934 break;
|
|
1935 case 1: /* top bit is meta */
|
|
1936 c -= 128;
|
442
|
1937 m = XEMACS_MOD_META;
|
428
|
1938 break;
|
|
1939 default: /* this is a real character */
|
|
1940 break;
|
|
1941 }
|
|
1942 }
|
442
|
1943 if (c < ' ') c += '@', m |= XEMACS_MOD_CONTROL;
|
|
1944 if (m & XEMACS_MOD_CONTROL)
|
428
|
1945 {
|
|
1946 switch (c)
|
|
1947 {
|
442
|
1948 case 'I': k = QKtab; m &= ~XEMACS_MOD_CONTROL; break;
|
|
1949 case 'J': k = QKlinefeed; m &= ~XEMACS_MOD_CONTROL; break;
|
|
1950 case 'M': k = QKreturn; m &= ~XEMACS_MOD_CONTROL; break;
|
|
1951 case '[': k = QKescape; m &= ~XEMACS_MOD_CONTROL; break;
|
428
|
1952 default:
|
|
1953 #if defined(HAVE_TTY)
|
|
1954 if (do_backspace_mapping &&
|
|
1955 CHARP (con->tty_erase_char) &&
|
|
1956 c - '@' == XCHAR (con->tty_erase_char))
|
|
1957 {
|
|
1958 k = QKbackspace;
|
442
|
1959 m &= ~XEMACS_MOD_CONTROL;
|
428
|
1960 }
|
442
|
1961 #endif /* defined(HAVE_TTY) && !defined(CYGWIN) */
|
428
|
1962 break;
|
|
1963 }
|
|
1964 if (c >= 'A' && c <= 'Z') c -= 'A'-'a';
|
|
1965 }
|
|
1966 #if defined(HAVE_TTY)
|
|
1967 else if (do_backspace_mapping &&
|
|
1968 CHARP (con->tty_erase_char) && c == XCHAR (con->tty_erase_char))
|
|
1969 k = QKbackspace;
|
442
|
1970 #endif /* defined(HAVE_TTY) && !defined(CYGWIN) */
|
428
|
1971 else if (c == 127)
|
|
1972 k = QKdelete;
|
|
1973 else if (c == ' ')
|
|
1974 k = QKspace;
|
|
1975
|
934
|
1976 #ifdef USE_KKCC
|
|
1977 set_event_type (event, key_press_event);
|
|
1978 SET_EVENT_TIMESTAMP_ZERO (event); /* #### */
|
|
1979 SET_EVENT_CHANNEL (event, wrap_console (con));
|
|
1980 XSET_KEY_DATA_KEYSYM (EVENT_DATA (event), (!NILP (k) ? k : make_char (c)));
|
|
1981 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (event), m);
|
|
1982 #else /* not USE_KKCC */
|
428
|
1983 event->event_type = key_press_event;
|
|
1984 event->timestamp = 0; /* #### */
|
771
|
1985 event->channel = wrap_console (con);
|
428
|
1986 event->event.key.keysym = (!NILP (k) ? k : make_char (c));
|
|
1987 event->event.key.modifiers = m;
|
934
|
1988 #endif /* not USE_KKCC */
|
428
|
1989 }
|
|
1990
|
|
1991 /* This variable controls what character name -> character code mapping
|
|
1992 we are using. Window-system-specific code sets this to some symbol,
|
|
1993 and we use that symbol as the plist key to convert keysyms into 8-bit
|
|
1994 codes. In this way one can have several character sets predefined and
|
|
1995 switch them by changing this.
|
440
|
1996
|
|
1997 #### This is utterly bogus and should be removed.
|
428
|
1998 */
|
|
1999 Lisp_Object Vcharacter_set_property;
|
|
2000
|
867
|
2001 Ichar
|
440
|
2002 event_to_character (Lisp_Event *event,
|
428
|
2003 int allow_extra_modifiers,
|
|
2004 int allow_meta,
|
|
2005 int allow_non_ascii)
|
|
2006 {
|
867
|
2007 Ichar c = 0;
|
428
|
2008 Lisp_Object code;
|
|
2009
|
934
|
2010 #ifdef USE_KKCC
|
|
2011 if (EVENT_TYPE (event) != key_press_event)
|
|
2012 #else /* not USE_KKCC */
|
428
|
2013 if (event->event_type != key_press_event)
|
934
|
2014 #endif /* not USE_KKCC */
|
428
|
2015 {
|
934
|
2016 #ifdef USE_KKCC
|
|
2017 assert (EVENT_TYPE (event) != dead_event);
|
|
2018 #else /* not USE_KKCC */
|
438
|
2019 assert (event->event_type != dead_event);
|
934
|
2020 #endif /* not USE_KKCC */
|
428
|
2021 return -1;
|
|
2022 }
|
|
2023 if (!allow_extra_modifiers &&
|
934
|
2024 #ifdef USE_KKCC
|
|
2025 XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT))
|
|
2026 #else /* not USE_KKCC */
|
442
|
2027 event->event.key.modifiers & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT))
|
934
|
2028 #endif /* not USE_KKCC */
|
428
|
2029 return -1;
|
934
|
2030 #ifdef USE_KKCC
|
|
2031 if (CHAR_OR_CHAR_INTP (XKEY_DATA_KEYSYM (EVENT_DATA (event))))
|
|
2032 c = XCHAR_OR_CHAR_INT (XKEY_DATA_KEYSYM (EVENT_DATA (event)));
|
|
2033 else if (!SYMBOLP (XKEY_DATA_KEYSYM (EVENT_DATA (event))))
|
|
2034 #else /* not USE_KKCC */
|
428
|
2035 if (CHAR_OR_CHAR_INTP (event->event.key.keysym))
|
|
2036 c = XCHAR_OR_CHAR_INT (event->event.key.keysym);
|
|
2037 else if (!SYMBOLP (event->event.key.keysym))
|
934
|
2038 #endif /* not USE_KKCC */
|
428
|
2039 abort ();
|
|
2040 else if (allow_non_ascii && !NILP (Vcharacter_set_property)
|
|
2041 /* Allow window-system-specific extensibility of
|
|
2042 keysym->code mapping */
|
934
|
2043 #ifdef USE_KKCC
|
|
2044 && CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)),
|
|
2045 Vcharacter_set_property,
|
|
2046 Qnil)))
|
|
2047 #else /* not USE_KKCC */
|
428
|
2048 && CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym,
|
|
2049 Vcharacter_set_property,
|
|
2050 Qnil)))
|
934
|
2051 #endif /* not USE_KKCC */
|
428
|
2052 c = XCHAR_OR_CHAR_INT (code);
|
934
|
2053 #ifdef USE_KKCC
|
|
2054 else if (CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)),
|
|
2055 Qascii_character, Qnil)))
|
|
2056 #else /* not USE_KKCC */
|
428
|
2057 else if (CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym,
|
|
2058 Qascii_character, Qnil)))
|
934
|
2059 #endif /* not USE_KKCC */
|
428
|
2060 c = XCHAR_OR_CHAR_INT (code);
|
|
2061 else
|
|
2062 return -1;
|
|
2063
|
934
|
2064 #ifdef USE_KKCC
|
|
2065 if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_CONTROL)
|
|
2066 #else /* not USE_KKCC */
|
442
|
2067 if (event->event.key.modifiers & XEMACS_MOD_CONTROL)
|
934
|
2068 #endif /* not USE_KKCC */
|
428
|
2069 {
|
|
2070 if (c >= 'a' && c <= 'z')
|
|
2071 c -= ('a' - 'A');
|
|
2072 else
|
|
2073 /* reject Control-Shift- keys */
|
|
2074 if (c >= 'A' && c <= 'Z' && !allow_extra_modifiers)
|
|
2075 return -1;
|
|
2076
|
|
2077 if (c >= '@' && c <= '_')
|
|
2078 c -= '@';
|
|
2079 else if (c == ' ') /* C-space and C-@ are the same. */
|
|
2080 c = 0;
|
|
2081 else
|
|
2082 /* reject keys that can't take Control- modifiers */
|
|
2083 if (! allow_extra_modifiers) return -1;
|
|
2084 }
|
|
2085
|
934
|
2086 #ifdef USE_KKCC
|
|
2087 if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_META)
|
|
2088 #else /* not USE_KKCC */
|
442
|
2089 if (event->event.key.modifiers & XEMACS_MOD_META)
|
934
|
2090 #endif /* not USE_KKCC */
|
428
|
2091 {
|
|
2092 if (! allow_meta) return -1;
|
|
2093 if (c & 0200) return -1; /* don't allow M-oslash (overlap) */
|
|
2094 #ifdef MULE
|
|
2095 if (c >= 256) return -1;
|
|
2096 #endif
|
|
2097 c |= 0200;
|
|
2098 }
|
|
2099 return c;
|
|
2100 }
|
|
2101
|
|
2102 DEFUN ("event-to-character", Fevent_to_character, 1, 4, 0, /*
|
|
2103 Return the closest ASCII approximation to the given event object.
|
|
2104 If the event isn't a keypress, this returns nil.
|
|
2105 If the ALLOW-EXTRA-MODIFIERS argument is non-nil, then this is lenient in
|
|
2106 its translation; it will ignore modifier keys other than control and meta,
|
|
2107 and will ignore the shift modifier on those characters which have no
|
|
2108 shifted ASCII equivalent (Control-Shift-A for example, will be mapped to
|
|
2109 the same ASCII code as Control-A).
|
|
2110 If the ALLOW-META argument is non-nil, then the Meta modifier will be
|
|
2111 represented by turning on the high bit of the byte returned; otherwise, nil
|
|
2112 will be returned for events containing the Meta modifier.
|
|
2113 If the ALLOW-NON-ASCII argument is non-nil, then characters which are
|
|
2114 present in the prevailing character set (see the `character-set-property'
|
|
2115 variable) will be returned as their code in that character set, instead of
|
|
2116 the return value being restricted to ASCII.
|
|
2117 Note that specifying both ALLOW-META and ALLOW-NON-ASCII is ambiguous, as
|
|
2118 both use the high bit; `M-x' and `oslash' will be indistinguishable.
|
|
2119 */
|
|
2120 (event, allow_extra_modifiers, allow_meta, allow_non_ascii))
|
|
2121 {
|
867
|
2122 Ichar c;
|
428
|
2123 CHECK_LIVE_EVENT (event);
|
|
2124 c = event_to_character (XEVENT (event),
|
|
2125 !NILP (allow_extra_modifiers),
|
|
2126 !NILP (allow_meta),
|
|
2127 !NILP (allow_non_ascii));
|
|
2128 return c < 0 ? Qnil : make_char (c);
|
|
2129 }
|
|
2130
|
|
2131 DEFUN ("character-to-event", Fcharacter_to_event, 1, 4, 0, /*
|
444
|
2132 Convert KEY-DESCRIPTION into an event structure, replete with bucky bits.
|
428
|
2133
|
444
|
2134 KEY-DESCRIPTION is the first argument, and the event to fill in is the
|
|
2135 second. This function contains knowledge about what various kinds of
|
|
2136 arguments ``mean'' -- for example, the number 9 is converted to the
|
|
2137 character ``Tab'', not the distinct character ``Control-I''.
|
428
|
2138
|
444
|
2139 KEY-DESCRIPTION can be an integer, a character, a symbol such as 'clear,
|
|
2140 or a list such as '(control backspace).
|
|
2141
|
|
2142 If the optional second argument EVENT is an event, it is modified and
|
|
2143 returned; otherwise, a new event object is created and returned.
|
428
|
2144
|
|
2145 Optional third arg CONSOLE is the console to store in the event, and
|
|
2146 defaults to the selected console.
|
|
2147
|
444
|
2148 If KEY-DESCRIPTION is an integer or character, the high bit may be
|
|
2149 interpreted as the meta key. (This is done for backward compatibility
|
|
2150 in lots of places.) If USE-CONSOLE-META-FLAG is nil, this will always
|
|
2151 be the case. If USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for
|
|
2152 CONSOLE affects whether the high bit is interpreted as a meta
|
|
2153 key. (See `set-input-mode'.) If you don't want this silly meta
|
|
2154 interpretation done, you should pass in a list containing the
|
|
2155 character.
|
428
|
2156
|
|
2157 Beware that character-to-event and event-to-character are not strictly
|
|
2158 inverse functions, since events contain much more information than the
|
444
|
2159 Lisp character object type can encode.
|
428
|
2160 */
|
444
|
2161 (keystroke, event, console, use_console_meta_flag))
|
428
|
2162 {
|
|
2163 struct console *con = decode_console (console);
|
|
2164 if (NILP (event))
|
|
2165 event = Fmake_event (Qnil, Qnil);
|
|
2166 else
|
|
2167 CHECK_LIVE_EVENT (event);
|
444
|
2168 if (CONSP (keystroke) || SYMBOLP (keystroke))
|
|
2169 key_desc_list_to_event (keystroke, event, 1);
|
428
|
2170 else
|
|
2171 {
|
444
|
2172 CHECK_CHAR_COERCE_INT (keystroke);
|
|
2173 character_to_event (XCHAR (keystroke), XEVENT (event), con,
|
428
|
2174 !NILP (use_console_meta_flag), 1);
|
|
2175 }
|
|
2176 return event;
|
|
2177 }
|
|
2178
|
|
2179 void
|
|
2180 nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event)
|
|
2181 {
|
|
2182 assert (STRINGP (seq) || VECTORP (seq));
|
|
2183 assert (n < XINT (Flength (seq)));
|
|
2184
|
|
2185 if (STRINGP (seq))
|
|
2186 {
|
867
|
2187 Ichar ch = string_ichar (seq, n);
|
428
|
2188 Fcharacter_to_event (make_char (ch), event, Qnil, Qnil);
|
|
2189 }
|
|
2190 else
|
|
2191 {
|
|
2192 Lisp_Object keystroke = XVECTOR_DATA (seq)[n];
|
|
2193 if (EVENTP (keystroke))
|
|
2194 Fcopy_event (keystroke, event);
|
|
2195 else
|
|
2196 Fcharacter_to_event (keystroke, event, Qnil, Qnil);
|
|
2197 }
|
|
2198 }
|
|
2199
|
|
2200 Lisp_Object
|
|
2201 key_sequence_to_event_chain (Lisp_Object seq)
|
|
2202 {
|
|
2203 int len = XINT (Flength (seq));
|
|
2204 int i;
|
|
2205 Lisp_Object head = Qnil, tail = Qnil;
|
|
2206
|
|
2207 for (i = 0; i < len; i++)
|
|
2208 {
|
|
2209 Lisp_Object event = Fmake_event (Qnil, Qnil);
|
|
2210 nth_of_key_sequence_as_event (seq, i, event);
|
|
2211 enqueue_event (event, &head, &tail);
|
|
2212 }
|
|
2213
|
|
2214 return head;
|
|
2215 }
|
|
2216
|
934
|
2217
|
793
|
2218 /* Concatenate a string description of EVENT onto the end of BUF. If
|
|
2219 BRIEF, use short forms for keys, e.g. C- instead of control-. */
|
|
2220
|
934
|
2221 #ifdef USE_KKCC
|
|
2222 void
|
|
2223 format_event_object (Eistring *buf, Lisp_Object event, int brief)
|
|
2224 #else /* not USE_KKCC */
|
428
|
2225 void
|
793
|
2226 format_event_object (Eistring *buf, Lisp_Event *event, int brief)
|
934
|
2227 #endif /* not USE_KKCC */
|
428
|
2228 {
|
|
2229 int mouse_p = 0;
|
|
2230 int mod = 0;
|
|
2231 Lisp_Object key;
|
|
2232
|
934
|
2233 #ifdef USE_KKCC
|
|
2234 switch (EVENT_TYPE (XEVENT(event)))
|
|
2235 #else /* not USE_KKCC */
|
428
|
2236 switch (event->event_type)
|
934
|
2237 #endif /* not USE_KKCC */
|
428
|
2238 {
|
|
2239 case key_press_event:
|
|
2240 {
|
934
|
2241 #ifdef USE_KKCC
|
|
2242 mod = XKEY_DATA_MODIFIERS (XEVENT_DATA(event));
|
|
2243 key = XKEY_DATA_KEYSYM (XEVENT_DATA(event));
|
|
2244 #else /* not USE_KKCC */
|
428
|
2245 mod = event->event.key.modifiers;
|
|
2246 key = event->event.key.keysym;
|
934
|
2247 #endif /* not USE_KKCC */
|
428
|
2248 /* Hack. */
|
|
2249 if (! brief && CHARP (key) &&
|
793
|
2250 mod & (XEMACS_MOD_CONTROL | XEMACS_MOD_META | XEMACS_MOD_SUPER |
|
|
2251 XEMACS_MOD_HYPER))
|
428
|
2252 {
|
|
2253 int k = XCHAR (key);
|
|
2254 if (k >= 'a' && k <= 'z')
|
|
2255 key = make_char (k - ('a' - 'A'));
|
|
2256 else if (k >= 'A' && k <= 'Z')
|
442
|
2257 mod |= XEMACS_MOD_SHIFT;
|
428
|
2258 }
|
|
2259 break;
|
|
2260 }
|
|
2261 case button_release_event:
|
|
2262 mouse_p++;
|
|
2263 /* Fall through */
|
|
2264 case button_press_event:
|
|
2265 {
|
|
2266 mouse_p++;
|
934
|
2267 #ifdef USE_KKCC
|
|
2268 mod = XBUTTON_DATA_MODIFIERS (XEVENT_DATA(event));
|
|
2269 key = make_char (XBUTTON_DATA_BUTTON (XEVENT_DATA(event)) + '0');
|
|
2270 #else /* not USE_KKCC */
|
428
|
2271 mod = event->event.button.modifiers;
|
|
2272 key = make_char (event->event.button.button + '0');
|
934
|
2273 #endif /* not USE_KKCC */
|
428
|
2274 break;
|
|
2275 }
|
|
2276 case magic_event:
|
|
2277 {
|
788
|
2278 Lisp_Object stream;
|
|
2279 struct gcpro gcpro1;
|
|
2280 GCPRO1 (stream);
|
428
|
2281
|
788
|
2282 stream = make_resizing_buffer_output_stream ();
|
934
|
2283 #ifdef USE_KKCC
|
|
2284 event_stream_format_magic_event (XEVENT(event), stream);
|
|
2285 #else /* not USE_KKCC */
|
788
|
2286 event_stream_format_magic_event (event, stream);
|
934
|
2287 #endif /* not USE_KKCC */
|
788
|
2288 Lstream_flush (XLSTREAM (stream));
|
793
|
2289 eicat_raw (buf, resizing_buffer_stream_ptr (XLSTREAM (stream)),
|
|
2290 Lstream_byte_count (XLSTREAM (stream)));
|
788
|
2291 Lstream_delete (XLSTREAM (stream));
|
|
2292 UNGCPRO;
|
428
|
2293 return;
|
|
2294 }
|
793
|
2295 case magic_eval_event: eicat_c (buf, "magic-eval"); return;
|
|
2296 case pointer_motion_event: eicat_c (buf, "motion"); return;
|
|
2297 case misc_user_event: eicat_c (buf, "misc-user"); return;
|
|
2298 case eval_event: eicat_c (buf, "eval"); return;
|
|
2299 case process_event: eicat_c (buf, "process"); return;
|
|
2300 case timeout_event: eicat_c (buf, "timeout"); return;
|
|
2301 case empty_event: eicat_c (buf, "empty"); return;
|
|
2302 case dead_event: eicat_c (buf, "DEAD-EVENT"); return;
|
428
|
2303 default:
|
|
2304 abort ();
|
442
|
2305 return;
|
428
|
2306 }
|
793
|
2307 #define modprint(x,y) \
|
|
2308 do { if (brief) eicat_c (buf, (y)); else eicat_c (buf, (x)); } while (0)
|
442
|
2309 if (mod & XEMACS_MOD_CONTROL) modprint ("control-", "C-");
|
|
2310 if (mod & XEMACS_MOD_META) modprint ("meta-", "M-");
|
|
2311 if (mod & XEMACS_MOD_SUPER) modprint ("super-", "S-");
|
|
2312 if (mod & XEMACS_MOD_HYPER) modprint ("hyper-", "H-");
|
|
2313 if (mod & XEMACS_MOD_ALT) modprint ("alt-", "A-");
|
|
2314 if (mod & XEMACS_MOD_SHIFT) modprint ("shift-", "Sh-");
|
428
|
2315 if (mouse_p)
|
|
2316 {
|
793
|
2317 eicat_c (buf, "button");
|
428
|
2318 --mouse_p;
|
|
2319 }
|
|
2320
|
|
2321 #undef modprint
|
|
2322
|
|
2323 if (CHARP (key))
|
793
|
2324 eicat_ch (buf, XCHAR (key));
|
428
|
2325 else if (SYMBOLP (key))
|
|
2326 {
|
793
|
2327 const Char_ASCII *str = 0;
|
428
|
2328 if (brief)
|
|
2329 {
|
|
2330 if (EQ (key, QKlinefeed)) str = "LFD";
|
|
2331 else if (EQ (key, QKtab)) str = "TAB";
|
|
2332 else if (EQ (key, QKreturn)) str = "RET";
|
|
2333 else if (EQ (key, QKescape)) str = "ESC";
|
|
2334 else if (EQ (key, QKdelete)) str = "DEL";
|
|
2335 else if (EQ (key, QKspace)) str = "SPC";
|
|
2336 else if (EQ (key, QKbackspace)) str = "BS";
|
|
2337 }
|
|
2338 if (str)
|
793
|
2339 eicat_c (buf, str);
|
428
|
2340 else
|
793
|
2341 eicat_lstr (buf, XSYMBOL (key)->name);
|
428
|
2342 }
|
|
2343 else
|
|
2344 abort ();
|
|
2345 if (mouse_p)
|
793
|
2346 eicat_c (buf, "up");
|
428
|
2347 }
|
|
2348
|
934
|
2349
|
428
|
2350 DEFUN ("eventp", Feventp, 1, 1, 0, /*
|
|
2351 True if OBJECT is an event object.
|
|
2352 */
|
|
2353 (object))
|
|
2354 {
|
|
2355 return EVENTP (object) ? Qt : Qnil;
|
|
2356 }
|
|
2357
|
|
2358 DEFUN ("event-live-p", Fevent_live_p, 1, 1, 0, /*
|
|
2359 True if OBJECT is an event object that has not been deallocated.
|
|
2360 */
|
|
2361 (object))
|
|
2362 {
|
934
|
2363 #ifdef USE_KKCC
|
|
2364 return EVENTP (object) && XEVENT_TYPE (object) != dead_event ?
|
|
2365 Qt : Qnil;
|
|
2366 #else /* not USE_KKCC */
|
428
|
2367 return EVENTP (object) && XEVENT (object)->event_type != dead_event ?
|
|
2368 Qt : Qnil;
|
934
|
2369 #endif /* not USE_KKCC */
|
428
|
2370 }
|
|
2371
|
|
2372 #if 0 /* debugging functions */
|
|
2373
|
826
|
2374 DEFUN ("event-next", Fevent_next, 1, 1, 0, /*
|
428
|
2375 Return the event object's `next' event, or nil if it has none.
|
|
2376 The `next-event' field is changed by calling `set-next-event'.
|
|
2377 */
|
|
2378 (event))
|
|
2379 {
|
440
|
2380 Lisp_Event *e;
|
428
|
2381 CHECK_LIVE_EVENT (event);
|
|
2382
|
|
2383 return XEVENT_NEXT (event);
|
|
2384 }
|
|
2385
|
826
|
2386 DEFUN ("set-event-next", Fset_event_next, 2, 2, 0, /*
|
428
|
2387 Set the `next event' of EVENT to NEXT-EVENT.
|
|
2388 NEXT-EVENT must be an event object or nil.
|
|
2389 */
|
|
2390 (event, next_event))
|
|
2391 {
|
|
2392 Lisp_Object ev;
|
|
2393
|
|
2394 CHECK_LIVE_EVENT (event);
|
|
2395 if (NILP (next_event))
|
|
2396 {
|
|
2397 XSET_EVENT_NEXT (event, Qnil);
|
|
2398 return Qnil;
|
|
2399 }
|
|
2400
|
|
2401 CHECK_LIVE_EVENT (next_event);
|
|
2402
|
|
2403 EVENT_CHAIN_LOOP (ev, XEVENT_NEXT (event))
|
|
2404 {
|
|
2405 QUIT;
|
|
2406 if (EQ (ev, event))
|
563
|
2407 invalid_operation_2 ("Cyclic event-next", event, next_event);
|
428
|
2408 }
|
|
2409 XSET_EVENT_NEXT (event, next_event);
|
|
2410 return next_event;
|
|
2411 }
|
|
2412
|
|
2413 #endif /* 0 */
|
|
2414
|
|
2415 DEFUN ("event-type", Fevent_type, 1, 1, 0, /*
|
|
2416 Return the type of EVENT.
|
|
2417 This will be a symbol; one of
|
|
2418
|
|
2419 key-press A key was pressed.
|
|
2420 button-press A mouse button was pressed.
|
|
2421 button-release A mouse button was released.
|
|
2422 misc-user Some other user action happened; typically, this is
|
|
2423 a menu selection or scrollbar action.
|
|
2424 motion The mouse moved.
|
|
2425 process Input is available from a subprocess.
|
|
2426 timeout A timeout has expired.
|
|
2427 eval This causes a specified action to occur when dispatched.
|
|
2428 magic Some window-system-specific event has occurred.
|
|
2429 empty The event has been allocated but not assigned.
|
|
2430
|
|
2431 */
|
|
2432 (event))
|
|
2433 {
|
|
2434 CHECK_LIVE_EVENT (event);
|
934
|
2435 #ifdef USE_KKCC
|
|
2436 switch (XEVENT_TYPE (event))
|
|
2437 #else /* not USE_KKCC */
|
428
|
2438 switch (XEVENT (event)->event_type)
|
934
|
2439 #endif /* not USE_KKCC */
|
428
|
2440 {
|
|
2441 case key_press_event: return Qkey_press;
|
|
2442 case button_press_event: return Qbutton_press;
|
|
2443 case button_release_event: return Qbutton_release;
|
|
2444 case misc_user_event: return Qmisc_user;
|
|
2445 case pointer_motion_event: return Qmotion;
|
|
2446 case process_event: return Qprocess;
|
|
2447 case timeout_event: return Qtimeout;
|
|
2448 case eval_event: return Qeval;
|
|
2449 case magic_event:
|
|
2450 case magic_eval_event:
|
|
2451 return Qmagic;
|
|
2452
|
|
2453 case empty_event:
|
|
2454 return Qempty;
|
|
2455
|
|
2456 default:
|
|
2457 abort ();
|
|
2458 return Qnil;
|
|
2459 }
|
|
2460 }
|
|
2461
|
|
2462 DEFUN ("event-timestamp", Fevent_timestamp, 1, 1, 0, /*
|
|
2463 Return the timestamp of the event object EVENT.
|
442
|
2464 Timestamps are measured in milliseconds since the start of the window system.
|
|
2465 They are NOT related to any current time measurement.
|
|
2466 They should be compared with `event-timestamp<'.
|
|
2467 See also `current-event-timestamp'.
|
428
|
2468 */
|
|
2469 (event))
|
|
2470 {
|
|
2471 CHECK_LIVE_EVENT (event);
|
|
2472 /* This junk is so that timestamps don't get to be negative, but contain
|
|
2473 as many bits as this particular emacs will allow.
|
|
2474 */
|
934
|
2475 #ifdef USE_KKCC
|
|
2476 return make_int (((1L << (VALBITS - 1)) - 1) &
|
|
2477 XEVENT_TIMESTAMP (event));
|
|
2478 #else /* not USE_KKCC */
|
428
|
2479 return make_int (((1L << (VALBITS - 1)) - 1) &
|
|
2480 XEVENT (event)->timestamp);
|
934
|
2481 #endif /* not USE_KKCC */
|
428
|
2482 }
|
|
2483
|
442
|
2484 #define TIMESTAMP_HALFSPACE (1L << (VALBITS - 2))
|
|
2485
|
|
2486 DEFUN ("event-timestamp<", Fevent_timestamp_lessp, 2, 2, 0, /*
|
|
2487 Return true if timestamp TIME1 is earlier than timestamp TIME2.
|
|
2488 This correctly handles timestamp wrap.
|
|
2489 See also `event-timestamp' and `current-event-timestamp'.
|
|
2490 */
|
|
2491 (time1, time2))
|
|
2492 {
|
|
2493 EMACS_INT t1, t2;
|
|
2494
|
|
2495 CHECK_NATNUM (time1);
|
|
2496 CHECK_NATNUM (time2);
|
|
2497 t1 = XINT (time1);
|
|
2498 t2 = XINT (time2);
|
|
2499
|
|
2500 if (t1 < t2)
|
|
2501 return t2 - t1 < TIMESTAMP_HALFSPACE ? Qt : Qnil;
|
|
2502 else
|
|
2503 return t1 - t2 < TIMESTAMP_HALFSPACE ? Qnil : Qt;
|
|
2504 }
|
|
2505
|
934
|
2506 #ifdef USE_KKCC
|
|
2507 #define CHECK_EVENT_TYPE(e,t1,sym) do { \
|
|
2508 CHECK_LIVE_EVENT (e); \
|
|
2509 if (XEVENT_TYPE (e) != (t1)) \
|
|
2510 e = wrong_type_argument (sym,e); \
|
|
2511 } while (0)
|
|
2512 #else /* not USE_KKCC */
|
428
|
2513 #define CHECK_EVENT_TYPE(e,t1,sym) do { \
|
|
2514 CHECK_LIVE_EVENT (e); \
|
|
2515 if (XEVENT(e)->event_type != (t1)) \
|
|
2516 e = wrong_type_argument (sym,e); \
|
|
2517 } while (0)
|
934
|
2518 #endif /* not USE_KKCC */
|
|
2519
|
|
2520 #ifdef USE_KKCC
|
|
2521 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \
|
|
2522 CHECK_LIVE_EVENT (e); \
|
|
2523 { \
|
|
2524 emacs_event_type CET_type = XEVENT_TYPE (e); \
|
|
2525 if (CET_type != (t1) && \
|
|
2526 CET_type != (t2)) \
|
|
2527 e = wrong_type_argument (sym,e); \
|
|
2528 } \
|
|
2529 } while (0)
|
|
2530 #else /* not USE_KKCC */
|
428
|
2531 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \
|
|
2532 CHECK_LIVE_EVENT (e); \
|
|
2533 { \
|
|
2534 emacs_event_type CET_type = XEVENT (e)->event_type; \
|
|
2535 if (CET_type != (t1) && \
|
|
2536 CET_type != (t2)) \
|
|
2537 e = wrong_type_argument (sym,e); \
|
|
2538 } \
|
|
2539 } while (0)
|
934
|
2540 #endif /* not USE_KKCC */
|
|
2541
|
|
2542 #ifdef USE_KKCC
|
|
2543 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \
|
|
2544 CHECK_LIVE_EVENT (e); \
|
|
2545 { \
|
|
2546 emacs_event_type CET_type = XEVENT_TYPE (e); \
|
|
2547 if (CET_type != (t1) && \
|
|
2548 CET_type != (t2) && \
|
|
2549 CET_type != (t3)) \
|
|
2550 e = wrong_type_argument (sym,e); \
|
|
2551 } \
|
|
2552 } while (0)
|
|
2553 #else /* not USE_KKCC */
|
428
|
2554 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \
|
|
2555 CHECK_LIVE_EVENT (e); \
|
|
2556 { \
|
|
2557 emacs_event_type CET_type = XEVENT (e)->event_type; \
|
|
2558 if (CET_type != (t1) && \
|
|
2559 CET_type != (t2) && \
|
|
2560 CET_type != (t3)) \
|
|
2561 e = wrong_type_argument (sym,e); \
|
|
2562 } \
|
|
2563 } while (0)
|
934
|
2564 #endif /* not USE_KKCC */
|
428
|
2565
|
|
2566 DEFUN ("event-key", Fevent_key, 1, 1, 0, /*
|
|
2567 Return the Keysym of the key-press event EVENT.
|
|
2568 This will be a character if the event is associated with one, else a symbol.
|
|
2569 */
|
|
2570 (event))
|
|
2571 {
|
|
2572 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p);
|
934
|
2573 #ifdef USE_KKCC
|
|
2574 return XKEY_DATA_KEYSYM (XEVENT_DATA (event));
|
|
2575 #else /* not USE_KKCC */
|
428
|
2576 return XEVENT (event)->event.key.keysym;
|
934
|
2577 #endif /* not USE_KKCC */
|
428
|
2578 }
|
|
2579
|
|
2580 DEFUN ("event-button", Fevent_button, 1, 1, 0, /*
|
444
|
2581 Return the button-number of the button-press or button-release event EVENT.
|
428
|
2582 */
|
|
2583 (event))
|
|
2584 {
|
|
2585
|
|
2586 CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event,
|
|
2587 misc_user_event, Qbutton_event_p);
|
|
2588 #ifdef HAVE_WINDOW_SYSTEM
|
934
|
2589 #ifdef USE_KKCC
|
|
2590 if ( XEVENT_TYPE (event) == misc_user_event)
|
|
2591 return make_int (XMISC_USER_DATA_BUTTON (XEVENT_DATA (event)));
|
|
2592 else
|
|
2593 return make_int (XBUTTON_DATA_BUTTON (XEVENT_DATA (event)));
|
|
2594 #else /* not USE_KKCC */
|
428
|
2595 if ( XEVENT (event)->event_type == misc_user_event)
|
|
2596 return make_int (XEVENT (event)->event.misc.button);
|
|
2597 else
|
|
2598 return make_int (XEVENT (event)->event.button.button);
|
934
|
2599 #endif /* not USE_KKCC */
|
428
|
2600 #else /* !HAVE_WINDOW_SYSTEM */
|
|
2601 return Qzero;
|
|
2602 #endif /* !HAVE_WINDOW_SYSTEM */
|
|
2603
|
|
2604 }
|
|
2605
|
|
2606 DEFUN ("event-modifier-bits", Fevent_modifier_bits, 1, 1, 0, /*
|
442
|
2607 Return a number representing the modifier keys and buttons which were down
|
428
|
2608 when the given mouse or keyboard event was produced.
|
442
|
2609 See also the function `event-modifiers'.
|
428
|
2610 */
|
|
2611 (event))
|
|
2612 {
|
|
2613 again:
|
|
2614 CHECK_LIVE_EVENT (event);
|
934
|
2615 #ifdef USE_KKCC
|
|
2616 switch (XEVENT_TYPE (event))
|
|
2617 {
|
|
2618 case key_press_event:
|
|
2619 return make_int (XKEY_DATA_MODIFIERS (XEVENT_DATA (event)));
|
|
2620 case button_press_event:
|
|
2621 case button_release_event:
|
|
2622 return make_int (XBUTTON_DATA_MODIFIERS (XEVENT_DATA (event)));
|
|
2623 case pointer_motion_event:
|
|
2624 return make_int (XMOTION_DATA_MODIFIERS (XEVENT_DATA (event)));
|
|
2625 case misc_user_event:
|
|
2626 return make_int (XMISC_USER_DATA_MODIFIERS (XEVENT_DATA (event)));
|
|
2627 default:
|
|
2628 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event);
|
|
2629 goto again;
|
|
2630 }
|
|
2631 #else /* not USE_KKCC */
|
428
|
2632 switch (XEVENT (event)->event_type)
|
|
2633 {
|
|
2634 case key_press_event:
|
|
2635 return make_int (XEVENT (event)->event.key.modifiers);
|
|
2636 case button_press_event:
|
|
2637 case button_release_event:
|
|
2638 return make_int (XEVENT (event)->event.button.modifiers);
|
|
2639 case pointer_motion_event:
|
|
2640 return make_int (XEVENT (event)->event.motion.modifiers);
|
|
2641 case misc_user_event:
|
|
2642 return make_int (XEVENT (event)->event.misc.modifiers);
|
|
2643 default:
|
|
2644 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event);
|
|
2645 goto again;
|
|
2646 }
|
934
|
2647 #endif /* not USE_KKCC */
|
428
|
2648 }
|
|
2649
|
|
2650 DEFUN ("event-modifiers", Fevent_modifiers, 1, 1, 0, /*
|
442
|
2651 Return a list of symbols, the names of the modifier keys and buttons
|
428
|
2652 which were down when the given mouse or keyboard event was produced.
|
442
|
2653 See also the function `event-modifier-bits'.
|
|
2654
|
|
2655 The possible symbols in the list are
|
|
2656
|
|
2657 `shift': The Shift key. Will not appear, in general, on key events
|
|
2658 where the keysym is an ASCII character, because using Shift
|
|
2659 on such a character converts it into another character rather
|
|
2660 than actually just adding a Shift modifier.
|
|
2661
|
|
2662 `control': The Control key.
|
|
2663
|
|
2664 `meta': The Meta key. On PC's and PC-style keyboards, this is generally
|
|
2665 labelled \"Alt\"; Meta is a holdover from early Lisp Machines and
|
|
2666 such, propagated through the X Window System. On Sun keyboards,
|
|
2667 this key is labelled with a diamond.
|
|
2668
|
|
2669 `alt': The \"Alt\" key. Alt is in quotes because this does not refer
|
|
2670 to what it obviously should refer to, namely the Alt key on PC
|
|
2671 keyboards. Instead, it refers to the key labelled Alt on Sun
|
|
2672 keyboards, and to no key at all on PC keyboards.
|
|
2673
|
|
2674 `super': The Super key. Most keyboards don't have any such key, but
|
|
2675 under X Windows using `xmodmap' you can assign any key (such as
|
|
2676 an underused right-shift, right-control, or right-alt key) to
|
|
2677 this key modifier. No support currently exists under MS Windows
|
|
2678 for generating these modifiers.
|
|
2679
|
|
2680 `hyper': The Hyper key. Works just like the Super key.
|
|
2681
|
|
2682 `button1': The mouse buttons. This means that the specified button was held
|
|
2683 `button2': down at the time the event occurred. NOTE: For button-press
|
|
2684 `button3': events, the button that was just pressed down does NOT appear in
|
|
2685 `button4': the modifiers.
|
|
2686 `button5':
|
|
2687
|
|
2688 Button modifiers are currently ignored when defining and looking up key and
|
|
2689 mouse strokes in keymaps. This could be changed, which would allow a user to
|
|
2690 create button-chord actions, use a button as a key modifier and do other
|
|
2691 clever things.
|
428
|
2692 */
|
|
2693 (event))
|
|
2694 {
|
|
2695 int mod = XINT (Fevent_modifier_bits (event));
|
|
2696 Lisp_Object result = Qnil;
|
442
|
2697 struct gcpro gcpro1;
|
|
2698
|
|
2699 GCPRO1 (result);
|
|
2700 if (mod & XEMACS_MOD_SHIFT) result = Fcons (Qshift, result);
|
|
2701 if (mod & XEMACS_MOD_ALT) result = Fcons (Qalt, result);
|
|
2702 if (mod & XEMACS_MOD_HYPER) result = Fcons (Qhyper, result);
|
|
2703 if (mod & XEMACS_MOD_SUPER) result = Fcons (Qsuper, result);
|
|
2704 if (mod & XEMACS_MOD_META) result = Fcons (Qmeta, result);
|
|
2705 if (mod & XEMACS_MOD_CONTROL) result = Fcons (Qcontrol, result);
|
|
2706 if (mod & XEMACS_MOD_BUTTON1) result = Fcons (Qbutton1, result);
|
|
2707 if (mod & XEMACS_MOD_BUTTON2) result = Fcons (Qbutton2, result);
|
|
2708 if (mod & XEMACS_MOD_BUTTON3) result = Fcons (Qbutton3, result);
|
|
2709 if (mod & XEMACS_MOD_BUTTON4) result = Fcons (Qbutton4, result);
|
|
2710 if (mod & XEMACS_MOD_BUTTON5) result = Fcons (Qbutton5, result);
|
|
2711 RETURN_UNGCPRO (Fnreverse (result));
|
428
|
2712 }
|
|
2713
|
|
2714 static int
|
|
2715 event_x_y_pixel_internal (Lisp_Object event, int *x, int *y, int relative)
|
|
2716 {
|
|
2717 struct window *w;
|
|
2718 struct frame *f;
|
|
2719
|
934
|
2720 #ifdef USE_KKCC
|
|
2721 if (XEVENT_TYPE (event) == pointer_motion_event)
|
|
2722 {
|
|
2723 *x = XMOTION_DATA_X (XEVENT_DATA (event));
|
|
2724 *y = XMOTION_DATA_Y (XEVENT_DATA (event));
|
|
2725 }
|
|
2726 else if (XEVENT_TYPE (event) == button_press_event ||
|
|
2727 XEVENT_TYPE (event) == button_release_event)
|
|
2728 {
|
|
2729 *x = XBUTTON_DATA_X (XEVENT_DATA (event));
|
|
2730 *y = XBUTTON_DATA_Y (XEVENT_DATA (event));
|
|
2731 }
|
|
2732 else if (XEVENT_TYPE (event) == misc_user_event)
|
|
2733 {
|
|
2734 *x = XMISC_USER_DATA_X (XEVENT_DATA (event));
|
|
2735 *y = XMISC_USER_DATA_Y (XEVENT_DATA (event));
|
|
2736 }
|
|
2737 else
|
|
2738 return 0;
|
|
2739 #else /* not USE_KKCC */
|
428
|
2740 if (XEVENT (event)->event_type == pointer_motion_event)
|
|
2741 {
|
|
2742 *x = XEVENT (event)->event.motion.x;
|
|
2743 *y = XEVENT (event)->event.motion.y;
|
|
2744 }
|
|
2745 else if (XEVENT (event)->event_type == button_press_event ||
|
|
2746 XEVENT (event)->event_type == button_release_event)
|
|
2747 {
|
|
2748 *x = XEVENT (event)->event.button.x;
|
|
2749 *y = XEVENT (event)->event.button.y;
|
|
2750 }
|
|
2751 else if (XEVENT (event)->event_type == misc_user_event)
|
|
2752 {
|
|
2753 *x = XEVENT (event)->event.misc.x;
|
|
2754 *y = XEVENT (event)->event.misc.y;
|
|
2755 }
|
|
2756 else
|
|
2757 return 0;
|
934
|
2758 #endif /* not USE_KKCC */
|
428
|
2759 f = XFRAME (EVENT_CHANNEL (XEVENT (event)));
|
|
2760
|
|
2761 if (relative)
|
|
2762 {
|
|
2763 w = find_window_by_pixel_pos (*x, *y, f->root_window);
|
|
2764
|
|
2765 if (!w)
|
442
|
2766 return 1; /* #### What should really happen here? */
|
428
|
2767
|
|
2768 *x -= w->pixel_left;
|
|
2769 *y -= w->pixel_top;
|
|
2770 }
|
|
2771 else
|
|
2772 {
|
|
2773 *y -= FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
|
|
2774 FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f);
|
|
2775 *x -= FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
|
|
2776 FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f);
|
|
2777 }
|
|
2778
|
|
2779 return 1;
|
|
2780 }
|
|
2781
|
|
2782 DEFUN ("event-window-x-pixel", Fevent_window_x_pixel, 1, 1, 0, /*
|
|
2783 Return the X position in pixels of mouse event EVENT.
|
|
2784 The value returned is relative to the window the event occurred in.
|
|
2785 This will signal an error if the event is not a mouse event.
|
|
2786 See also `mouse-event-p' and `event-x-pixel'.
|
|
2787 */
|
|
2788 (event))
|
|
2789 {
|
|
2790 int x, y;
|
|
2791
|
|
2792 CHECK_LIVE_EVENT (event);
|
|
2793
|
|
2794 if (!event_x_y_pixel_internal (event, &x, &y, 1))
|
|
2795 return wrong_type_argument (Qmouse_event_p, event);
|
|
2796 else
|
|
2797 return make_int (x);
|
|
2798 }
|
|
2799
|
|
2800 DEFUN ("event-window-y-pixel", Fevent_window_y_pixel, 1, 1, 0, /*
|
|
2801 Return the Y position in pixels of mouse event EVENT.
|
|
2802 The value returned is relative to the window the event occurred in.
|
|
2803 This will signal an error if the event is not a mouse event.
|
|
2804 See also `mouse-event-p' and `event-y-pixel'.
|
|
2805 */
|
|
2806 (event))
|
|
2807 {
|
|
2808 int x, y;
|
|
2809
|
|
2810 CHECK_LIVE_EVENT (event);
|
|
2811
|
|
2812 if (!event_x_y_pixel_internal (event, &x, &y, 1))
|
|
2813 return wrong_type_argument (Qmouse_event_p, event);
|
|
2814 else
|
|
2815 return make_int (y);
|
|
2816 }
|
|
2817
|
|
2818 DEFUN ("event-x-pixel", Fevent_x_pixel, 1, 1, 0, /*
|
|
2819 Return the X position in pixels of mouse event EVENT.
|
|
2820 The value returned is relative to the frame the event occurred in.
|
|
2821 This will signal an error if the event is not a mouse event.
|
|
2822 See also `mouse-event-p' and `event-window-x-pixel'.
|
|
2823 */
|
|
2824 (event))
|
|
2825 {
|
|
2826 int x, y;
|
|
2827
|
|
2828 CHECK_LIVE_EVENT (event);
|
|
2829
|
|
2830 if (!event_x_y_pixel_internal (event, &x, &y, 0))
|
|
2831 return wrong_type_argument (Qmouse_event_p, event);
|
|
2832 else
|
|
2833 return make_int (x);
|
|
2834 }
|
|
2835
|
|
2836 DEFUN ("event-y-pixel", Fevent_y_pixel, 1, 1, 0, /*
|
|
2837 Return the Y position in pixels of mouse event EVENT.
|
|
2838 The value returned is relative to the frame the event occurred in.
|
|
2839 This will signal an error if the event is not a mouse event.
|
|
2840 See also `mouse-event-p' `event-window-y-pixel'.
|
|
2841 */
|
|
2842 (event))
|
|
2843 {
|
|
2844 int x, y;
|
|
2845
|
|
2846 CHECK_LIVE_EVENT (event);
|
|
2847
|
|
2848 if (!event_x_y_pixel_internal (event, &x, &y, 0))
|
|
2849 return wrong_type_argument (Qmouse_event_p, event);
|
|
2850 else
|
|
2851 return make_int (y);
|
|
2852 }
|
|
2853
|
|
2854 /* Given an event, return a value:
|
|
2855
|
|
2856 OVER_TOOLBAR: over one of the 4 frame toolbars
|
|
2857 OVER_MODELINE: over a modeline
|
|
2858 OVER_BORDER: over an internal border
|
|
2859 OVER_NOTHING: over the text area, but not over text
|
|
2860 OVER_OUTSIDE: outside of the frame border
|
|
2861 OVER_TEXT: over text in the text area
|
|
2862 OVER_V_DIVIDER: over windows vertical divider
|
|
2863
|
|
2864 and return:
|
|
2865
|
|
2866 The X char position in CHAR_X, if not a null pointer.
|
|
2867 The Y char position in CHAR_Y, if not a null pointer.
|
|
2868 (These last two values are relative to the window the event is over.)
|
|
2869 The window it's over in W, if not a null pointer.
|
|
2870 The buffer position it's over in BUFP, if not a null pointer.
|
|
2871 The closest buffer position in CLOSEST, if not a null pointer.
|
|
2872
|
|
2873 OBJ_X, OBJ_Y, OBJ1, and OBJ2 are as in pixel_to_glyph_translation().
|
|
2874 */
|
|
2875
|
|
2876 static int
|
|
2877 event_pixel_translation (Lisp_Object event, int *char_x, int *char_y,
|
|
2878 int *obj_x, int *obj_y,
|
665
|
2879 struct window **w, Charbpos *bufp, Charbpos *closest,
|
428
|
2880 Charcount *modeline_closest,
|
|
2881 Lisp_Object *obj1, Lisp_Object *obj2)
|
|
2882 {
|
|
2883 int pix_x = 0;
|
|
2884 int pix_y = 0;
|
|
2885 int result;
|
|
2886 Lisp_Object frame;
|
|
2887
|
|
2888 int ret_x, ret_y, ret_obj_x, ret_obj_y;
|
|
2889 struct window *ret_w;
|
665
|
2890 Charbpos ret_bufp, ret_closest;
|
428
|
2891 Charcount ret_modeline_closest;
|
|
2892 Lisp_Object ret_obj1, ret_obj2;
|
|
2893
|
|
2894 CHECK_LIVE_EVENT (event);
|
934
|
2895 #ifdef USE_KKCC
|
|
2896 frame = XEVENT_CHANNEL (event);
|
|
2897 switch (XEVENT_TYPE (event))
|
|
2898 {
|
|
2899 case pointer_motion_event :
|
|
2900 pix_x = XMOTION_DATA_X (XEVENT_DATA (event));
|
|
2901 pix_y = XMOTION_DATA_Y (XEVENT_DATA (event));
|
|
2902 break;
|
|
2903 case button_press_event :
|
|
2904 case button_release_event :
|
|
2905 pix_x = XBUTTON_DATA_X (XEVENT_DATA (event));
|
|
2906 pix_y = XBUTTON_DATA_Y (XEVENT_DATA (event));
|
|
2907 break;
|
|
2908 case misc_user_event :
|
|
2909 pix_x = XMISC_USER_DATA_X (XEVENT_DATA (event));
|
|
2910 pix_y = XMISC_USER_DATA_Y (XEVENT_DATA (event));
|
|
2911 break;
|
|
2912 default:
|
|
2913 dead_wrong_type_argument (Qmouse_event_p, event);
|
|
2914 }
|
|
2915 #else /* not USE_KKCC */
|
428
|
2916 frame = XEVENT (event)->channel;
|
|
2917 switch (XEVENT (event)->event_type)
|
|
2918 {
|
|
2919 case pointer_motion_event :
|
|
2920 pix_x = XEVENT (event)->event.motion.x;
|
|
2921 pix_y = XEVENT (event)->event.motion.y;
|
|
2922 break;
|
|
2923 case button_press_event :
|
|
2924 case button_release_event :
|
|
2925 pix_x = XEVENT (event)->event.button.x;
|
|
2926 pix_y = XEVENT (event)->event.button.y;
|
|
2927 break;
|
|
2928 case misc_user_event :
|
|
2929 pix_x = XEVENT (event)->event.misc.x;
|
|
2930 pix_y = XEVENT (event)->event.misc.y;
|
|
2931 break;
|
|
2932 default:
|
|
2933 dead_wrong_type_argument (Qmouse_event_p, event);
|
|
2934 }
|
934
|
2935 #endif /* not USE_KKCC */
|
428
|
2936
|
|
2937 result = pixel_to_glyph_translation (XFRAME (frame), pix_x, pix_y,
|
|
2938 &ret_x, &ret_y, &ret_obj_x, &ret_obj_y,
|
|
2939 &ret_w, &ret_bufp, &ret_closest,
|
|
2940 &ret_modeline_closest,
|
|
2941 &ret_obj1, &ret_obj2);
|
|
2942
|
|
2943 if (result == OVER_NOTHING || result == OVER_OUTSIDE)
|
|
2944 ret_bufp = 0;
|
|
2945 else if (ret_w && NILP (ret_w->buffer))
|
|
2946 /* Why does this happen? (Does it still happen?)
|
|
2947 I guess the window has gotten reused as a non-leaf... */
|
|
2948 ret_w = 0;
|
|
2949
|
|
2950 /* #### pixel_to_glyph_translation() sometimes returns garbage...
|
|
2951 The word has type Lisp_Type_Record (presumably meaning `extent') but the
|
|
2952 pointer points to random memory, often filled with 0, sometimes not.
|
|
2953 */
|
|
2954 /* #### Chuck, do we still need this crap? */
|
|
2955 if (!NILP (ret_obj1) && !(GLYPHP (ret_obj1)
|
|
2956 #ifdef HAVE_TOOLBARS
|
|
2957 || TOOLBAR_BUTTONP (ret_obj1)
|
|
2958 #endif
|
|
2959 ))
|
|
2960 abort ();
|
|
2961 if (!NILP (ret_obj2) && !(EXTENTP (ret_obj2) || CONSP (ret_obj2)))
|
|
2962 abort ();
|
|
2963
|
|
2964 if (char_x)
|
|
2965 *char_x = ret_x;
|
|
2966 if (char_y)
|
|
2967 *char_y = ret_y;
|
|
2968 if (obj_x)
|
|
2969 *obj_x = ret_obj_x;
|
|
2970 if (obj_y)
|
|
2971 *obj_y = ret_obj_y;
|
|
2972 if (w)
|
|
2973 *w = ret_w;
|
|
2974 if (bufp)
|
|
2975 *bufp = ret_bufp;
|
|
2976 if (closest)
|
|
2977 *closest = ret_closest;
|
|
2978 if (modeline_closest)
|
|
2979 *modeline_closest = ret_modeline_closest;
|
|
2980 if (obj1)
|
|
2981 *obj1 = ret_obj1;
|
|
2982 if (obj2)
|
|
2983 *obj2 = ret_obj2;
|
|
2984
|
|
2985 return result;
|
|
2986 }
|
|
2987
|
|
2988 DEFUN ("event-over-text-area-p", Fevent_over_text_area_p, 1, 1, 0, /*
|
|
2989 Return t if the mouse event EVENT occurred over the text area of a window.
|
|
2990 The modeline is not considered to be part of the text area.
|
|
2991 */
|
|
2992 (event))
|
|
2993 {
|
|
2994 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
2995
|
|
2996 return result == OVER_TEXT || result == OVER_NOTHING ? Qt : Qnil;
|
|
2997 }
|
|
2998
|
|
2999 DEFUN ("event-over-modeline-p", Fevent_over_modeline_p, 1, 1, 0, /*
|
|
3000 Return t if the mouse event EVENT occurred over the modeline of a window.
|
|
3001 */
|
|
3002 (event))
|
|
3003 {
|
|
3004 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3005
|
|
3006 return result == OVER_MODELINE ? Qt : Qnil;
|
|
3007 }
|
|
3008
|
|
3009 DEFUN ("event-over-border-p", Fevent_over_border_p, 1, 1, 0, /*
|
|
3010 Return t if the mouse event EVENT occurred over an internal border.
|
|
3011 */
|
|
3012 (event))
|
|
3013 {
|
|
3014 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3015
|
|
3016 return result == OVER_BORDER ? Qt : Qnil;
|
|
3017 }
|
|
3018
|
|
3019 DEFUN ("event-over-toolbar-p", Fevent_over_toolbar_p, 1, 1, 0, /*
|
|
3020 Return t if the mouse event EVENT occurred over a toolbar.
|
|
3021 */
|
|
3022 (event))
|
|
3023 {
|
|
3024 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3025
|
|
3026 return result == OVER_TOOLBAR ? Qt : Qnil;
|
|
3027 }
|
|
3028
|
|
3029 DEFUN ("event-over-vertical-divider-p", Fevent_over_vertical_divider_p, 1, 1, 0, /*
|
|
3030 Return t if the mouse event EVENT occurred over a window divider.
|
|
3031 */
|
|
3032 (event))
|
|
3033 {
|
|
3034 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3035
|
|
3036 return result == OVER_V_DIVIDER ? Qt : Qnil;
|
|
3037 }
|
|
3038
|
|
3039 struct console *
|
|
3040 event_console_or_selected (Lisp_Object event)
|
|
3041 {
|
|
3042 Lisp_Object channel = EVENT_CHANNEL (XEVENT (event));
|
|
3043 Lisp_Object console = CDFW_CONSOLE (channel);
|
|
3044
|
|
3045 if (NILP (console))
|
|
3046 console = Vselected_console;
|
|
3047
|
|
3048 return XCONSOLE (console);
|
|
3049 }
|
|
3050
|
|
3051 DEFUN ("event-channel", Fevent_channel, 1, 1, 0, /*
|
|
3052 Return the channel that the event EVENT occurred on.
|
|
3053 This will be a frame, device, console, or nil for some types
|
|
3054 of events (e.g. eval events).
|
|
3055 */
|
|
3056 (event))
|
|
3057 {
|
|
3058 CHECK_LIVE_EVENT (event);
|
|
3059 return EVENT_CHANNEL (XEVENT (event));
|
|
3060 }
|
|
3061
|
|
3062 DEFUN ("event-window", Fevent_window, 1, 1, 0, /*
|
|
3063 Return the window over which mouse event EVENT occurred.
|
|
3064 This may be nil if the event occurred in the border or over a toolbar.
|
|
3065 The modeline is considered to be within the window it describes.
|
|
3066 */
|
|
3067 (event))
|
|
3068 {
|
|
3069 struct window *w;
|
|
3070
|
|
3071 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, 0, 0);
|
|
3072
|
|
3073 if (!w)
|
|
3074 return Qnil;
|
|
3075 else
|
|
3076 {
|
793
|
3077 return wrap_window (w);
|
428
|
3078 }
|
|
3079 }
|
|
3080
|
|
3081 DEFUN ("event-point", Fevent_point, 1, 1, 0, /*
|
|
3082 Return the character position of the mouse event EVENT.
|
|
3083 If the event did not occur over a window, or did not occur over text,
|
|
3084 then this returns nil. Otherwise, it returns a position in the buffer
|
|
3085 visible in the event's window.
|
|
3086 */
|
|
3087 (event))
|
|
3088 {
|
665
|
3089 Charbpos bufp;
|
428
|
3090 struct window *w;
|
|
3091
|
|
3092 event_pixel_translation (event, 0, 0, 0, 0, &w, &bufp, 0, 0, 0, 0);
|
|
3093
|
|
3094 return w && bufp ? make_int (bufp) : Qnil;
|
|
3095 }
|
|
3096
|
|
3097 DEFUN ("event-closest-point", Fevent_closest_point, 1, 1, 0, /*
|
|
3098 Return the character position closest to the mouse event EVENT.
|
|
3099 If the event did not occur over a window or over text, return the
|
|
3100 closest point to the location of the event. If the Y pixel position
|
|
3101 overlaps a window and the X pixel position is to the left of that
|
|
3102 window, the closest point is the beginning of the line containing the
|
|
3103 Y position. If the Y pixel position overlaps a window and the X pixel
|
|
3104 position is to the right of that window, the closest point is the end
|
|
3105 of the line containing the Y position. If the Y pixel position is
|
|
3106 above a window, return 0. If it is below the last character in a window,
|
|
3107 return the value of (window-end).
|
|
3108 */
|
|
3109 (event))
|
|
3110 {
|
665
|
3111 Charbpos bufp;
|
428
|
3112
|
|
3113 event_pixel_translation (event, 0, 0, 0, 0, 0, 0, &bufp, 0, 0, 0);
|
|
3114
|
|
3115 return bufp ? make_int (bufp) : Qnil;
|
|
3116 }
|
|
3117
|
|
3118 DEFUN ("event-x", Fevent_x, 1, 1, 0, /*
|
|
3119 Return the X position of the mouse event EVENT in characters.
|
|
3120 This is relative to the window the event occurred over.
|
|
3121 */
|
|
3122 (event))
|
|
3123 {
|
|
3124 int char_x;
|
|
3125
|
|
3126 event_pixel_translation (event, &char_x, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3127
|
|
3128 return make_int (char_x);
|
|
3129 }
|
|
3130
|
|
3131 DEFUN ("event-y", Fevent_y, 1, 1, 0, /*
|
|
3132 Return the Y position of the mouse event EVENT in characters.
|
|
3133 This is relative to the window the event occurred over.
|
|
3134 */
|
|
3135 (event))
|
|
3136 {
|
|
3137 int char_y;
|
|
3138
|
|
3139 event_pixel_translation (event, 0, &char_y, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3140
|
|
3141 return make_int (char_y);
|
|
3142 }
|
|
3143
|
|
3144 DEFUN ("event-modeline-position", Fevent_modeline_position, 1, 1, 0, /*
|
|
3145 Return the character position in the modeline that EVENT occurred over.
|
|
3146 EVENT should be a mouse event. If EVENT did not occur over a modeline,
|
|
3147 nil is returned. You can determine the actual character that the
|
|
3148 event occurred over by looking in `generated-modeline-string' at the
|
|
3149 returned character position. Note that `generated-modeline-string'
|
|
3150 is buffer-local, and you must use EVENT's buffer when retrieving
|
|
3151 `generated-modeline-string' in order to get accurate results.
|
|
3152 */
|
|
3153 (event))
|
|
3154 {
|
|
3155 Charcount mbufp;
|
|
3156 int where;
|
|
3157
|
|
3158 where = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, &mbufp, 0, 0);
|
|
3159
|
|
3160 return (mbufp < 0 || where != OVER_MODELINE) ? Qnil : make_int (mbufp);
|
|
3161 }
|
|
3162
|
|
3163 DEFUN ("event-glyph", Fevent_glyph, 1, 1, 0, /*
|
|
3164 Return the glyph that the mouse event EVENT occurred over, or nil.
|
|
3165 */
|
|
3166 (event))
|
|
3167 {
|
|
3168 Lisp_Object glyph;
|
|
3169 struct window *w;
|
|
3170
|
|
3171 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, &glyph, 0);
|
|
3172
|
|
3173 return w && GLYPHP (glyph) ? glyph : Qnil;
|
|
3174 }
|
|
3175
|
|
3176 DEFUN ("event-glyph-extent", Fevent_glyph_extent, 1, 1, 0, /*
|
|
3177 Return the extent of the glyph that the mouse event EVENT occurred over.
|
|
3178 If the event did not occur over a glyph, nil is returned.
|
|
3179 */
|
|
3180 (event))
|
|
3181 {
|
|
3182 Lisp_Object extent;
|
|
3183 struct window *w;
|
|
3184
|
|
3185 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, 0, &extent);
|
|
3186
|
|
3187 return w && EXTENTP (extent) ? extent : Qnil;
|
|
3188 }
|
|
3189
|
|
3190 DEFUN ("event-glyph-x-pixel", Fevent_glyph_x_pixel, 1, 1, 0, /*
|
|
3191 Return the X pixel position of EVENT relative to the glyph it occurred over.
|
|
3192 EVENT should be a mouse event. If the event did not occur over a glyph,
|
|
3193 nil is returned.
|
|
3194 */
|
|
3195 (event))
|
|
3196 {
|
|
3197 Lisp_Object extent;
|
|
3198 struct window *w;
|
|
3199 int obj_x;
|
|
3200
|
|
3201 event_pixel_translation (event, 0, 0, &obj_x, 0, &w, 0, 0, 0, 0, &extent);
|
|
3202
|
|
3203 return w && EXTENTP (extent) ? make_int (obj_x) : Qnil;
|
|
3204 }
|
|
3205
|
|
3206 DEFUN ("event-glyph-y-pixel", Fevent_glyph_y_pixel, 1, 1, 0, /*
|
|
3207 Return the Y pixel position of EVENT relative to the glyph it occurred over.
|
|
3208 EVENT should be a mouse event. If the event did not occur over a glyph,
|
|
3209 nil is returned.
|
|
3210 */
|
|
3211 (event))
|
|
3212 {
|
|
3213 Lisp_Object extent;
|
|
3214 struct window *w;
|
|
3215 int obj_y;
|
|
3216
|
|
3217 event_pixel_translation (event, 0, 0, 0, &obj_y, &w, 0, 0, 0, 0, &extent);
|
|
3218
|
|
3219 return w && EXTENTP (extent) ? make_int (obj_y) : Qnil;
|
|
3220 }
|
|
3221
|
|
3222 DEFUN ("event-toolbar-button", Fevent_toolbar_button, 1, 1, 0, /*
|
|
3223 Return the toolbar button that the mouse event EVENT occurred over.
|
|
3224 If the event did not occur over a toolbar button, nil is returned.
|
|
3225 */
|
|
3226 (event))
|
|
3227 {
|
|
3228 #ifdef HAVE_TOOLBARS
|
|
3229 Lisp_Object button;
|
|
3230
|
|
3231 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, &button, 0);
|
|
3232
|
|
3233 return result == OVER_TOOLBAR && TOOLBAR_BUTTONP (button) ? button : Qnil;
|
|
3234 #else
|
|
3235 return Qnil;
|
|
3236 #endif
|
|
3237 }
|
|
3238
|
|
3239 DEFUN ("event-process", Fevent_process, 1, 1, 0, /*
|
444
|
3240 Return the process of the process-output event EVENT.
|
428
|
3241 */
|
|
3242 (event))
|
|
3243 {
|
934
|
3244 #ifdef USE_KKCC
|
|
3245 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p);
|
|
3246 return XPROCESS_DATA_PROCESS (XEVENT_DATA (event));
|
|
3247 #else /* not USE_KKCC */
|
428
|
3248 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p);
|
|
3249 return XEVENT (event)->event.process.process;
|
934
|
3250 #endif /* not USE_KKCC */
|
428
|
3251 }
|
|
3252
|
|
3253 DEFUN ("event-function", Fevent_function, 1, 1, 0, /*
|
|
3254 Return the callback function of EVENT.
|
|
3255 EVENT should be a timeout, misc-user, or eval event.
|
|
3256 */
|
|
3257 (event))
|
|
3258 {
|
|
3259 again:
|
|
3260 CHECK_LIVE_EVENT (event);
|
934
|
3261 #ifdef USE_KKCC
|
|
3262 switch (XEVENT_TYPE (event))
|
|
3263 {
|
|
3264 case timeout_event:
|
|
3265 return XTIMEOUT_DATA_FUNCTION (XEVENT_DATA (event));
|
|
3266 case misc_user_event:
|
|
3267 return XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event));
|
|
3268 case eval_event:
|
|
3269 return XEVAL_DATA_FUNCTION (XEVENT_DATA (event));
|
|
3270 default:
|
|
3271 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
|
|
3272 goto again;
|
|
3273 }
|
|
3274 #else /* not USE_KKCC */
|
428
|
3275 switch (XEVENT (event)->event_type)
|
|
3276 {
|
|
3277 case timeout_event:
|
|
3278 return XEVENT (event)->event.timeout.function;
|
|
3279 case misc_user_event:
|
|
3280 return XEVENT (event)->event.misc.function;
|
|
3281 case eval_event:
|
|
3282 return XEVENT (event)->event.eval.function;
|
|
3283 default:
|
|
3284 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
|
|
3285 goto again;
|
|
3286 }
|
934
|
3287 #endif /* not USE_KKCC */
|
428
|
3288 }
|
|
3289
|
|
3290 DEFUN ("event-object", Fevent_object, 1, 1, 0, /*
|
|
3291 Return the callback function argument of EVENT.
|
|
3292 EVENT should be a timeout, misc-user, or eval event.
|
|
3293 */
|
|
3294 (event))
|
|
3295 {
|
|
3296 again:
|
|
3297 CHECK_LIVE_EVENT (event);
|
934
|
3298 #ifdef USE_KKCC
|
|
3299 switch (XEVENT_TYPE (event))
|
|
3300 {
|
|
3301 case timeout_event:
|
|
3302 return XTIMEOUT_DATA_OBJECT (XEVENT_DATA (event));
|
|
3303 case misc_user_event:
|
|
3304 return XMISC_USER_DATA_OBJECT (XEVENT_DATA (event));
|
|
3305 case eval_event:
|
|
3306 return XEVAL_DATA_OBJECT (XEVENT_DATA (event));
|
|
3307 default:
|
|
3308 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
|
|
3309 goto again;
|
|
3310 }
|
|
3311 #else /* not USE_KKCC */
|
428
|
3312 switch (XEVENT (event)->event_type)
|
|
3313 {
|
|
3314 case timeout_event:
|
|
3315 return XEVENT (event)->event.timeout.object;
|
|
3316 case misc_user_event:
|
|
3317 return XEVENT (event)->event.misc.object;
|
|
3318 case eval_event:
|
|
3319 return XEVENT (event)->event.eval.object;
|
|
3320 default:
|
|
3321 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
|
|
3322 goto again;
|
|
3323 }
|
934
|
3324 #endif /* not USE_KKCC */
|
428
|
3325 }
|
|
3326
|
|
3327 DEFUN ("event-properties", Fevent_properties, 1, 1, 0, /*
|
|
3328 Return a list of all of the properties of EVENT.
|
|
3329 This is in the form of a property list (alternating keyword/value pairs).
|
|
3330 */
|
|
3331 (event))
|
|
3332 {
|
|
3333 Lisp_Object props = Qnil;
|
440
|
3334 Lisp_Event *e;
|
428
|
3335 struct gcpro gcpro1;
|
|
3336
|
|
3337 CHECK_LIVE_EVENT (event);
|
|
3338 e = XEVENT (event);
|
|
3339 GCPRO1 (props);
|
|
3340
|
|
3341 props = cons3 (Qtimestamp, Fevent_timestamp (event), props);
|
|
3342
|
934
|
3343 #ifdef USE_KKCC
|
|
3344 switch (EVENT_TYPE (e))
|
|
3345 #else /* not USE_KKCC */
|
428
|
3346 switch (e->event_type)
|
934
|
3347 #endif /* not USE_KKCC */
|
428
|
3348 {
|
|
3349 default: abort ();
|
|
3350
|
|
3351 case process_event:
|
934
|
3352 #ifdef USE_KKCC
|
|
3353 props = cons3 (Qprocess, XPROCESS_DATA_PROCESS (EVENT_DATA (e)), props);
|
|
3354 #else /* not USE_KKCC */
|
428
|
3355 props = cons3 (Qprocess, e->event.process.process, props);
|
934
|
3356 #endif /* not USE_KKCC */
|
428
|
3357 break;
|
|
3358
|
|
3359 case timeout_event:
|
|
3360 props = cons3 (Qobject, Fevent_object (event), props);
|
|
3361 props = cons3 (Qfunction, Fevent_function (event), props);
|
934
|
3362 #ifdef USE_KKCC
|
|
3363 props = cons3 (Qid, make_int (XTIMEOUT_DATA_ID_NUMBER (EVENT_DATA (e))), props);
|
|
3364 #else /* not USE_KKCC */
|
428
|
3365 props = cons3 (Qid, make_int (e->event.timeout.id_number), props);
|
934
|
3366 #endif /* not USE_KKCC */
|
428
|
3367 break;
|
|
3368
|
|
3369 case key_press_event:
|
|
3370 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
|
|
3371 props = cons3 (Qkey, Fevent_key (event), props);
|
|
3372 break;
|
|
3373
|
|
3374 case button_press_event:
|
|
3375 case button_release_event:
|
|
3376 props = cons3 (Qy, Fevent_y_pixel (event), props);
|
|
3377 props = cons3 (Qx, Fevent_x_pixel (event), props);
|
|
3378 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
|
|
3379 props = cons3 (Qbutton, Fevent_button (event), props);
|
|
3380 break;
|
|
3381
|
|
3382 case pointer_motion_event:
|
|
3383 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
|
|
3384 props = cons3 (Qy, Fevent_y_pixel (event), props);
|
|
3385 props = cons3 (Qx, Fevent_x_pixel (event), props);
|
|
3386 break;
|
|
3387
|
|
3388 case misc_user_event:
|
|
3389 props = cons3 (Qobject, Fevent_object (event), props);
|
|
3390 props = cons3 (Qfunction, Fevent_function (event), props);
|
|
3391 props = cons3 (Qy, Fevent_y_pixel (event), props);
|
|
3392 props = cons3 (Qx, Fevent_x_pixel (event), props);
|
|
3393 props = cons3 (Qmodifiers, Fevent_modifiers (event), props);
|
|
3394 props = cons3 (Qbutton, Fevent_button (event), props);
|
|
3395 break;
|
|
3396
|
|
3397 case eval_event:
|
|
3398 props = cons3 (Qobject, Fevent_object (event), props);
|
|
3399 props = cons3 (Qfunction, Fevent_function (event), props);
|
|
3400 break;
|
|
3401
|
|
3402 case magic_eval_event:
|
|
3403 case magic_event:
|
|
3404 break;
|
|
3405
|
|
3406 case empty_event:
|
|
3407 RETURN_UNGCPRO (Qnil);
|
|
3408 break;
|
|
3409 }
|
|
3410
|
|
3411 props = cons3 (Qchannel, Fevent_channel (event), props);
|
|
3412 UNGCPRO;
|
|
3413
|
|
3414 return props;
|
|
3415 }
|
|
3416
|
|
3417
|
|
3418 /************************************************************************/
|
|
3419 /* initialization */
|
|
3420 /************************************************************************/
|
|
3421
|
|
3422 void
|
|
3423 syms_of_events (void)
|
|
3424 {
|
442
|
3425 INIT_LRECORD_IMPLEMENTATION (event);
|
934
|
3426 #ifdef USE_KKCC
|
|
3427 INIT_LRECORD_IMPLEMENTATION (key_data);
|
|
3428 INIT_LRECORD_IMPLEMENTATION (button_data);
|
|
3429 INIT_LRECORD_IMPLEMENTATION (motion_data);
|
|
3430 INIT_LRECORD_IMPLEMENTATION (process_data);
|
|
3431 INIT_LRECORD_IMPLEMENTATION (timeout_data);
|
|
3432 INIT_LRECORD_IMPLEMENTATION (eval_data);
|
|
3433 INIT_LRECORD_IMPLEMENTATION (misc_user_data);
|
|
3434 INIT_LRECORD_IMPLEMENTATION (magic_eval_data);
|
|
3435 INIT_LRECORD_IMPLEMENTATION (magic_data);
|
|
3436 #endif /* USE_KKCC */
|
442
|
3437
|
428
|
3438 DEFSUBR (Fcharacter_to_event);
|
|
3439 DEFSUBR (Fevent_to_character);
|
|
3440
|
|
3441 DEFSUBR (Fmake_event);
|
|
3442 DEFSUBR (Fdeallocate_event);
|
|
3443 DEFSUBR (Fcopy_event);
|
|
3444 DEFSUBR (Feventp);
|
|
3445 DEFSUBR (Fevent_live_p);
|
|
3446 DEFSUBR (Fevent_type);
|
|
3447 DEFSUBR (Fevent_properties);
|
|
3448
|
|
3449 DEFSUBR (Fevent_timestamp);
|
442
|
3450 DEFSUBR (Fevent_timestamp_lessp);
|
428
|
3451 DEFSUBR (Fevent_key);
|
|
3452 DEFSUBR (Fevent_button);
|
|
3453 DEFSUBR (Fevent_modifier_bits);
|
|
3454 DEFSUBR (Fevent_modifiers);
|
|
3455 DEFSUBR (Fevent_x_pixel);
|
|
3456 DEFSUBR (Fevent_y_pixel);
|
|
3457 DEFSUBR (Fevent_window_x_pixel);
|
|
3458 DEFSUBR (Fevent_window_y_pixel);
|
|
3459 DEFSUBR (Fevent_over_text_area_p);
|
|
3460 DEFSUBR (Fevent_over_modeline_p);
|
|
3461 DEFSUBR (Fevent_over_border_p);
|
|
3462 DEFSUBR (Fevent_over_toolbar_p);
|
|
3463 DEFSUBR (Fevent_over_vertical_divider_p);
|
|
3464 DEFSUBR (Fevent_channel);
|
|
3465 DEFSUBR (Fevent_window);
|
|
3466 DEFSUBR (Fevent_point);
|
|
3467 DEFSUBR (Fevent_closest_point);
|
|
3468 DEFSUBR (Fevent_x);
|
|
3469 DEFSUBR (Fevent_y);
|
|
3470 DEFSUBR (Fevent_modeline_position);
|
|
3471 DEFSUBR (Fevent_glyph);
|
|
3472 DEFSUBR (Fevent_glyph_extent);
|
|
3473 DEFSUBR (Fevent_glyph_x_pixel);
|
|
3474 DEFSUBR (Fevent_glyph_y_pixel);
|
|
3475 DEFSUBR (Fevent_toolbar_button);
|
|
3476 DEFSUBR (Fevent_process);
|
|
3477 DEFSUBR (Fevent_function);
|
|
3478 DEFSUBR (Fevent_object);
|
|
3479
|
563
|
3480 DEFSYMBOL (Qeventp);
|
|
3481 DEFSYMBOL (Qevent_live_p);
|
|
3482 DEFSYMBOL (Qkey_press_event_p);
|
|
3483 DEFSYMBOL (Qbutton_event_p);
|
|
3484 DEFSYMBOL (Qmouse_event_p);
|
|
3485 DEFSYMBOL (Qprocess_event_p);
|
|
3486 DEFSYMBOL (Qkey_press);
|
|
3487 DEFSYMBOL (Qbutton_press);
|
|
3488 DEFSYMBOL (Qbutton_release);
|
|
3489 DEFSYMBOL (Qmisc_user);
|
|
3490 DEFSYMBOL (Qascii_character);
|
428
|
3491
|
|
3492 defsymbol (&QKbackspace, "backspace");
|
|
3493 defsymbol (&QKtab, "tab");
|
|
3494 defsymbol (&QKlinefeed, "linefeed");
|
|
3495 defsymbol (&QKreturn, "return");
|
|
3496 defsymbol (&QKescape, "escape");
|
|
3497 defsymbol (&QKspace, "space");
|
|
3498 defsymbol (&QKdelete, "delete");
|
|
3499 }
|
|
3500
|
|
3501
|
|
3502 void
|
|
3503 reinit_vars_of_events (void)
|
|
3504 {
|
|
3505 Vevent_resource = Qnil;
|
|
3506 }
|
|
3507
|
|
3508 void
|
|
3509 vars_of_events (void)
|
|
3510 {
|
|
3511 reinit_vars_of_events ();
|
|
3512
|
|
3513 DEFVAR_LISP ("character-set-property", &Vcharacter_set_property /*
|
|
3514 A symbol used to look up the 8-bit character of a keysym.
|
|
3515 To convert a keysym symbol to an 8-bit code, as when that key is
|
|
3516 bound to self-insert-command, we will look up the property that this
|
|
3517 variable names on the property list of the keysym-symbol. The window-
|
|
3518 system-specific code will set up appropriate properties and set this
|
|
3519 variable.
|
|
3520 */ );
|
|
3521 Vcharacter_set_property = Qnil;
|
|
3522 }
|