annotate src/events.c @ 941:c891972d07fa

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