0
|
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.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not in FSF. */
|
|
23
|
|
24 /* This file has been Mule-ized. */
|
|
25
|
|
26 #include <config.h>
|
|
27 #include "lisp.h"
|
|
28 #include "buffer.h"
|
|
29 #include "console.h"
|
|
30 #include "console-tty.h" /* for stuff in character_to_event */
|
|
31 #include "device.h"
|
|
32 #include "console-x.h" /* for x_event_name prototype */
|
|
33 #include "extents.h" /* Just for the EXTENTP abort check... */
|
|
34 #include "events.h"
|
|
35 #include "frame.h"
|
|
36 #include "glyphs.h"
|
|
37 #include "keymap.h" /* for key_desc_list_to_event() */
|
|
38 #include "redisplay.h"
|
|
39 #include "window.h"
|
|
40
|
100
|
41 #ifdef WINDOWSNT
|
|
42 /* Hmm, under unix we want X modifiers, under NT we want X modifiers if
|
|
43 we are running X and Windows modifiers otherwise.
|
|
44 gak. This is a kludge until we support multiple native GUIs!
|
|
45 */
|
|
46 #undef MOD_ALT
|
|
47 #undef MOD_CONTROL
|
|
48 #undef MOD_SHIFT
|
|
49 #endif
|
|
50
|
157
|
51 #include "events-mod.h"
|
100
|
52
|
0
|
53 /* Where old events go when they are explicitly deallocated.
|
|
54 The event chain here is cut loose before GC, so these will be freed
|
|
55 eventually.
|
|
56 */
|
|
57 static Lisp_Object Vevent_resource;
|
|
58
|
|
59 Lisp_Object Qeventp;
|
|
60 Lisp_Object Qevent_live_p;
|
|
61 Lisp_Object Qkey_press_event_p;
|
|
62 Lisp_Object Qbutton_event_p;
|
|
63 Lisp_Object Qmouse_event_p;
|
|
64 Lisp_Object Qprocess_event_p;
|
|
65
|
163
|
66 Lisp_Object Qkey_press, Qbutton_press, Qbutton_release, Qmisc_user;
|
0
|
67 Lisp_Object Qascii_character;
|
|
68
|
197
|
69 #ifdef HAVE_OFFIX_DND
|
|
70 Lisp_Object Qdnd_drop_event_p;
|
|
71 Lisp_Object Qdnd_drop;
|
|
72 #endif
|
|
73
|
0
|
74 /* #### Ad-hoc hack. Should be part of define_lrecord_implementation */
|
|
75 void
|
|
76 clear_event_resource (void)
|
|
77 {
|
|
78 Vevent_resource = Qnil;
|
|
79 }
|
|
80
|
|
81 static Lisp_Object mark_event (Lisp_Object, void (*) (Lisp_Object));
|
|
82 static void print_event (Lisp_Object, Lisp_Object, int);
|
|
83 static int event_equal (Lisp_Object, Lisp_Object, int);
|
|
84 static unsigned long event_hash (Lisp_Object obj, int depth);
|
|
85 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
|
|
86 mark_event, print_event, 0, event_equal,
|
|
87 event_hash, struct Lisp_Event);
|
|
88
|
|
89 /* Make sure we lose quickly if we try to use this event */
|
|
90 static void
|
|
91 deinitialize_event (Lisp_Object ev)
|
|
92 {
|
|
93 int i;
|
|
94 struct Lisp_Event *event = XEVENT (ev);
|
|
95
|
|
96 for (i = 0; i < ((sizeof (struct Lisp_Event)) / sizeof (int)); i++)
|
|
97 ((int *) event) [i] = 0xdeadbeef;
|
|
98 event->event_type = dead_event;
|
|
99 event->channel = Qnil;
|
|
100 set_lheader_implementation (&(event->lheader), lrecord_event);
|
|
101 XSET_EVENT_NEXT (ev, Qnil);
|
|
102 }
|
|
103
|
|
104 /* Set everything to zero or nil so that it's predictable. */
|
|
105 void
|
|
106 zero_event (struct Lisp_Event *e)
|
|
107 {
|
|
108 memset (e, 0, sizeof (*e));
|
|
109 set_lheader_implementation (&(e->lheader), lrecord_event);
|
|
110 e->event_type = empty_event;
|
|
111 e->next = Qnil;
|
|
112 e->channel = Qnil;
|
|
113 }
|
|
114
|
|
115 static Lisp_Object
|
|
116 mark_event (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
117 {
|
|
118 struct Lisp_Event *event = XEVENT (obj);
|
|
119
|
|
120 switch (event->event_type)
|
|
121 {
|
|
122 case key_press_event:
|
|
123 ((markobj) (event->event.key.keysym));
|
|
124 break;
|
|
125 case process_event:
|
|
126 ((markobj) (event->event.process.process));
|
|
127 break;
|
|
128 case timeout_event:
|
|
129 ((markobj) (event->event.timeout.function));
|
|
130 ((markobj) (event->event.timeout.object));
|
|
131 break;
|
|
132 case eval_event:
|
|
133 case misc_user_event:
|
|
134 ((markobj) (event->event.eval.function));
|
|
135 ((markobj) (event->event.eval.object));
|
|
136 break;
|
|
137 case magic_eval_event:
|
|
138 ((markobj) (event->event.magic_eval.object));
|
|
139 break;
|
|
140 case button_press_event:
|
|
141 case button_release_event:
|
|
142 case pointer_motion_event:
|
|
143 case magic_event:
|
|
144 case empty_event:
|
|
145 case dead_event:
|
199
|
146 #ifdef HAVE_OFFIX_DND
|
197
|
147 case dnd_drop_event:
|
199
|
148 #endif
|
0
|
149 break;
|
|
150 default:
|
|
151 abort ();
|
|
152 }
|
|
153 ((markobj) (event->channel));
|
|
154 return event->next;
|
|
155 }
|
|
156
|
|
157 static void
|
|
158 print_event_1 (CONST char *str, Lisp_Object obj, Lisp_Object printcharfun)
|
|
159 {
|
|
160 char buf[255];
|
|
161 write_c_string (str, printcharfun);
|
|
162 format_event_object (buf, XEVENT (obj), 0);
|
|
163 write_c_string (buf, printcharfun);
|
|
164 }
|
|
165
|
|
166 static void
|
|
167 print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
168 {
|
|
169 if (print_readably)
|
|
170 error ("printing unreadable object #<event>");
|
|
171
|
173
|
172 switch (XEVENT (obj)->event_type)
|
0
|
173 {
|
|
174 case key_press_event:
|
|
175 print_event_1 ("#<keypress-event ", obj, printcharfun);
|
|
176 break;
|
|
177 case button_press_event:
|
|
178 print_event_1 ("#<buttondown-event ", obj, printcharfun);
|
|
179 break;
|
|
180 case button_release_event:
|
|
181 print_event_1 ("#<buttonup-event ", obj, printcharfun);
|
|
182 break;
|
|
183 case magic_event:
|
|
184 case magic_eval_event:
|
|
185 print_event_1 ("#<magic-event ", obj, printcharfun);
|
|
186 break;
|
|
187 case pointer_motion_event:
|
|
188 {
|
|
189 char buf[100];
|
|
190 sprintf (buf, "#<motion-event %d, %d",
|
|
191 XEVENT (obj)->event.motion.x, XEVENT (obj)->event.motion.y);
|
|
192 write_c_string (buf, printcharfun);
|
|
193 break;
|
|
194 }
|
|
195 case process_event:
|
|
196 write_c_string ("#<process-event ", printcharfun);
|
|
197 print_internal (XEVENT (obj)->event.process.process, printcharfun, 1);
|
|
198 break;
|
|
199 case timeout_event:
|
|
200 write_c_string ("#<timeout-event ", printcharfun);
|
|
201 print_internal (XEVENT (obj)->event.timeout.object, printcharfun, 1);
|
|
202 break;
|
|
203 case empty_event:
|
|
204 write_c_string ("#<empty-event", printcharfun);
|
|
205 break;
|
|
206 case misc_user_event:
|
|
207 case eval_event:
|
|
208 write_c_string ("#<", printcharfun);
|
|
209 if (XEVENT (obj)->event_type == misc_user_event)
|
|
210 write_c_string ("misc-user", printcharfun);
|
|
211 else
|
|
212 write_c_string ("eval", printcharfun);
|
|
213 write_c_string ("-event (", printcharfun);
|
|
214 print_internal (XEVENT (obj)->event.eval.function, printcharfun, 1);
|
|
215 write_c_string (" ", printcharfun);
|
|
216 print_internal (XEVENT (obj)->event.eval.object, printcharfun, 1);
|
|
217 write_c_string (")", printcharfun);
|
|
218 break;
|
|
219 case dead_event:
|
|
220 write_c_string ("#<DEALLOCATED-EVENT", printcharfun);
|
|
221 break;
|
199
|
222 #ifdef HAVE_OFFIX_DND
|
197
|
223 case dnd_drop_event:
|
|
224 print_event_1 ("#<dnd-drop-event ", obj, printcharfun);
|
|
225 break;
|
199
|
226 #endif
|
0
|
227 default:
|
|
228 write_c_string ("#<UNKNOWN-EVENT-TYPE", printcharfun);
|
|
229 break;
|
|
230 }
|
|
231 write_c_string (">", printcharfun);
|
|
232 }
|
173
|
233
|
0
|
234 static int
|
|
235 event_equal (Lisp_Object o1, Lisp_Object o2, int depth)
|
|
236 {
|
|
237 struct Lisp_Event *e1 = XEVENT (o1);
|
|
238 struct Lisp_Event *e2 = XEVENT (o2);
|
|
239
|
|
240 if (e1->event_type != e2->event_type) return 0;
|
|
241 if (!EQ (e1->channel, e2->channel)) return 0;
|
|
242 /* if (e1->timestamp != e2->timestamp) return 0; */
|
|
243 switch (e1->event_type)
|
|
244 {
|
|
245 case process_event:
|
149
|
246 return EQ (e1->event.process.process, e2->event.process.process);
|
173
|
247
|
0
|
248 case timeout_event:
|
195
|
249 return (internal_equal (e1->event.timeout.function,
|
|
250 e2->event.timeout.function, 0) &&
|
|
251 internal_equal (e1->event.timeout.object,
|
|
252 e2->event.timeout.object, 0));
|
173
|
253
|
0
|
254 case key_press_event:
|
149
|
255 return (EQ (e1->event.key.keysym, e2->event.key.keysym) &&
|
|
256 (e1->event.key.modifiers == e2->event.key.modifiers));
|
0
|
257
|
|
258 case button_press_event:
|
|
259 case button_release_event:
|
149
|
260 return (e1->event.button.button == e2->event.button.button &&
|
|
261 e1->event.button.modifiers == e2->event.button.modifiers);
|
0
|
262
|
|
263 case pointer_motion_event:
|
149
|
264 return (e1->event.motion.x == e2->event.motion.x &&
|
|
265 e1->event.motion.y == e2->event.motion.y);
|
0
|
266
|
|
267 case misc_user_event:
|
|
268 case eval_event:
|
195
|
269 return (internal_equal (e1->event.eval.function,
|
|
270 e2->event.eval.function, 0) &&
|
|
271 internal_equal (e1->event.eval.object,
|
|
272 e2->event.eval.object, 0));
|
0
|
273
|
|
274 case magic_eval_event:
|
149
|
275 return (e1->event.magic_eval.internal_function ==
|
|
276 e2->event.magic_eval.internal_function &&
|
195
|
277 internal_equal (e1->event.magic_eval.object,
|
|
278 e2->event.magic_eval.object, 0));
|
0
|
279
|
197
|
280 #ifdef HAVE_OFFIX_DND
|
|
281 case dnd_drop_event:
|
|
282 return (e1->event.dnd_drop.button == e2->event.dnd_drop.button &&
|
|
283 e1->event.dnd_drop.modifiers == e2->event.dnd_drop.modifiers &&
|
|
284 EQ (e1->event.dnd_drop.data, e2->event.dnd_drop.data));
|
|
285 #endif
|
|
286
|
0
|
287 case magic_event:
|
|
288 {
|
183
|
289 struct console *con = XCONSOLE (CDFW_CONSOLE (e1->channel));
|
0
|
290
|
|
291 #ifdef HAVE_X_WINDOWS
|
183
|
292 if (CONSOLE_X_P (con))
|
|
293 return (e1->event.magic.underlying_x_event.xany.serial ==
|
|
294 e2->event.magic.underlying_x_event.xany.serial);
|
0
|
295 #endif
|
149
|
296 #ifdef HAVE_TTY
|
183
|
297 if (CONSOLE_TTY_P (con))
|
0
|
298 return (e1->event.magic.underlying_tty_event ==
|
|
299 e2->event.magic.underlying_tty_event);
|
149
|
300 #endif
|
183
|
301 return 1; /* not reached */
|
0
|
302 }
|
|
303
|
|
304 case empty_event: /* Empty and deallocated events are equal. */
|
|
305 case dead_event:
|
|
306 return 1;
|
|
307
|
|
308 default:
|
|
309 abort ();
|
|
310 return 0; /* not reached; warning suppression */
|
|
311 }
|
|
312 }
|
|
313
|
|
314 static unsigned long
|
|
315 event_hash (Lisp_Object obj, int depth)
|
|
316 {
|
|
317 struct Lisp_Event *e = XEVENT (obj);
|
|
318 unsigned long hash;
|
|
319
|
|
320 hash = HASH2 (e->event_type, LISP_HASH (e->channel));
|
|
321 switch (e->event_type)
|
|
322 {
|
|
323 case process_event:
|
|
324 return HASH2 (hash, LISP_HASH (e->event.process.process));
|
173
|
325
|
0
|
326 case timeout_event:
|
|
327 return HASH3 (hash, internal_hash (e->event.timeout.function, depth + 1),
|
|
328 internal_hash (e->event.timeout.object, depth + 1));
|
173
|
329
|
0
|
330 case key_press_event:
|
|
331 return HASH3 (hash, LISP_HASH (e->event.key.keysym),
|
|
332 e->event.key.modifiers);
|
|
333
|
|
334 case button_press_event:
|
|
335 case button_release_event:
|
|
336 return HASH3 (hash, e->event.button.button, e->event.button.modifiers);
|
|
337
|
|
338 case pointer_motion_event:
|
|
339 return HASH3 (hash, e->event.motion.x, e->event.motion.y);
|
|
340
|
|
341 case misc_user_event:
|
|
342 case eval_event:
|
|
343 return HASH3 (hash, internal_hash (e->event.eval.function, depth + 1),
|
|
344 internal_hash (e->event.eval.object, depth + 1));
|
|
345
|
|
346 case magic_eval_event:
|
|
347 return HASH3 (hash,
|
|
348 (unsigned long) e->event.magic_eval.internal_function,
|
|
349 internal_hash (e->event.magic_eval.object, depth + 1));
|
|
350
|
197
|
351 #ifdef HAVE_OFFIX_DND
|
|
352 case dnd_drop_event:
|
|
353 return HASH4 (hash, e->event.dnd_drop.button, e->event.dnd_drop.modifiers,
|
|
354 LISP_HASH(e->event.dnd_drop.data));
|
|
355 #endif
|
|
356
|
0
|
357 case magic_event:
|
|
358 {
|
183
|
359 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e)));
|
0
|
360 #ifdef HAVE_X_WINDOWS
|
183
|
361 if (CONSOLE_X_P (con))
|
|
362 return HASH2 (hash, e->event.magic.underlying_x_event.xany.serial);
|
0
|
363 #endif
|
183
|
364 #ifdef HAVE_TTY
|
|
365 if (CONSOLE_TTY_P (con))
|
|
366 return HASH2 (hash, e->event.magic.underlying_tty_event);
|
|
367 #endif
|
0
|
368 }
|
|
369
|
|
370 case empty_event:
|
|
371 case dead_event:
|
|
372 return hash;
|
|
373
|
|
374 default:
|
|
375 abort ();
|
|
376 }
|
|
377
|
183
|
378 return 0; /* unreached */
|
0
|
379 }
|
|
380
|
|
381
|
189
|
382 DEFUN ("make-event", Fmake_event, 0, 2, 0, /*
|
|
383 Create a new event of type TYPE, with properties stored in PLIST.
|
|
384 TYPE is a symbol, either `empty', `key-press', `button-press',
|
|
385 `button-release', or `motion'. If TYPE is left out, it defaults to
|
|
386 `empty'.
|
|
387 PLIST is a list of properties, as returned by `event-properties'. Not
|
|
388 all properties are allowed for all kinds of events, and some are
|
|
389 required.
|
0
|
390
|
|
391 WARNING, the event object returned may be a reused one; see the function
|
189
|
392 `deallocate-event'.
|
20
|
393 */
|
189
|
394 (type, plist))
|
0
|
395 {
|
189
|
396 Lisp_Object event, prop, val;
|
|
397 struct Lisp_Event *e;
|
|
398
|
|
399 if (NILP (type))
|
|
400 type = Qempty;
|
0
|
401
|
|
402 if (!NILP (Vevent_resource))
|
|
403 {
|
|
404 event = Vevent_resource;
|
|
405 Vevent_resource = XEVENT_NEXT (event);
|
|
406 }
|
|
407 else
|
|
408 {
|
|
409 event = allocate_event ();
|
|
410 }
|
189
|
411 e = XEVENT (event);
|
|
412 zero_event (e);
|
|
413
|
|
414 if (EQ (type, Qkey_press))
|
|
415 e->event_type = key_press_event;
|
|
416 else if (EQ (type, Qbutton_press))
|
|
417 e->event_type = button_press_event;
|
|
418 else if (EQ (type, Qbutton_release))
|
|
419 e->event_type = button_release_event;
|
|
420 else if (EQ (type, Qmotion))
|
|
421 e->event_type = pointer_motion_event;
|
|
422 else if (EQ (type, Qempty))
|
|
423 e->event_type = empty_event;
|
|
424 else
|
|
425 /* not allowed: Qmisc_user, Qprocess, Qtimeout, Qmagic, Qmagic_eval */
|
197
|
426 /* dnd_drop is also not allowed */
|
189
|
427 signal_simple_error ("Invalid event type", type);
|
|
428
|
|
429 /* Process the plist. */
|
|
430 while (!NILP (plist))
|
|
431 {
|
|
432 prop = Fcar (plist);
|
|
433 plist = Fcdr (plist);
|
|
434 val = Fcar (plist);
|
|
435 plist = Fcdr (plist);
|
|
436 if (EQ (prop, Qchannel))
|
|
437 {
|
203
|
438 if (!FRAMEP (val) && !NILP (val))
|
189
|
439 signal_simple_error ("Invalid event channel", val);
|
|
440 EVENT_CHANNEL (e) = val;
|
|
441 }
|
|
442 else if (EQ (prop, Qkey))
|
|
443 {
|
|
444 if (e->event_type != key_press_event)
|
|
445 wrong_type_argument (Qkey_press_event_p, event);
|
|
446 if (!SYMBOLP (val) && !CHARP (val))
|
|
447 signal_simple_error ("Invalid event key", val);
|
|
448 e->event.key.keysym = val;
|
|
449 }
|
|
450 else if (EQ (prop, Qbutton))
|
|
451 {
|
|
452 CHECK_NATNUM (val);
|
|
453 check_int_range (XINT(val), 1, 3);
|
|
454 if (e->event_type != button_press_event
|
|
455 && e->event_type != button_release_event)
|
|
456 signal_simple_error ("Invalid event type for `button' property",
|
|
457 type);
|
|
458 e->event.button.button = XINT (val);
|
|
459 }
|
|
460 else if (EQ (prop, Qmodifiers))
|
|
461 {
|
|
462 Lisp_Object tail, sym;
|
|
463 int modifiers = 0;
|
|
464
|
|
465 if (e->event_type != key_press_event
|
|
466 && e->event_type != button_press_event
|
|
467 && e->event_type != button_release_event
|
|
468 && e->event_type != pointer_motion_event)
|
|
469 signal_simple_error ("Invalid event type for modifiers", type);
|
|
470
|
|
471 for (tail = val; !NILP (tail); tail = Fcdr (tail))
|
|
472 {
|
|
473 sym = Fcar (tail);
|
|
474 if (EQ (sym, Qcontrol)) modifiers |= MOD_CONTROL;
|
|
475 else if (EQ (sym, Qmeta)) modifiers |= MOD_META;
|
|
476 else if (EQ (sym, Qsuper)) modifiers |= MOD_SUPER;
|
|
477 else if (EQ (sym, Qhyper)) modifiers |= MOD_HYPER;
|
|
478 else if (EQ (sym, Qalt)) modifiers |= MOD_ALT;
|
|
479 else if (EQ (sym, Qsymbol)) modifiers |= MOD_ALT;
|
|
480 else if (EQ (sym, Qshift)) modifiers |= MOD_SHIFT;
|
|
481 else
|
|
482 signal_simple_error ("Invalid key modifier", Fcar (tail));
|
|
483 }
|
|
484 if (e->event_type == key_press_event)
|
|
485 e->event.key.modifiers = modifiers;
|
|
486 else if (e->event_type == button_press_event
|
|
487 || e->event_type == button_release_event)
|
|
488 e->event.button.modifiers = modifiers;
|
|
489 else /* pointer_motion_event */
|
|
490 e->event.motion.modifiers = modifiers;
|
|
491 }
|
|
492 else if (EQ (prop, Qx))
|
|
493 {
|
|
494 CHECK_NATNUM (val);
|
|
495 if (e->event_type == pointer_motion_event)
|
|
496 e->event.motion.x = XINT (val);
|
|
497 else if (e->event_type == button_press_event
|
|
498 || e->event_type == button_release_event)
|
|
499 e->event.button.x = XINT (val);
|
|
500 }
|
|
501 else if (EQ (prop, Qy))
|
|
502 {
|
|
503 CHECK_NATNUM (val);
|
|
504 if (e->event_type == pointer_motion_event)
|
|
505 e->event.motion.y = XINT (val);
|
|
506 else if (e->event_type == button_press_event
|
|
507 || e->event_type == button_release_event)
|
|
508 e->event.button.y = XINT (val);
|
|
509 }
|
|
510 else if (EQ (prop, Qtimestamp))
|
|
511 {
|
|
512 CHECK_NATNUM (val);
|
|
513 e->timestamp = XINT (val);
|
|
514 }
|
|
515 else
|
|
516 signal_simple_error ("Invalid property", prop);
|
|
517 } /* while */
|
|
518
|
|
519 /* Now, let's validate what we got. */
|
|
520 switch (e->event_type)
|
|
521 {
|
|
522 case key_press_event:
|
|
523 if (!(SYMBOLP (e->event.key.keysym) || CHARP (e->event.key.keysym)))
|
|
524 error ("Undefined key for keypress event");
|
|
525 break;
|
|
526 case button_press_event:
|
|
527 case button_release_event:
|
|
528 if (!e->event.button.button)
|
|
529 error ("Undefined button for button-press or button-release event");
|
|
530 if (NILP (EVENT_CHANNEL (e)))
|
|
531 error ("Undefined channel for button-press or button-release event");
|
|
532 break;
|
|
533 default:
|
|
534 break;
|
|
535 }
|
0
|
536 return event;
|
|
537 }
|
|
538
|
20
|
539 DEFUN ("deallocate-event", Fdeallocate_event, 1, 1, 0, /*
|
0
|
540 Allow the given event structure to be reused.
|
|
541 You MUST NOT use this event object after calling this function with it.
|
|
542 You will lose. It is not necessary to call this function, as event
|
|
543 objects are garbage-collected like all other objects; however, it may
|
|
544 be more efficient to explicitly deallocate events when you are sure
|
2
|
545 that it is safe to do so.
|
20
|
546 */
|
|
547 (event))
|
0
|
548 {
|
|
549 CHECK_EVENT (event);
|
|
550
|
|
551 if (XEVENT_TYPE (event) == dead_event)
|
|
552 error ("this event is already deallocated!");
|
|
553
|
|
554 assert (XEVENT_TYPE (event) <= last_event_type);
|
|
555
|
|
556 #if 0
|
173
|
557 {
|
|
558 int i, len;
|
0
|
559 extern Lisp_Object Vlast_command_event;
|
|
560 extern Lisp_Object Vlast_input_event, Vunread_command_event;
|
|
561 extern Lisp_Object Vthis_command_keys, Vrecent_keys_ring;
|
|
562
|
173
|
563 if (EQ (event, Vlast_command_event) ||
|
|
564 EQ (event, Vlast_input_event) ||
|
|
565 EQ (event, Vunread_command_event))
|
0
|
566 abort ();
|
173
|
567
|
|
568 len = XVECTOR_LENGTH (Vthis_command_keys);
|
|
569 for (i = 0; i < len; i++)
|
|
570 if (EQ (event, XVECTOR_DATA (Vthis_command_keys) [i]))
|
0
|
571 abort ();
|
153
|
572 if (!NILP (Vrecent_keys_ring))
|
|
573 {
|
173
|
574 int recent_ring_len = XVECTOR_LENGTH (Vrecent_keys_ring);
|
|
575 for (i = 0; i < recent_ring_len; i++)
|
|
576 if (EQ (event, XVECTOR_DATA (Vrecent_keys_ring) [i]))
|
153
|
577 abort ();
|
|
578 }
|
0
|
579 }
|
|
580 #endif /* 0 */
|
|
581
|
|
582 assert (!EQ (event, Vevent_resource));
|
|
583 deinitialize_event (event);
|
|
584 #ifndef ALLOC_NO_POOLS
|
|
585 XSET_EVENT_NEXT (event, Vevent_resource);
|
|
586 Vevent_resource = event;
|
|
587 #endif
|
|
588 return Qnil;
|
|
589 }
|
|
590
|
20
|
591 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /*
|
0
|
592 Make a copy of the given event object.
|
|
593 If a second argument is given, the first event is copied into the second
|
|
594 and the second is returned. If the second argument is not supplied (or
|
|
595 is nil) then a new event will be made as with `allocate-event.' See also
|
|
596 the function `deallocate-event'.
|
20
|
597 */
|
|
598 (event1, event2))
|
0
|
599 {
|
|
600 CHECK_LIVE_EVENT (event1);
|
|
601 if (NILP (event2))
|
189
|
602 event2 = Fmake_event (Qnil, Qnil);
|
0
|
603 else CHECK_LIVE_EVENT (event2);
|
|
604 if (EQ (event1, event2))
|
|
605 return signal_simple_continuable_error_2
|
|
606 ("copy-event called with `eq' events", event1, event2);
|
|
607
|
|
608 assert (XEVENT_TYPE (event1) <= last_event_type);
|
|
609 assert (XEVENT_TYPE (event2) <= last_event_type);
|
|
610
|
|
611 {
|
|
612 Lisp_Object save_next = XEVENT_NEXT (event2);
|
|
613
|
|
614 *XEVENT (event2) = *XEVENT (event1);
|
|
615 XSET_EVENT_NEXT (event2, save_next);
|
173
|
616 return event2;
|
0
|
617 }
|
|
618 }
|
|
619
|
|
620
|
|
621
|
|
622 /* Given a chain of events (or possibly nil), deallocate them all. */
|
|
623
|
|
624 void
|
|
625 deallocate_event_chain (Lisp_Object event_chain)
|
|
626 {
|
|
627 while (!NILP (event_chain))
|
|
628 {
|
|
629 Lisp_Object next = XEVENT_NEXT (event_chain);
|
|
630 Fdeallocate_event (event_chain);
|
|
631 event_chain = next;
|
|
632 }
|
|
633 }
|
|
634
|
|
635 /* Return the last event in a chain.
|
|
636 NOTE: You cannot pass nil as a value here! The routine will
|
|
637 abort if you do. */
|
|
638
|
|
639 Lisp_Object
|
|
640 event_chain_tail (Lisp_Object event_chain)
|
|
641 {
|
|
642 while (1)
|
|
643 {
|
|
644 Lisp_Object next = XEVENT_NEXT (event_chain);
|
|
645 if (NILP (next))
|
|
646 return event_chain;
|
|
647 event_chain = next;
|
|
648 }
|
|
649 }
|
|
650
|
|
651 /* Enqueue a single event onto the end of a chain of events.
|
|
652 HEAD points to the first event in the chain, TAIL to the last event.
|
|
653 If the chain is empty, both values should be nil. */
|
|
654
|
|
655 void
|
|
656 enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail)
|
|
657 {
|
|
658 assert (NILP (XEVENT_NEXT (event)));
|
|
659 assert (!EQ (*tail, event));
|
|
660
|
|
661 if (!NILP (*tail))
|
|
662 XSET_EVENT_NEXT (*tail, event);
|
|
663 else
|
|
664 *head = event;
|
|
665 *tail = event;
|
|
666
|
|
667 assert (!EQ (event, XEVENT_NEXT (event)));
|
|
668 }
|
|
669
|
|
670 /* Remove an event off the head of a chain of events and return it.
|
|
671 HEAD points to the first event in the chain, TAIL to the last event. */
|
173
|
672
|
0
|
673 Lisp_Object
|
|
674 dequeue_event (Lisp_Object *head, Lisp_Object *tail)
|
|
675 {
|
|
676 Lisp_Object event;
|
|
677
|
|
678 event = *head;
|
|
679 *head = XEVENT_NEXT (event);
|
|
680 XSET_EVENT_NEXT (event, Qnil);
|
|
681 if (NILP (*head))
|
|
682 *tail = Qnil;
|
|
683 return event;
|
|
684 }
|
|
685
|
|
686 /* Enqueue a chain of events (or possibly nil) onto the end of another
|
|
687 chain of events. HEAD points to the first event in the chain being
|
|
688 queued onto, TAIL to the last event. If the chain is empty, both values
|
|
689 should be nil. */
|
|
690
|
|
691 void
|
|
692 enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
|
|
693 Lisp_Object *tail)
|
|
694 {
|
|
695 if (NILP (event_chain))
|
|
696 return;
|
|
697
|
|
698 if (NILP (*head))
|
|
699 {
|
|
700 *head = event_chain;
|
|
701 *tail = event_chain;
|
|
702 }
|
|
703 else
|
|
704 {
|
|
705 XSET_EVENT_NEXT (*tail, event_chain);
|
|
706 *tail = event_chain_tail (event_chain);
|
|
707 }
|
|
708 }
|
|
709
|
|
710 /* Return the number of events (possibly 0) on an event chain. */
|
|
711
|
|
712 int
|
|
713 event_chain_count (Lisp_Object event_chain)
|
|
714 {
|
|
715 Lisp_Object event;
|
|
716 int n = 0;
|
|
717
|
|
718 EVENT_CHAIN_LOOP (event, event_chain)
|
|
719 n++;
|
|
720
|
|
721 return n;
|
|
722 }
|
|
723
|
|
724 /* Find the event before EVENT in an event chain. This aborts
|
|
725 if the event is not in the chain. */
|
|
726
|
|
727 Lisp_Object
|
|
728 event_chain_find_previous (Lisp_Object event_chain, Lisp_Object event)
|
|
729 {
|
|
730 Lisp_Object previous = Qnil;
|
|
731
|
|
732 while (!NILP (event_chain))
|
|
733 {
|
|
734 if (EQ (event_chain, event))
|
|
735 return previous;
|
|
736 previous = event_chain;
|
|
737 event_chain = XEVENT_NEXT (event_chain);
|
|
738 }
|
|
739
|
|
740 abort ();
|
|
741 return Qnil;
|
|
742 }
|
|
743
|
|
744 Lisp_Object
|
|
745 event_chain_nth (Lisp_Object event_chain, int n)
|
|
746 {
|
|
747 Lisp_Object event;
|
|
748 EVENT_CHAIN_LOOP (event, event_chain)
|
|
749 {
|
|
750 if (!n)
|
|
751 return event;
|
|
752 n--;
|
|
753 }
|
|
754 return Qnil;
|
|
755 }
|
|
756
|
|
757 Lisp_Object
|
|
758 copy_event_chain (Lisp_Object event_chain)
|
|
759 {
|
|
760 Lisp_Object new_chain = Qnil;
|
|
761 Lisp_Object new_chain_tail = Qnil;
|
|
762 Lisp_Object event;
|
|
763
|
|
764 EVENT_CHAIN_LOOP (event, event_chain)
|
|
765 {
|
|
766 Lisp_Object copy = Fcopy_event (event, Qnil);
|
|
767 enqueue_event (copy, &new_chain, &new_chain_tail);
|
|
768 }
|
|
769
|
|
770 return new_chain;
|
|
771 }
|
|
772
|
|
773
|
|
774
|
|
775 Lisp_Object QKbackspace, QKtab, QKlinefeed, QKreturn, QKescape,
|
|
776 QKspace, QKdelete;
|
|
777
|
|
778 int
|
|
779 command_event_p (Lisp_Object event)
|
|
780 {
|
|
781 switch (XEVENT_TYPE (event))
|
|
782 {
|
|
783 case key_press_event:
|
|
784 case button_press_event:
|
|
785 case button_release_event:
|
|
786 case misc_user_event:
|
199
|
787 #ifdef HAVE_OFFIX_DND
|
197
|
788 case dnd_drop_event:
|
199
|
789 #endif
|
173
|
790 return 1;
|
0
|
791 default:
|
173
|
792 return 0;
|
0
|
793 }
|
|
794 }
|
|
795
|
|
796
|
|
797 void
|
|
798 character_to_event (Emchar c, struct Lisp_Event *event, struct console *con,
|
|
799 int use_console_meta_flag)
|
|
800 {
|
|
801 Lisp_Object k = Qnil;
|
|
802 unsigned int m = 0;
|
|
803 if (event->event_type == dead_event)
|
|
804 error ("character-to-event called with a deallocated event!");
|
|
805
|
70
|
806 #ifndef MULE
|
0
|
807 c &= 255;
|
70
|
808 #endif
|
0
|
809 if (c > 127 && c <= 255)
|
|
810 {
|
|
811 int meta_flag = 1;
|
|
812 if (use_console_meta_flag && CONSOLE_TTY_P (con))
|
|
813 meta_flag = TTY_FLAGS (con).meta_key;
|
|
814 switch (meta_flag)
|
|
815 {
|
|
816 case 0: /* ignore top bit; it's parity */
|
|
817 c -= 128;
|
|
818 break;
|
|
819 case 1: /* top bit is meta */
|
|
820 c -= 128;
|
|
821 m = MOD_META;
|
|
822 break;
|
|
823 default: /* this is a real character */
|
|
824 break;
|
|
825 }
|
|
826 }
|
|
827 if (c < ' ') c += '@', m |= MOD_CONTROL;
|
|
828 if (m & MOD_CONTROL)
|
|
829 {
|
|
830 switch (c)
|
|
831 {
|
|
832 case 'I': k = QKtab; m &= ~MOD_CONTROL; break;
|
|
833 case 'J': k = QKlinefeed; m &= ~MOD_CONTROL; break;
|
|
834 case 'M': k = QKreturn; m &= ~MOD_CONTROL; break;
|
|
835 case '[': k = QKescape; m &= ~MOD_CONTROL; break;
|
|
836 # if 0
|
|
837 /* This is probably too controversial... */
|
|
838 case 'H': k = QKbackspace; m &= ~MOD_CONTROL; break;
|
|
839 # endif
|
|
840 }
|
|
841 if (c >= 'A' && c <= 'Z') c -= 'A'-'a';
|
|
842 }
|
|
843 else if (c == 127)
|
|
844 k = QKdelete;
|
|
845 else if (c == ' ')
|
|
846 k = QKspace;
|
173
|
847
|
2
|
848 event->event_type = key_press_event;
|
|
849 event->timestamp = 0; /* #### */
|
|
850 event->channel = make_console (con);
|
|
851 event->event.key.keysym = (!NILP (k) ? k : make_char (c));
|
|
852 event->event.key.modifiers = m;
|
0
|
853 }
|
|
854
|
|
855
|
|
856 /* This variable controls what character name -> character code mapping
|
|
857 we are using. Window-system-specific code sets this to some symbol,
|
|
858 and we use that symbol as the plist key to convert keysyms into 8-bit
|
|
859 codes. In this way one can have several character sets predefined and
|
|
860 switch them by changing this.
|
|
861 */
|
|
862 Lisp_Object Vcharacter_set_property;
|
|
863
|
|
864 Emchar
|
|
865 event_to_character (struct Lisp_Event *event,
|
|
866 int allow_extra_modifiers,
|
|
867 int allow_meta,
|
|
868 int allow_non_ascii)
|
|
869 {
|
|
870 Emchar c = 0;
|
|
871 Lisp_Object code;
|
|
872
|
|
873 if (event->event_type != key_press_event)
|
|
874 {
|
|
875 if (event->event_type == dead_event) abort ();
|
|
876 return -1;
|
|
877 }
|
|
878 if (!allow_extra_modifiers &&
|
|
879 event->event.key.modifiers & (MOD_SUPER|MOD_HYPER|MOD_ALT))
|
|
880 return -1;
|
|
881 if (CHAR_OR_CHAR_INTP (event->event.key.keysym))
|
|
882 c = XCHAR_OR_CHAR_INT (event->event.key.keysym);
|
|
883 else if (!SYMBOLP (event->event.key.keysym))
|
|
884 abort ();
|
|
885 else if (allow_non_ascii && !NILP (Vcharacter_set_property)
|
|
886 /* Allow window-system-specific extensibility of
|
|
887 keysym->code mapping */
|
|
888 && CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym,
|
|
889 Vcharacter_set_property,
|
|
890 Qnil)))
|
|
891 c = XCHAR_OR_CHAR_INT (code);
|
|
892 else if (CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym,
|
|
893 Qascii_character, Qnil)))
|
|
894 c = XCHAR_OR_CHAR_INT (code);
|
|
895 else
|
|
896 return -1;
|
|
897
|
|
898 if (event->event.key.modifiers & MOD_CONTROL)
|
|
899 {
|
|
900 if (c >= 'a' && c <= 'z')
|
|
901 c -= ('a' - 'A');
|
|
902 else
|
|
903 /* reject Control-Shift- keys */
|
|
904 if (c >= 'A' && c <= 'Z' && !allow_extra_modifiers)
|
|
905 return -1;
|
173
|
906
|
0
|
907 if (c >= '@' && c <= '_')
|
|
908 c -= '@';
|
|
909 else if (c == ' ') /* C-space and C-@ are the same. */
|
|
910 c = 0;
|
|
911 else
|
|
912 /* reject keys that can't take Control- modifiers */
|
|
913 if (! allow_extra_modifiers) return -1;
|
|
914 }
|
|
915
|
|
916 if (event->event.key.modifiers & MOD_META)
|
|
917 {
|
|
918 if (! allow_meta) return -1;
|
|
919 if (c & 0200) return -1; /* don't allow M-oslash (overlap) */
|
70
|
920 #ifdef MULE
|
|
921 if (c >= 256) return -1;
|
|
922 #endif
|
0
|
923 c |= 0200;
|
|
924 }
|
|
925 return c;
|
|
926 }
|
|
927
|
20
|
928 DEFUN ("event-to-character", Fevent_to_character, 1, 4, 0, /*
|
0
|
929 Return the closest ASCII approximation to the given event object.
|
|
930 If the event isn't a keypress, this returns nil.
|
|
931 If the ALLOW-EXTRA-MODIFIERS argument is non-nil, then this is lenient in
|
|
932 its translation; it will ignore modifier keys other than control and meta,
|
|
933 and will ignore the shift modifier on those characters which have no
|
|
934 shifted ASCII equivalent (Control-Shift-A for example, will be mapped to
|
|
935 the same ASCII code as Control-A).
|
|
936 If the ALLOW-META argument is non-nil, then the Meta modifier will be
|
|
937 represented by turning on the high bit of the byte returned; otherwise, nil
|
|
938 will be returned for events containing the Meta modifier.
|
|
939 If the ALLOW-NON-ASCII argument is non-nil, then characters which are
|
|
940 present in the prevailing character set (see the `character-set-property'
|
|
941 variable) will be returned as their code in that character set, instead of
|
|
942 the return value being restricted to ASCII.
|
|
943 Note that specifying both ALLOW-META and ALLOW-NON-ASCII is ambiguous, as
|
|
944 both use the high bit; `M-x' and `oslash' will be indistinguishable.
|
20
|
945 */
|
70
|
946 (event, allow_extra_modifiers, allow_meta, allow_non_ascii))
|
0
|
947 {
|
|
948 Emchar c;
|
|
949 CHECK_LIVE_EVENT (event);
|
|
950 c = event_to_character (XEVENT (event),
|
|
951 !NILP (allow_extra_modifiers),
|
|
952 !NILP (allow_meta),
|
|
953 !NILP (allow_non_ascii));
|
173
|
954 return c < 0 ? Qnil : make_char (c);
|
0
|
955 }
|
|
956
|
20
|
957 DEFUN ("character-to-event", Fcharacter_to_event, 1, 4, 0, /*
|
2
|
958 Converts a keystroke specifier into an event structure, replete with
|
0
|
959 bucky bits. The keystroke is the first argument, and the event to fill
|
|
960 in is the second. This function contains knowledge about what the codes
|
|
961 ``mean'' -- for example, the number 9 is converted to the character ``Tab'',
|
|
962 not the distinct character ``Control-I''.
|
|
963
|
|
964 Note that CH (the keystroke specifier) can be an integer, a character,
|
2
|
965 a symbol such as 'clear, or a list such as '(control backspace).
|
0
|
966
|
2
|
967 If the optional second argument is an event, it is modified;
|
|
968 otherwise, a new event object is created.
|
0
|
969
|
2
|
970 Optional third arg CONSOLE is the console to store in the event, and
|
|
971 defaults to the selected console.
|
0
|
972
|
|
973 If CH is an integer or character, the high bit may be interpreted as the
|
2
|
974 meta key. (This is done for backward compatibility in lots of places.)
|
|
975 If USE-CONSOLE-META-FLAG is nil, this will always be the case. If
|
|
976 USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for CONSOLE affects
|
|
977 whether the high bit is interpreted as a meta key. (See `set-input-mode'.)
|
|
978 If you don't want this silly meta interpretation done, you should pass
|
|
979 in a list containing the character.
|
0
|
980
|
|
981 Beware that character-to-event and event-to-character are not strictly
|
2
|
982 inverse functions, since events contain much more information than the
|
|
983 ASCII character set can encode.
|
20
|
984 */
|
|
985 (ch, event, console, use_console_meta_flag))
|
0
|
986 {
|
|
987 struct console *con = decode_console (console);
|
|
988 if (NILP (event))
|
189
|
989 event = Fmake_event (Qnil, Qnil);
|
0
|
990 else
|
|
991 CHECK_LIVE_EVENT (event);
|
|
992 if (CONSP (ch) || SYMBOLP (ch))
|
|
993 key_desc_list_to_event (ch, event, 1);
|
|
994 else
|
|
995 {
|
|
996 CHECK_CHAR_COERCE_INT (ch);
|
|
997 character_to_event (XCHAR (ch), XEVENT (event), con,
|
|
998 !NILP (use_console_meta_flag));
|
|
999 }
|
|
1000 return event;
|
|
1001 }
|
|
1002
|
|
1003 void
|
|
1004 nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event)
|
|
1005 {
|
|
1006 assert (STRINGP (seq) || VECTORP (seq));
|
|
1007 assert (n < XINT (Flength (seq)));
|
|
1008
|
|
1009 if (STRINGP (seq))
|
|
1010 {
|
|
1011 Emchar ch = string_char (XSTRING (seq), n);
|
|
1012 Fcharacter_to_event (make_char (ch), event, Qnil, Qnil);
|
|
1013 }
|
|
1014 else
|
|
1015 {
|
173
|
1016 Lisp_Object keystroke = XVECTOR_DATA (seq)[n];
|
0
|
1017 if (EVENTP (keystroke))
|
|
1018 Fcopy_event (keystroke, event);
|
|
1019 else
|
|
1020 Fcharacter_to_event (keystroke, event, Qnil, Qnil);
|
|
1021 }
|
|
1022 }
|
|
1023
|
|
1024 Lisp_Object
|
|
1025 key_sequence_to_event_chain (Lisp_Object seq)
|
|
1026 {
|
|
1027 int len = XINT (Flength (seq));
|
|
1028 int i;
|
|
1029 Lisp_Object head = Qnil, tail = Qnil;
|
|
1030
|
|
1031 for (i = 0; i < len; i++)
|
|
1032 {
|
189
|
1033 Lisp_Object event = Fmake_event (Qnil, Qnil);
|
0
|
1034 nth_of_key_sequence_as_event (seq, i, event);
|
|
1035 enqueue_event (event, &head, &tail);
|
|
1036 }
|
|
1037
|
|
1038 return head;
|
|
1039 }
|
|
1040
|
|
1041 void
|
|
1042 format_event_object (char *buf, struct Lisp_Event *event, int brief)
|
|
1043 {
|
|
1044 int mouse_p = 0;
|
|
1045 int mod = 0;
|
|
1046 Lisp_Object key;
|
197
|
1047 #ifdef HAVE_OFFIX_DND
|
|
1048 int dnd_p = 0;
|
|
1049 #endif
|
0
|
1050
|
|
1051 switch (event->event_type)
|
|
1052 {
|
|
1053 case key_press_event:
|
|
1054 {
|
|
1055 mod = event->event.key.modifiers;
|
|
1056 key = event->event.key.keysym;
|
|
1057 /* Hack. */
|
|
1058 if (! brief && CHARP (key) &&
|
|
1059 mod & (MOD_CONTROL | MOD_META | MOD_SUPER | MOD_HYPER))
|
|
1060 {
|
|
1061 int k = XCHAR (key);
|
|
1062 if (k >= 'a' && k <= 'z')
|
|
1063 key = make_char (k - ('a' - 'A'));
|
|
1064 else if (k >= 'A' && k <= 'Z')
|
|
1065 mod |= MOD_SHIFT;
|
|
1066 }
|
|
1067 break;
|
|
1068 }
|
|
1069 case button_release_event:
|
|
1070 mouse_p++;
|
|
1071 /* Fall through */
|
|
1072 case button_press_event:
|
|
1073 {
|
|
1074 mouse_p++;
|
|
1075 mod = event->event.button.modifiers;
|
|
1076 key = make_char (event->event.button.button + '0');
|
|
1077 break;
|
|
1078 }
|
|
1079 case magic_event:
|
|
1080 {
|
183
|
1081 CONST char *name = NULL;
|
0
|
1082
|
|
1083 #ifdef HAVE_X_WINDOWS
|
183
|
1084 {
|
|
1085 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event));
|
|
1086 if (CONSOLE_X_P (XCONSOLE (console)))
|
|
1087 name = x_event_name (event->event.magic.underlying_x_event.type);
|
|
1088 }
|
|
1089 #endif /* HAVE_X_WINDOWS */
|
0
|
1090 if (name) strcpy (buf, name);
|
|
1091 else strcpy (buf, "???");
|
|
1092 return;
|
|
1093 }
|
197
|
1094 #ifdef HAVE_OFFIX_DND
|
|
1095 case dnd_drop_event:
|
|
1096 {
|
|
1097 dnd_p++;
|
|
1098 mod = event->event.dnd_drop.modifiers;
|
|
1099 key = make_char (event->event.dnd_drop.button + '0');
|
|
1100 break;
|
|
1101 }
|
|
1102 #endif
|
0
|
1103 case magic_eval_event: strcpy (buf, "magic-eval"); return;
|
183
|
1104 case pointer_motion_event: strcpy (buf, "motion"); return;
|
|
1105 case misc_user_event: strcpy (buf, "misc-user"); return;
|
|
1106 case eval_event: strcpy (buf, "eval"); return;
|
|
1107 case process_event: strcpy (buf, "process"); return;
|
|
1108 case timeout_event: strcpy (buf, "timeout"); return;
|
|
1109 case empty_event: strcpy (buf, "empty"); return;
|
|
1110 case dead_event: strcpy (buf, "DEAD-EVENT"); return;
|
0
|
1111 default:
|
|
1112 abort ();
|
|
1113 }
|
|
1114 #define modprint1(x) { strcpy (buf, (x)); buf += sizeof (x)-1; }
|
|
1115 #define modprint(x,y) { if (brief) modprint1 (y) else modprint1 (x) }
|
|
1116 if (mod & MOD_CONTROL) modprint ("control-", "C-");
|
|
1117 if (mod & MOD_META) modprint ("meta-", "M-");
|
|
1118 if (mod & MOD_SUPER) modprint ("super-", "S-");
|
|
1119 if (mod & MOD_HYPER) modprint ("hyper-", "H-");
|
|
1120 if (mod & MOD_ALT) modprint ("alt-", "A-");
|
|
1121 if (mod & MOD_SHIFT) modprint ("shift-", "Sh-");
|
|
1122 if (mouse_p)
|
|
1123 {
|
|
1124 modprint1 ("button");
|
|
1125 --mouse_p;
|
|
1126 }
|
197
|
1127
|
|
1128 #ifdef HAVE_OFFIX_DND
|
|
1129 switch (dnd_p)
|
|
1130 {
|
|
1131 case 1:
|
|
1132 modprint1 ("drop");
|
|
1133 }
|
|
1134 #endif
|
|
1135
|
0
|
1136 #undef modprint
|
|
1137 #undef modprint1
|
|
1138
|
|
1139 if (CHARP (key))
|
|
1140 {
|
|
1141 buf += set_charptr_emchar ((Bufbyte *) buf, XCHAR (key));
|
|
1142 *buf = 0;
|
|
1143 }
|
|
1144 else if (SYMBOLP (key))
|
|
1145 {
|
|
1146 CONST char *str = 0;
|
|
1147 if (brief)
|
|
1148 {
|
|
1149 if (EQ (key, QKlinefeed)) str = "LFD";
|
|
1150 else if (EQ (key, QKtab)) str = "TAB";
|
|
1151 else if (EQ (key, QKreturn)) str = "RET";
|
|
1152 else if (EQ (key, QKescape)) str = "ESC";
|
|
1153 else if (EQ (key, QKdelete)) str = "DEL";
|
|
1154 else if (EQ (key, QKspace)) str = "SPC";
|
|
1155 else if (EQ (key, QKbackspace)) str = "BS";
|
|
1156 }
|
|
1157 if (str)
|
|
1158 {
|
|
1159 int i = strlen (str);
|
|
1160 memcpy (buf, str, i+1);
|
|
1161 str += i;
|
|
1162 }
|
|
1163 else
|
|
1164 {
|
183
|
1165 struct Lisp_String *name = XSYMBOL (key)->name;
|
|
1166 memcpy (buf, string_data (name), string_length (name) + 1);
|
|
1167 str += string_length (name);
|
0
|
1168 }
|
|
1169 }
|
|
1170 else
|
|
1171 abort ();
|
|
1172 if (mouse_p)
|
|
1173 strncpy (buf, "up", 4);
|
|
1174 }
|
|
1175
|
20
|
1176 DEFUN ("eventp", Feventp, 1, 1, 0, /*
|
0
|
1177 True if OBJECT is an event object.
|
20
|
1178 */
|
|
1179 (object))
|
0
|
1180 {
|
149
|
1181 return EVENTP (object) ? Qt : Qnil;
|
0
|
1182 }
|
|
1183
|
20
|
1184 DEFUN ("event-live-p", Fevent_live_p, 1, 1, 0, /*
|
0
|
1185 True if OBJECT is an event object that has not been deallocated.
|
20
|
1186 */
|
|
1187 (object))
|
0
|
1188 {
|
149
|
1189 return EVENTP (object) && XEVENT (object)->event_type != dead_event ?
|
|
1190 Qt : Qnil;
|
0
|
1191 }
|
|
1192
|
|
1193 #if 0 /* debugging functions */
|
|
1194
|
149
|
1195 xxDEFUN ("event-next", Fevent_next, 1, 1, 0, /*
|
0
|
1196 Return the event object's `next' event, or nil if it has none.
|
|
1197 The `next-event' field is changed by calling `set-next-event'.
|
149
|
1198 */
|
|
1199 (event))
|
0
|
1200 {
|
|
1201 struct Lisp_Event *e;
|
|
1202 CHECK_LIVE_EVENT (event);
|
|
1203
|
|
1204 return XEVENT_NEXT (event);
|
|
1205 }
|
|
1206
|
149
|
1207 xxDEFUN ("set-event-next", Fset_event_next, 2, 2, 0, /*
|
0
|
1208 Set the `next event' of EVENT to NEXT-EVENT.
|
|
1209 NEXT-EVENT must be an event object or nil.
|
149
|
1210 */
|
|
1211 (event, next_event))
|
0
|
1212 {
|
|
1213 Lisp_Object ev;
|
|
1214
|
|
1215 CHECK_LIVE_EVENT (event);
|
|
1216 if (NILP (next_event))
|
|
1217 {
|
|
1218 XSET_EVENT_NEXT (event, Qnil);
|
173
|
1219 return Qnil;
|
0
|
1220 }
|
|
1221
|
|
1222 CHECK_LIVE_EVENT (next_event);
|
|
1223
|
|
1224 EVENT_CHAIN_LOOP (ev, XEVENT_NEXT (event))
|
|
1225 {
|
|
1226 QUIT;
|
|
1227 if (EQ (ev, event))
|
173
|
1228 signal_error (Qerror,
|
0
|
1229 list3 (build_string ("Cyclic event-next"),
|
173
|
1230 event,
|
0
|
1231 next_event));
|
|
1232 }
|
|
1233 XSET_EVENT_NEXT (event, next_event);
|
149
|
1234 return next_event;
|
0
|
1235 }
|
|
1236
|
|
1237 #endif /* 0 */
|
|
1238
|
20
|
1239 DEFUN ("event-type", Fevent_type, 1, 1, 0, /*
|
0
|
1240 Return the type of EVENT.
|
|
1241 This will be a symbol; one of
|
|
1242
|
|
1243 key-press A key was pressed.
|
|
1244 button-press A mouse button was pressed.
|
|
1245 button-release A mouse button was released.
|
|
1246 misc-user Some other user action happened; typically, this is
|
|
1247 a menu selection or scrollbar action.
|
|
1248 motion The mouse moved.
|
|
1249 process Input is available from a subprocess.
|
|
1250 timeout A timeout has expired.
|
|
1251 eval This causes a specified action to occur when dispatched.
|
|
1252 magic Some window-system-specific event has occurred.
|
122
|
1253 empty The event has been allocated but not assigned.
|
|
1254
|
20
|
1255 */
|
|
1256 (event))
|
0
|
1257 {
|
|
1258 CHECK_LIVE_EVENT (event);
|
|
1259 switch (XEVENT (event)->event_type)
|
|
1260 {
|
149
|
1261 case key_press_event: return Qkey_press;
|
|
1262 case button_press_event: return Qbutton_press;
|
|
1263 case button_release_event: return Qbutton_release;
|
|
1264 case misc_user_event: return Qmisc_user;
|
|
1265 case pointer_motion_event: return Qmotion;
|
|
1266 case process_event: return Qprocess;
|
|
1267 case timeout_event: return Qtimeout;
|
|
1268 case eval_event: return Qeval;
|
199
|
1269 #ifdef HAVE_OFFIX_DND
|
197
|
1270 case dnd_drop_event: return Qdnd_drop;
|
199
|
1271 #endif
|
0
|
1272 case magic_event:
|
|
1273 case magic_eval_event:
|
|
1274 return Qmagic;
|
|
1275
|
122
|
1276 case empty_event:
|
|
1277 return Qempty;
|
|
1278
|
0
|
1279 default:
|
|
1280 abort ();
|
|
1281 return Qnil;
|
|
1282 }
|
|
1283 }
|
|
1284
|
20
|
1285 DEFUN ("event-timestamp", Fevent_timestamp, 1, 1, 0, /*
|
149
|
1286 Return the timestamp of the event object EVENT.
|
20
|
1287 */
|
|
1288 (event))
|
0
|
1289 {
|
|
1290 CHECK_LIVE_EVENT (event);
|
|
1291 /* This junk is so that timestamps don't get to be negative, but contain
|
|
1292 as many bits as this particular emacs will allow.
|
|
1293 */
|
|
1294 return make_int (((1L << (VALBITS - 1)) - 1) &
|
|
1295 XEVENT (event)->timestamp);
|
|
1296 }
|
|
1297
|
185
|
1298 #define CHECK_EVENT_TYPE(e,t1,sym) do { \
|
|
1299 CHECK_LIVE_EVENT (e); \
|
0
|
1300 if (XEVENT(e)->event_type != (t1)) \
|
185
|
1301 e = wrong_type_argument ((sym),(e)); \
|
|
1302 } while (0)
|
0
|
1303
|
185
|
1304 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \
|
|
1305 CHECK_LIVE_EVENT (e); \
|
|
1306 if (XEVENT(e)->event_type != (t1) && \
|
|
1307 XEVENT(e)->event_type != (t2)) \
|
|
1308 e = wrong_type_argument ((sym),(e)); \
|
|
1309 } while (0)
|
0
|
1310
|
20
|
1311 DEFUN ("event-key", Fevent_key, 1, 1, 0, /*
|
149
|
1312 Return the Keysym of the key-press event EVENT.
|
|
1313 This will be a character if the event is associated with one, else a symbol.
|
20
|
1314 */
|
|
1315 (event))
|
0
|
1316 {
|
|
1317 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p);
|
149
|
1318 return XEVENT (event)->event.key.keysym;
|
0
|
1319 }
|
|
1320
|
20
|
1321 DEFUN ("event-button", Fevent_button, 1, 1, 0, /*
|
149
|
1322 Return the button-number of the given button-press or button-release event.
|
20
|
1323 */
|
|
1324 (event))
|
0
|
1325 {
|
197
|
1326 #ifndef HAVE_OFFIX_DND
|
|
1327
|
0
|
1328 CHECK_EVENT_TYPE2 (event, button_press_event, button_release_event,
|
|
1329 Qbutton_event_p);
|
|
1330 #ifdef HAVE_WINDOW_SYSTEM
|
|
1331 return make_int (XEVENT (event)->event.button.button);
|
|
1332 #else /* !HAVE_WINDOW_SYSTEM */
|
|
1333 return Qzero;
|
|
1334 #endif /* !HAVE_WINDOW_SYSTEM */
|
197
|
1335
|
|
1336 #else /* HAVE_OFFIX_DND */
|
|
1337
|
|
1338 CHECK_LIVE_EVENT (event);
|
|
1339 if (XEVENT(event)->event_type == (button_press_event) ||
|
|
1340 XEVENT(event)->event_type == (button_release_event))
|
|
1341 /* we always have X if we have OffiX !! */
|
|
1342 return make_int (XEVENT (event)->event.button.button);
|
|
1343 else if (XEVENT(event)->event_type == (dnd_drop_event))
|
|
1344 /* we always have X if we have OffiX !! */
|
|
1345 return make_int (XEVENT (event)->event.button.button);
|
|
1346 else
|
|
1347 event = wrong_type_argument ((Qbutton_event_p),(event));
|
|
1348
|
|
1349 #endif
|
0
|
1350 }
|
|
1351
|
20
|
1352 DEFUN ("event-modifier-bits", Fevent_modifier_bits, 1, 1, 0, /*
|
0
|
1353 Return a number representing the modifier keys which were down
|
183
|
1354 when the given mouse or keyboard event was produced.
|
|
1355 See also the function event-modifiers.
|
20
|
1356 */
|
|
1357 (event))
|
0
|
1358 {
|
|
1359 again:
|
|
1360 CHECK_LIVE_EVENT (event);
|
183
|
1361 switch (XEVENT (event)->event_type)
|
0
|
1362 {
|
183
|
1363 case key_press_event:
|
|
1364 return make_int (XEVENT (event)->event.key.modifiers);
|
|
1365 case button_press_event:
|
|
1366 case button_release_event:
|
|
1367 return make_int (XEVENT (event)->event.button.modifiers);
|
|
1368 case pointer_motion_event:
|
|
1369 return make_int (XEVENT (event)->event.motion.modifiers);
|
197
|
1370 #ifdef HAVE_OFFIX_DND
|
|
1371 case dnd_drop_event:
|
|
1372 return make_int (XEVENT (event)->event.dnd_drop.modifiers);
|
|
1373 #endif
|
183
|
1374 default:
|
0
|
1375 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event);
|
|
1376 goto again;
|
|
1377 }
|
|
1378 }
|
|
1379
|
20
|
1380 DEFUN ("event-modifiers", Fevent_modifiers, 1, 1, 0, /*
|
0
|
1381 Return a list of symbols, the names of the modifier keys
|
|
1382 which were down when the given mouse or keyboard event was produced.
|
|
1383 See also the function event-modifier-bits.
|
20
|
1384 */
|
|
1385 (event))
|
0
|
1386 {
|
|
1387 int mod = XINT (Fevent_modifier_bits (event));
|
|
1388 Lisp_Object result = Qnil;
|
|
1389 if (mod & MOD_SHIFT) result = Fcons (Qshift, result);
|
|
1390 if (mod & MOD_ALT) result = Fcons (Qalt, result);
|
|
1391 if (mod & MOD_HYPER) result = Fcons (Qhyper, result);
|
|
1392 if (mod & MOD_SUPER) result = Fcons (Qsuper, result);
|
|
1393 if (mod & MOD_META) result = Fcons (Qmeta, result);
|
|
1394 if (mod & MOD_CONTROL) result = Fcons (Qcontrol, result);
|
|
1395 return result;
|
|
1396 }
|
|
1397
|
|
1398 static int
|
|
1399 event_x_y_pixel_internal (Lisp_Object event, int *x, int *y, int relative)
|
|
1400 {
|
|
1401 struct window *w;
|
|
1402 struct frame *f;
|
|
1403
|
|
1404 if (XEVENT (event)->event_type == pointer_motion_event)
|
|
1405 {
|
|
1406 *x = XEVENT (event)->event.motion.x;
|
|
1407 *y = XEVENT (event)->event.motion.y;
|
|
1408 }
|
|
1409 else if (XEVENT (event)->event_type == button_press_event ||
|
|
1410 XEVENT (event)->event_type == button_release_event)
|
|
1411 {
|
|
1412 *x = XEVENT (event)->event.button.x;
|
|
1413 *y = XEVENT (event)->event.button.y;
|
|
1414 }
|
197
|
1415 #ifdef HAVE_OFFIX_DND
|
|
1416 else if (XEVENT (event)->event_type == dnd_drop_event)
|
|
1417 {
|
|
1418 *x = XEVENT (event)->event.dnd_drop.x;
|
|
1419 *y = XEVENT (event)->event.dnd_drop.y;
|
|
1420 }
|
|
1421 #endif
|
0
|
1422 else
|
|
1423 return 0;
|
|
1424
|
|
1425 f = XFRAME (EVENT_CHANNEL (XEVENT (event)));
|
|
1426
|
|
1427 if (relative)
|
|
1428 {
|
|
1429 w = find_window_by_pixel_pos (*x, *y, f->root_window);
|
|
1430
|
|
1431 if (!w)
|
|
1432 return 1; /* #### What should really happen here. */
|
|
1433
|
|
1434 *x -= w->pixel_left;
|
|
1435 *y -= w->pixel_top;
|
|
1436 }
|
|
1437 else
|
|
1438 {
|
|
1439 *y -= FRAME_REAL_TOP_TOOLBAR_HEIGHT (f);
|
|
1440 *x -= FRAME_REAL_LEFT_TOOLBAR_WIDTH (f);
|
|
1441 }
|
|
1442
|
|
1443 return 1;
|
|
1444 }
|
|
1445
|
20
|
1446 DEFUN ("event-window-x-pixel", Fevent_window_x_pixel, 1, 1, 0, /*
|
149
|
1447 Return the X position in pixels of mouse event EVENT.
|
0
|
1448 The value returned is relative to the window the event occurred in.
|
149
|
1449 This will signal an error if the event is not a mouse event.
|
|
1450 See also `mouse-event-p' and `event-x-pixel'.
|
20
|
1451 */
|
|
1452 (event))
|
0
|
1453 {
|
|
1454 int x, y;
|
|
1455
|
|
1456 CHECK_LIVE_EVENT (event);
|
|
1457
|
|
1458 if (!event_x_y_pixel_internal (event, &x, &y, 1))
|
|
1459 return wrong_type_argument (Qmouse_event_p, event);
|
|
1460 else
|
|
1461 return make_int (x);
|
|
1462 }
|
|
1463
|
20
|
1464 DEFUN ("event-window-y-pixel", Fevent_window_y_pixel, 1, 1, 0, /*
|
149
|
1465 Return the Y position in pixels of mouse event EVENT.
|
0
|
1466 The value returned is relative to the window the event occurred in.
|
149
|
1467 This will signal an error if the event is not a mouse event.
|
|
1468 See also `mouse-event-p' and `event-y-pixel'.
|
20
|
1469 */
|
|
1470 (event))
|
0
|
1471 {
|
|
1472 int x, y;
|
|
1473
|
|
1474 CHECK_LIVE_EVENT (event);
|
|
1475
|
|
1476 if (!event_x_y_pixel_internal (event, &x, &y, 1))
|
|
1477 return wrong_type_argument (Qmouse_event_p, event);
|
|
1478 else
|
|
1479 return make_int (y);
|
|
1480 }
|
|
1481
|
20
|
1482 DEFUN ("event-x-pixel", Fevent_x_pixel, 1, 1, 0, /*
|
149
|
1483 Return the X position in pixels of mouse event EVENT.
|
0
|
1484 The value returned is relative to the frame the event occurred in.
|
149
|
1485 This will signal an error if the event is not a mouse event.
|
|
1486 See also `mouse-event-p' and `event-window-x-pixel'.
|
20
|
1487 */
|
|
1488 (event))
|
0
|
1489 {
|
|
1490 int x, y;
|
|
1491
|
|
1492 CHECK_LIVE_EVENT (event);
|
|
1493
|
|
1494 if (!event_x_y_pixel_internal (event, &x, &y, 0))
|
|
1495 return wrong_type_argument (Qmouse_event_p, event);
|
|
1496 else
|
|
1497 return make_int (x);
|
|
1498 }
|
|
1499
|
20
|
1500 DEFUN ("event-y-pixel", Fevent_y_pixel, 1, 1, 0, /*
|
149
|
1501 Return the Y position in pixels of mouse event EVENT.
|
0
|
1502 The value returned is relative to the frame the event occurred in.
|
149
|
1503 This will signal an error if the event is not a mouse event.
|
|
1504 See also `mouse-event-p' `event-window-y-pixel'.
|
20
|
1505 */
|
|
1506 (event))
|
0
|
1507 {
|
|
1508 int x, y;
|
|
1509
|
|
1510 CHECK_LIVE_EVENT (event);
|
|
1511
|
|
1512 if (!event_x_y_pixel_internal (event, &x, &y, 0))
|
|
1513 return wrong_type_argument (Qmouse_event_p, event);
|
|
1514 else
|
|
1515 return make_int (y);
|
|
1516 }
|
|
1517
|
|
1518 /* Given an event, return a value:
|
|
1519
|
|
1520 OVER_TOOLBAR: over one of the 4 frame toolbars
|
|
1521 OVER_MODELINE: over a modeline
|
|
1522 OVER_BORDER: over an internal border
|
|
1523 OVER_NOTHING: over the text area, but not over text
|
|
1524 OVER_OUTSIDE: outside of the frame border
|
|
1525 OVER_TEXT: over text in the text area
|
|
1526
|
|
1527 and return:
|
|
1528
|
|
1529 The X char position in CHAR_X, if not a null pointer.
|
|
1530 The Y char position in CHAR_Y, if not a null pointer.
|
|
1531 (These last two values are relative to the window the event is over.)
|
|
1532 The window it's over in W, if not a null pointer.
|
|
1533 The buffer position it's over in BUFP, if not a null pointer.
|
|
1534 The closest buffer position in CLOSEST, if not a null pointer.
|
|
1535
|
|
1536 OBJ_X, OBJ_Y, OBJ1, and OBJ2 are as in pixel_to_glyph_translation().
|
|
1537 */
|
173
|
1538
|
0
|
1539 static int
|
|
1540 event_pixel_translation (Lisp_Object event, int *char_x, int *char_y,
|
|
1541 int *obj_x, int *obj_y,
|
|
1542 struct window **w, Bufpos *bufp, Bufpos *closest,
|
|
1543 Charcount *modeline_closest,
|
|
1544 Lisp_Object *obj1, Lisp_Object *obj2)
|
|
1545 {
|
|
1546 int pix_x = 0;
|
|
1547 int pix_y = 0;
|
|
1548 int result;
|
173
|
1549 Lisp_Object frame = Qnil;
|
0
|
1550
|
|
1551 int ret_x, ret_y, ret_obj_x, ret_obj_y;
|
|
1552 struct window *ret_w;
|
|
1553 Bufpos ret_bufp, ret_closest;
|
|
1554 Charcount ret_modeline_closest;
|
|
1555 Lisp_Object ret_obj1, ret_obj2;
|
173
|
1556
|
0
|
1557 CHECK_LIVE_EVENT (event);
|
173
|
1558 frame = XEVENT (event)->channel;
|
|
1559 switch (XEVENT (event)->event_type)
|
0
|
1560 {
|
173
|
1561 case pointer_motion_event :
|
0
|
1562 pix_x = XEVENT (event)->event.motion.x;
|
|
1563 pix_y = XEVENT (event)->event.motion.y;
|
173
|
1564 break;
|
|
1565 case button_press_event :
|
|
1566 case button_release_event :
|
0
|
1567 pix_x = XEVENT (event)->event.button.x;
|
|
1568 pix_y = XEVENT (event)->event.button.y;
|
173
|
1569 break;
|
197
|
1570 #ifdef HAVE_OFFIX_DND
|
|
1571 case dnd_drop_event :
|
|
1572 pix_x = XEVENT (event)->event.dnd_drop.x;
|
|
1573 pix_y = XEVENT (event)->event.dnd_drop.y;
|
|
1574 break;
|
|
1575 #endif
|
173
|
1576 default:
|
|
1577 dead_wrong_type_argument (Qmouse_event_p, event);
|
0
|
1578 }
|
|
1579
|
|
1580 result = pixel_to_glyph_translation (XFRAME (frame), pix_x, pix_y,
|
|
1581 &ret_x, &ret_y, &ret_obj_x, &ret_obj_y,
|
|
1582 &ret_w, &ret_bufp, &ret_closest,
|
|
1583 &ret_modeline_closest,
|
|
1584 &ret_obj1, &ret_obj2);
|
|
1585
|
|
1586 if (result == OVER_NOTHING || result == OVER_OUTSIDE)
|
|
1587 ret_bufp = 0;
|
|
1588 else if (ret_w && NILP (ret_w->buffer))
|
|
1589 /* Why does this happen? (Does it still happen?)
|
|
1590 I guess the window has gotten reused as a non-leaf... */
|
|
1591 ret_w = 0;
|
|
1592
|
|
1593 /* #### pixel_to_glyph_translation() sometimes returns garbage...
|
185
|
1594 The word has type Lisp_Type_Record (presumably meaning `extent') but the
|
0
|
1595 pointer points to random memory, often filled with 0, sometimes not.
|
|
1596 */
|
|
1597 /* #### Chuck, do we still need this crap? */
|
|
1598 if (!NILP (ret_obj1) && !(GLYPHP (ret_obj1)
|
|
1599 #ifdef HAVE_TOOLBARS
|
|
1600 || TOOLBAR_BUTTONP (ret_obj1)
|
|
1601 #endif
|
|
1602 ))
|
|
1603 abort ();
|
173
|
1604 if (!NILP (ret_obj2) && !(EXTENTP (ret_obj2) || CONSP (ret_obj2)))
|
0
|
1605 abort ();
|
|
1606
|
|
1607 if (char_x)
|
|
1608 *char_x = ret_x;
|
|
1609 if (char_y)
|
|
1610 *char_y = ret_y;
|
|
1611 if (obj_x)
|
|
1612 *obj_x = ret_obj_x;
|
|
1613 if (obj_y)
|
|
1614 *obj_y = ret_obj_y;
|
|
1615 if (w)
|
|
1616 *w = ret_w;
|
|
1617 if (bufp)
|
|
1618 *bufp = ret_bufp;
|
|
1619 if (closest)
|
|
1620 *closest = ret_closest;
|
|
1621 if (modeline_closest)
|
|
1622 *modeline_closest = ret_modeline_closest;
|
|
1623 if (obj1)
|
|
1624 *obj1 = ret_obj1;
|
|
1625 if (obj2)
|
|
1626 *obj2 = ret_obj2;
|
|
1627
|
|
1628 return result;
|
|
1629 }
|
|
1630
|
20
|
1631 DEFUN ("event-over-text-area-p", Fevent_over_text_area_p, 1, 1, 0, /*
|
149
|
1632 Return t if the mouse event EVENT occurred over the text area of a window.
|
0
|
1633 The modeline is not considered to be part of the text area.
|
20
|
1634 */
|
|
1635 (event))
|
0
|
1636 {
|
|
1637 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1638
|
149
|
1639 return result == OVER_TEXT || result == OVER_NOTHING ? Qt : Qnil;
|
0
|
1640 }
|
|
1641
|
20
|
1642 DEFUN ("event-over-modeline-p", Fevent_over_modeline_p, 1, 1, 0, /*
|
149
|
1643 Return t if the mouse event EVENT occurred over the modeline of a window.
|
20
|
1644 */
|
|
1645 (event))
|
0
|
1646 {
|
|
1647 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1648
|
149
|
1649 return result == OVER_MODELINE ? Qt : Qnil;
|
0
|
1650 }
|
|
1651
|
20
|
1652 DEFUN ("event-over-border-p", Fevent_over_border_p, 1, 1, 0, /*
|
149
|
1653 Return t if the mouse event EVENT occurred over an internal border.
|
20
|
1654 */
|
|
1655 (event))
|
0
|
1656 {
|
|
1657 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1658
|
149
|
1659 return result == OVER_BORDER ? Qt : Qnil;
|
0
|
1660 }
|
|
1661
|
20
|
1662 DEFUN ("event-over-toolbar-p", Fevent_over_toolbar_p, 1, 1, 0, /*
|
149
|
1663 Return t if the mouse event EVENT occurred over a toolbar.
|
20
|
1664 */
|
|
1665 (event))
|
0
|
1666 {
|
|
1667 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1668
|
149
|
1669 return result == OVER_TOOLBAR ? Qt : Qnil;
|
0
|
1670 }
|
|
1671
|
|
1672 struct console *
|
|
1673 event_console_or_selected (Lisp_Object event)
|
|
1674 {
|
|
1675 Lisp_Object channel = EVENT_CHANNEL (XEVENT (event));
|
|
1676 Lisp_Object console = CDFW_CONSOLE (channel);
|
|
1677
|
|
1678 if (NILP (console))
|
|
1679 console = Vselected_console;
|
|
1680
|
|
1681 return XCONSOLE (console);
|
|
1682 }
|
|
1683
|
20
|
1684 DEFUN ("event-channel", Fevent_channel, 1, 1, 0, /*
|
149
|
1685 Return the channel that the event EVENT occurred on.
|
0
|
1686 This will be a frame, device, console, or nil for some types
|
|
1687 of events (e.g. eval events).
|
20
|
1688 */
|
|
1689 (event))
|
0
|
1690 {
|
|
1691 CHECK_LIVE_EVENT (event);
|
|
1692 return EVENT_CHANNEL (XEVENT (event));
|
|
1693 }
|
|
1694
|
20
|
1695 DEFUN ("event-window", Fevent_window, 1, 1, 0, /*
|
149
|
1696 Return the window over which mouse event EVENT occurred.
|
0
|
1697 This may be nil if the event occurred in the border or over a toolbar.
|
149
|
1698 The modeline is considered to be within the window it describes.
|
20
|
1699 */
|
|
1700 (event))
|
0
|
1701 {
|
|
1702 struct window *w;
|
|
1703
|
|
1704 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, 0, 0);
|
|
1705
|
|
1706 if (!w)
|
|
1707 return Qnil;
|
|
1708 else
|
|
1709 {
|
149
|
1710 Lisp_Object window;
|
|
1711
|
0
|
1712 XSETWINDOW (window, w);
|
|
1713 return window;
|
|
1714 }
|
|
1715 }
|
|
1716
|
20
|
1717 DEFUN ("event-point", Fevent_point, 1, 1, 0, /*
|
149
|
1718 Return the character position of the mouse event EVENT.
|
0
|
1719 If the event did not occur over a window, or did not occur over text,
|
149
|
1720 then this returns nil. Otherwise, it returns a position in the buffer
|
0
|
1721 visible in the event's window.
|
20
|
1722 */
|
|
1723 (event))
|
0
|
1724 {
|
|
1725 Bufpos bufp;
|
|
1726 struct window *w;
|
|
1727
|
|
1728 event_pixel_translation (event, 0, 0, 0, 0, &w, &bufp, 0, 0, 0, 0);
|
|
1729
|
149
|
1730 return w && bufp ? make_int (bufp) : Qnil;
|
0
|
1731 }
|
|
1732
|
20
|
1733 DEFUN ("event-closest-point", Fevent_closest_point, 1, 1, 0, /*
|
149
|
1734 Return the character position closest to the mouse event EVENT.
|
0
|
1735 If the event did not occur over a window or over text, return the
|
|
1736 closest point to the location of the event. If the Y pixel position
|
|
1737 overlaps a window and the X pixel position is to the left of that
|
|
1738 window, the closest point is the beginning of the line containing the
|
|
1739 Y position. If the Y pixel position overlaps a window and the X pixel
|
|
1740 position is to the right of that window, the closest point is the end
|
|
1741 of the line containing the Y position. If the Y pixel position is
|
149
|
1742 above a window, return 0. If it is below the last character in a window,
|
|
1743 return the value of (window-end).
|
20
|
1744 */
|
|
1745 (event))
|
0
|
1746 {
|
|
1747 Bufpos bufp;
|
|
1748
|
|
1749 event_pixel_translation (event, 0, 0, 0, 0, 0, 0, &bufp, 0, 0, 0);
|
|
1750
|
149
|
1751 return bufp ? make_int (bufp) : Qnil;
|
0
|
1752 }
|
|
1753
|
20
|
1754 DEFUN ("event-x", Fevent_x, 1, 1, 0, /*
|
149
|
1755 Return the X position of the mouse event EVENT in characters.
|
0
|
1756 This is relative to the window the event occurred over.
|
20
|
1757 */
|
|
1758 (event))
|
0
|
1759 {
|
|
1760 int char_x;
|
|
1761
|
|
1762 event_pixel_translation (event, &char_x, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1763
|
|
1764 return make_int (char_x);
|
|
1765 }
|
|
1766
|
20
|
1767 DEFUN ("event-y", Fevent_y, 1, 1, 0, /*
|
149
|
1768 Return the Y position of the mouse event EVENT in characters.
|
0
|
1769 This is relative to the window the event occurred over.
|
20
|
1770 */
|
|
1771 (event))
|
0
|
1772 {
|
|
1773 int char_y;
|
|
1774
|
|
1775 event_pixel_translation (event, 0, &char_y, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1776
|
|
1777 return make_int (char_y);
|
|
1778 }
|
|
1779
|
20
|
1780 DEFUN ("event-modeline-position", Fevent_modeline_position, 1, 1, 0, /*
|
0
|
1781 Return the character position in the modeline that EVENT occurred over.
|
|
1782 EVENT should be a mouse event. If EVENT did not occur over a modeline,
|
|
1783 nil is returned. You can determine the actual character that the
|
|
1784 event occurred over by looking in `generated-modeline-string' at the
|
|
1785 returned character position. Note that `generated-modeline-string'
|
|
1786 is buffer-local, and you must use EVENT's buffer when retrieving
|
|
1787 `generated-modeline-string' in order to get accurate results.
|
20
|
1788 */
|
|
1789 (event))
|
0
|
1790 {
|
|
1791 Charcount mbufp;
|
|
1792
|
|
1793 event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, &mbufp, 0, 0);
|
|
1794
|
149
|
1795 return mbufp < 0 ? Qnil : make_int (mbufp);
|
0
|
1796 }
|
|
1797
|
20
|
1798 DEFUN ("event-glyph", Fevent_glyph, 1, 1, 0, /*
|
149
|
1799 Return the glyph that the mouse event EVENT occurred over, or nil.
|
20
|
1800 */
|
|
1801 (event))
|
0
|
1802 {
|
|
1803 Lisp_Object glyph;
|
|
1804 struct window *w;
|
|
1805
|
|
1806 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, &glyph, 0);
|
|
1807
|
149
|
1808 return w && GLYPHP (glyph) ? glyph : Qnil;
|
0
|
1809 }
|
|
1810
|
20
|
1811 DEFUN ("event-glyph-extent", Fevent_glyph_extent, 1, 1, 0, /*
|
149
|
1812 Return the extent of the glyph that the mouse event EVENT occurred over.
|
0
|
1813 If the event did not occur over a glyph, nil is returned.
|
20
|
1814 */
|
|
1815 (event))
|
0
|
1816 {
|
|
1817 Lisp_Object extent;
|
|
1818 struct window *w;
|
|
1819
|
|
1820 event_pixel_translation (event, 0, 0, 0, 0, &w, 0, 0, 0, 0, &extent);
|
|
1821
|
149
|
1822 return w && EXTENTP (extent) ? extent : Qnil;
|
0
|
1823 }
|
|
1824
|
20
|
1825 DEFUN ("event-glyph-x-pixel", Fevent_glyph_x_pixel, 1, 1, 0, /*
|
0
|
1826 Return the X pixel position of EVENT relative to the glyph it occurred over.
|
|
1827 EVENT should be a mouse event. If the event did not occur over a glyph,
|
|
1828 nil is returned.
|
20
|
1829 */
|
|
1830 (event))
|
0
|
1831 {
|
|
1832 Lisp_Object extent;
|
|
1833 struct window *w;
|
|
1834 int obj_x;
|
|
1835
|
|
1836 event_pixel_translation (event, 0, 0, &obj_x, 0, &w, 0, 0, 0, 0, &extent);
|
|
1837
|
149
|
1838 return w && EXTENTP (extent) ? make_int (obj_x) : Qnil;
|
0
|
1839 }
|
|
1840
|
20
|
1841 DEFUN ("event-glyph-y-pixel", Fevent_glyph_y_pixel, 1, 1, 0, /*
|
0
|
1842 Return the Y pixel position of EVENT relative to the glyph it occurred over.
|
|
1843 EVENT should be a mouse event. If the event did not occur over a glyph,
|
|
1844 nil is returned.
|
20
|
1845 */
|
|
1846 (event))
|
0
|
1847 {
|
|
1848 Lisp_Object extent;
|
|
1849 struct window *w;
|
|
1850 int obj_y;
|
|
1851
|
|
1852 event_pixel_translation (event, 0, 0, 0, &obj_y, &w, 0, 0, 0, 0, &extent);
|
|
1853
|
149
|
1854 return w && EXTENTP (extent) ? make_int (obj_y) : Qnil;
|
0
|
1855 }
|
|
1856
|
20
|
1857 DEFUN ("event-toolbar-button", Fevent_toolbar_button, 1, 1, 0, /*
|
149
|
1858 Return the toolbar button that the mouse event EVENT occurred over.
|
|
1859 If the event did not occur over a toolbar button, nil is returned.
|
20
|
1860 */
|
|
1861 (event))
|
0
|
1862 {
|
|
1863 #ifdef HAVE_TOOLBARS
|
|
1864 Lisp_Object button;
|
|
1865
|
149
|
1866 int result = event_pixel_translation (event, 0, 0, 0, 0, 0, 0, 0, 0, &button, 0);
|
0
|
1867
|
149
|
1868 return result == OVER_TOOLBAR && TOOLBAR_BUTTONP (button) ? button : Qnil;
|
|
1869 #else
|
0
|
1870 return Qnil;
|
|
1871 #endif
|
|
1872 }
|
|
1873
|
20
|
1874 DEFUN ("event-process", Fevent_process, 1, 1, 0, /*
|
0
|
1875 Return the process of the given process-output event.
|
20
|
1876 */
|
|
1877 (event))
|
0
|
1878 {
|
|
1879 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p);
|
149
|
1880 return XEVENT (event)->event.process.process;
|
0
|
1881 }
|
|
1882
|
20
|
1883 DEFUN ("event-function", Fevent_function, 1, 1, 0, /*
|
0
|
1884 Return the callback function of EVENT.
|
|
1885 EVENT should be a timeout, misc-user, or eval event.
|
20
|
1886 */
|
|
1887 (event))
|
0
|
1888 {
|
|
1889 CHECK_LIVE_EVENT (event);
|
|
1890 switch (XEVENT (event)->event_type)
|
|
1891 {
|
|
1892 case timeout_event:
|
173
|
1893 return XEVENT (event)->event.timeout.function;
|
0
|
1894 case misc_user_event:
|
|
1895 case eval_event:
|
173
|
1896 return XEVENT (event)->event.eval.function;
|
0
|
1897 default:
|
|
1898 return wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
|
|
1899 }
|
|
1900 }
|
|
1901
|
20
|
1902 DEFUN ("event-object", Fevent_object, 1, 1, 0, /*
|
0
|
1903 Return the callback function argument of EVENT.
|
|
1904 EVENT should be a timeout, misc-user, or eval event.
|
20
|
1905 */
|
|
1906 (event))
|
0
|
1907 {
|
|
1908 again:
|
|
1909 CHECK_LIVE_EVENT (event);
|
|
1910 switch (XEVENT (event)->event_type)
|
|
1911 {
|
|
1912 case timeout_event:
|
173
|
1913 return XEVENT (event)->event.timeout.object;
|
0
|
1914 case misc_user_event:
|
|
1915 case eval_event:
|
173
|
1916 return XEVENT (event)->event.eval.object;
|
0
|
1917 default:
|
|
1918 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event);
|
|
1919 goto again;
|
|
1920 }
|
|
1921 }
|
|
1922
|
207
|
1923 DEFUN ("event-drag-and-drop-data", Fevent_drag_and_drop_data, 1, 1, 0, /*
|
197
|
1924 Return the Dnd data list of EVENT.
|
207
|
1925 EVENT should be a dnd_drop event.
|
197
|
1926 */
|
|
1927 (event))
|
|
1928 {
|
207
|
1929 #ifdef HAVE_OFFIX_DND
|
197
|
1930 again:
|
|
1931 CHECK_LIVE_EVENT (event);
|
|
1932 switch (XEVENT (event)->event_type)
|
|
1933 {
|
|
1934 case dnd_drop_event:
|
|
1935 return XEVENT (event)->event.dnd_drop.data;
|
|
1936 default:
|
|
1937 event = wrong_type_argument (Qdnd_drop_event_p, event);
|
|
1938 goto again;
|
|
1939 }
|
207
|
1940 #else /* !HAVE_OFFIX_DND */
|
|
1941 return Qnil;
|
|
1942 #endif /* HAVE_OFFIX_DND */
|
197
|
1943 }
|
|
1944
|
20
|
1945 DEFUN ("event-properties", Fevent_properties, 1, 1, 0, /*
|
0
|
1946 Return a list of all of the properties of EVENT.
|
|
1947 This is in the form of a property list (alternating keyword/value pairs).
|
20
|
1948 */
|
|
1949 (event))
|
0
|
1950 {
|
|
1951 Lisp_Object props = Qnil;
|
|
1952 struct Lisp_Event *e;
|
|
1953 struct gcpro gcpro1;
|
|
1954
|
|
1955 CHECK_LIVE_EVENT (event);
|
|
1956 e = XEVENT (event);
|
|
1957 GCPRO1 (props);
|
|
1958
|
|
1959 props = Fcons (Qtimestamp, Fcons (Fevent_timestamp (event), props));
|
|
1960
|
|
1961 switch (e->event_type)
|
|
1962 {
|
|
1963 case process_event:
|
|
1964 props = Fcons (Qprocess, Fcons (e->event.process.process, props));
|
|
1965 break;
|
173
|
1966
|
0
|
1967 case timeout_event:
|
|
1968 props = Fcons (Qobject, Fcons (Fevent_object (event), props));
|
|
1969 props = Fcons (Qfunction, Fcons (Fevent_function (event), props));
|
|
1970 props = Fcons (Qid, Fcons (make_int (e->event.timeout.id_number),
|
|
1971 props));
|
|
1972 break;
|
|
1973
|
|
1974 case key_press_event:
|
|
1975 props = Fcons (Qmodifiers, Fcons (Fevent_modifiers (event), props));
|
|
1976 props = Fcons (Qkey, Fcons (Fevent_key (event), props));
|
|
1977 break;
|
|
1978
|
|
1979 case button_press_event:
|
|
1980 case button_release_event:
|
|
1981 props = Fcons (Qy, Fcons (Fevent_y_pixel (event), props));
|
|
1982 props = Fcons (Qx, Fcons (Fevent_x_pixel (event), props));
|
|
1983 props = Fcons (Qmodifiers, Fcons (Fevent_modifiers (event), props));
|
|
1984 props = Fcons (Qbutton, Fcons (Fevent_button (event), props));
|
|
1985 break;
|
|
1986
|
|
1987 case pointer_motion_event:
|
|
1988 props = Fcons (Qmodifiers, Fcons (Fevent_modifiers (event), props));
|
|
1989 props = Fcons (Qy, Fcons (Fevent_y_pixel (event), props));
|
|
1990 props = Fcons (Qx, Fcons (Fevent_x_pixel (event), props));
|
|
1991 break;
|
|
1992
|
|
1993 case misc_user_event:
|
|
1994 case eval_event:
|
|
1995 props = Fcons (Qobject, Fcons (Fevent_object (event), props));
|
|
1996 props = Fcons (Qfunction, Fcons (Fevent_function (event), props));
|
|
1997 break;
|
|
1998
|
197
|
1999 #ifdef HAVE_OFFIX_DND
|
|
2000 case dnd_drop_event:
|
|
2001 props = Fcons (Qy, Fcons (Fevent_y_pixel (event), props));
|
|
2002 props = Fcons (Qx, Fcons (Fevent_x_pixel (event), props));
|
|
2003 props = Fcons (Qmodifiers, Fcons (Fevent_modifiers (event), props));
|
|
2004 props = Fcons (Qbutton, Fcons (Fevent_button (event), props));
|
207
|
2005 props = Fcons (Qdnd_data, Fcons (Fevent_drag_and_drop_data (event), props));
|
197
|
2006 break;
|
|
2007 #endif
|
|
2008
|
0
|
2009 case magic_eval_event:
|
|
2010 case magic_event:
|
149
|
2011 break;
|
|
2012
|
122
|
2013 case empty_event:
|
149
|
2014 RETURN_UNGCPRO (Qnil);
|
0
|
2015 break;
|
|
2016
|
|
2017 default:
|
|
2018 abort ();
|
|
2019 break; /* not reached; warning suppression */
|
|
2020 }
|
|
2021
|
|
2022 props = Fcons (Qchannel, Fcons (Fevent_channel (event), props));
|
|
2023 UNGCPRO;
|
|
2024
|
|
2025 return props;
|
|
2026 }
|
|
2027
|
|
2028
|
|
2029 /************************************************************************/
|
|
2030 /* initialization */
|
|
2031 /************************************************************************/
|
|
2032
|
|
2033 void
|
|
2034 syms_of_events (void)
|
|
2035 {
|
20
|
2036 DEFSUBR (Fcharacter_to_event);
|
|
2037 DEFSUBR (Fevent_to_character);
|
0
|
2038
|
20
|
2039 DEFSUBR (Fmake_event);
|
|
2040 DEFSUBR (Fdeallocate_event);
|
|
2041 DEFSUBR (Fcopy_event);
|
|
2042 DEFSUBR (Feventp);
|
|
2043 DEFSUBR (Fevent_live_p);
|
|
2044 DEFSUBR (Fevent_type);
|
|
2045 DEFSUBR (Fevent_properties);
|
0
|
2046
|
20
|
2047 DEFSUBR (Fevent_timestamp);
|
|
2048 DEFSUBR (Fevent_key);
|
|
2049 DEFSUBR (Fevent_button);
|
|
2050 DEFSUBR (Fevent_modifier_bits);
|
|
2051 DEFSUBR (Fevent_modifiers);
|
|
2052 DEFSUBR (Fevent_x_pixel);
|
|
2053 DEFSUBR (Fevent_y_pixel);
|
|
2054 DEFSUBR (Fevent_window_x_pixel);
|
|
2055 DEFSUBR (Fevent_window_y_pixel);
|
|
2056 DEFSUBR (Fevent_over_text_area_p);
|
|
2057 DEFSUBR (Fevent_over_modeline_p);
|
|
2058 DEFSUBR (Fevent_over_border_p);
|
|
2059 DEFSUBR (Fevent_over_toolbar_p);
|
|
2060 DEFSUBR (Fevent_channel);
|
|
2061 DEFSUBR (Fevent_window);
|
|
2062 DEFSUBR (Fevent_point);
|
|
2063 DEFSUBR (Fevent_closest_point);
|
|
2064 DEFSUBR (Fevent_x);
|
|
2065 DEFSUBR (Fevent_y);
|
|
2066 DEFSUBR (Fevent_modeline_position);
|
|
2067 DEFSUBR (Fevent_glyph);
|
|
2068 DEFSUBR (Fevent_glyph_extent);
|
|
2069 DEFSUBR (Fevent_glyph_x_pixel);
|
|
2070 DEFSUBR (Fevent_glyph_y_pixel);
|
|
2071 DEFSUBR (Fevent_toolbar_button);
|
|
2072 DEFSUBR (Fevent_process);
|
|
2073 DEFSUBR (Fevent_function);
|
|
2074 DEFSUBR (Fevent_object);
|
207
|
2075 DEFSUBR (Fevent_drag_and_drop_data);
|
0
|
2076
|
|
2077 defsymbol (&Qeventp, "eventp");
|
|
2078 defsymbol (&Qevent_live_p, "event-live-p");
|
|
2079 defsymbol (&Qkey_press_event_p, "key-press-event-p");
|
|
2080 defsymbol (&Qbutton_event_p, "button-event-p");
|
|
2081 defsymbol (&Qmouse_event_p, "mouse-event-p");
|
|
2082 defsymbol (&Qprocess_event_p, "process-event-p");
|
|
2083 defsymbol (&Qkey_press, "key-press");
|
|
2084 defsymbol (&Qbutton_press, "button-press");
|
|
2085 defsymbol (&Qbutton_release, "button-release");
|
|
2086 defsymbol (&Qmisc_user, "misc-user");
|
|
2087 defsymbol (&Qascii_character, "ascii-character");
|
197
|
2088 #ifdef HAVE_OFFIX_DND
|
|
2089 defsymbol (&Qdnd_drop_event_p, "dnd-drop-event-p");
|
|
2090 defsymbol (&Qdnd_drop, "dnd-drop");
|
|
2091 #endif
|
0
|
2092 }
|
|
2093
|
|
2094 void
|
|
2095 vars_of_events (void)
|
|
2096 {
|
|
2097 DEFVAR_LISP ("character-set-property", &Vcharacter_set_property /*
|
|
2098 A symbol used to look up the 8-bit character of a keysym.
|
|
2099 To convert a keysym symbol to an 8-bit code, as when that key is
|
|
2100 bound to self-insert-command, we will look up the property that this
|
|
2101 variable names on the property list of the keysym-symbol. The window-
|
|
2102 system-specific code will set up appropriate properties and set this
|
|
2103 variable.
|
|
2104 */ );
|
|
2105 Vcharacter_set_property = Qnil;
|
|
2106
|
|
2107 Vevent_resource = Qnil;
|
|
2108
|
|
2109 QKbackspace = KEYSYM ("backspace");
|
|
2110 QKtab = KEYSYM ("tab");
|
|
2111 QKlinefeed = KEYSYM ("linefeed");
|
|
2112 QKreturn = KEYSYM ("return");
|
|
2113 QKescape = KEYSYM ("escape");
|
|
2114 QKspace = KEYSYM ("space");
|
|
2115 QKdelete = KEYSYM ("delete");
|
|
2116
|
|
2117 staticpro (&QKbackspace);
|
|
2118 staticpro (&QKtab);
|
|
2119 staticpro (&QKlinefeed);
|
|
2120 staticpro (&QKreturn);
|
|
2121 staticpro (&QKescape);
|
|
2122 staticpro (&QKspace);
|
|
2123 staticpro (&QKdelete);
|
|
2124 }
|