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