annotate src/events.h @ 1001:cba22ad5bbfd

[xemacs-hg @ 2002-09-13 20:35:10 by adrian] xemacs-21.5: Install to overwrite existing files, support xemacs_extra_name -------------------- ChangeLog entries follow: -------------------- nt/ChangeLog addition: 2002-09-13 Adrian Aichner <adrian@xemacs.org> * xemacs.mak: Suppress confirmation for overwriting files. * xemacs.mak (installation): Add support for xemacs_extra_name.
author adrian
date Fri, 13 Sep 2002 20:35:11 +0000
parents 345b7d75cab4
children e22b0213b713
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 /* Definitions for the new event model;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 created 16-jul-91 by Jamie Zawinski
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
4 Copyright (C) 1995, 1996, 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
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
25 #ifndef INCLUDED_events_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
26 #define INCLUDED_events_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "systime.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
30 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
31 #include "opaque.h"
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
32 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
33
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 /* There is one object called an event_stream. This object contains
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 callback functions for doing the window-system-dependent operations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 that XEmacs requires.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 If XEmacs is compiled with support for X11 and the X Toolkit, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 event_stream structure will contain functions that can cope with input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 on XEmacs windows on multiple displays, as well as input from dumb tty
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 If it is desired to have XEmacs able to open frames on the displays of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 multiple heterogeneous machines, X11 and SunView, or X11 and NeXT, for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 example, then it will be necessary to construct an event_stream structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 that can cope with the given types. Currently, the only implemented
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
47 event_streams are for dumb-ttys, and for X11 plus dumb-ttys,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
48 and for mswindows.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 To implement this for one window system is relatively simple.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 To implement this for multiple window systems is trickier and may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 not be possible in all situations, but it's been done for X and TTY.
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 Note that these callbacks are *NOT* console methods; that's because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 the routines are not specific to a particular console type but must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 be able to simultaneously cope with all allowable console types.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 The slots of the event_stream structure:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 next_event_cb A function which fills in an XEmacs_event structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 with the next event available. If there is no event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 available, then this should block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 IMPORTANT: timer events and especially process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 events *must not* be returned if there are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 events of other types available; otherwise you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 can end up with an infinite loop in Fdiscard_input().
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 event_pending_cb A function which says whether there are events to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 read. If called with an argument of 0, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 should say whether calling the next_event_cb will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 block. If called with an argument of 1, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 should say whether there are user-generated events
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 pending (that is, keypresses or mouse-clicks). This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 is used for redisplay optimization, among other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 things. On dumb ttys, these two results are the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 same, but under a window system, they are not.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 If this function is not sure whether there are events
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 to be read, it *must* return 0. Otherwise various
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 undesirable effects will occur, such as redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 not occurring until the next event occurs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 handle_magic_event_cb XEmacs calls this with an event structure which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 contains window-system dependent information that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 XEmacs doesn't need to know about, but which must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 happen in order. If the next_event_cb never returns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 an event of type "magic", this will never be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
90 format_magic_event_cb Called with a magic event; print a representation of
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
91 the innards of the event to PSTREAM.
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
92
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
93 compare_magic_event_cb Called with two magic events; return non-zero if
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
94 the innards of the two are equal, zero otherwise.
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
95
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
96 hash_magic_event_cb Called with a magic event; return a hash of the
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
97 innards of the event.
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
98
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 add_timeout_cb Called with an EMACS_TIME, the absolute time at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 which a wakeup event should be generated; and a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 void *, which is an arbitrary value that will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 returned in the timeout event. The timeouts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 generated by this function should be one-shots:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 they fire once and then disappear. This callback
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 should return an int id-number which uniquely
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 identifies this wakeup. If an implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 doesn't have microseconds or millisecond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 granularity, it should round up to the closest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 value it can deal with.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 remove_timeout_cb Called with an int, the id number of a wakeup to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 discard. This id number must have been returned by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 the add_timeout_cb. If the given wakeup has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 already expired, this should do nothing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 select_process_cb These callbacks tell the underlying implementation to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 unselect_process_cb add or remove a file descriptor from the list of fds
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 which are polled for inferior-process input. When
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 input becomes available on the given process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 connection, an event of type "process" should be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 generated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 select_console_cb These callbacks tell the underlying implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 unselect_console_cb to add or remove a console from the list of consoles
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 which are polled for user-input.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 select_device_cb These callbacks are used by Unixoid event loops
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 unselect_device_cb (those that use select() and file descriptors and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 have a separate input fd per device).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
131 create_io_streams_cb These callbacks are called by process code to
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
132 delete_io_streams_cb create the input and output lstreams which are used
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
133 for subprocess I/O.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 quitp_cb A handler function called from the `QUIT' macro which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 should check whether the quit character has been
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 typed. On systems with SIGIO, this will not be called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 unless the `sigio_happened' flag is true (it is set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 from the SIGIO handler).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 XEmacs has its own event structures, which are distinct from the event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 structures used by X or any other window system. It is the job of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 event_stream layer to translate to this format.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 Stream pairs description
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 ------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 Since there are many possible processes/event loop combinations, the event code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 is responsible for creating an appropriate lstream type. The process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 implementation does not care about that implementation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 The Create stream pair function is passed two void* values, which identify
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 process-dependent 'handles'. The process implementation uses these handles
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 to communicate with child processes. The function must be prepared to receive
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
157 handle types of any process implementation. Since only one process
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 implementation exists in a particular XEmacs configuration, preprocessing
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
159 is a means of compiling in the support for the code which deals with particular
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 handle types.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 For example, a unixoid type loop, which relies on file descriptors, may be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 asked to create a pair of streams by a unix-style process implementation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 In this case, the handles passed are unix file descriptors, and the code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 may deal with these directly. Although, the same code may be used on Win32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 system with X-Windows. In this case, Win32 process implementation passes
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
167 handles of type HANDLE, and the create_io_streams function must call
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 appropriate function to get file descriptors given HANDLEs, so that these
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 descriptors may be passed to XtAddInput.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 The handle given may have special denying value, in which case the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 corresponding lstream should not be created.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 The return value of the function is a unique stream identifier. It is used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 by processes implementation, in its platform-independent part. There is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 the get_process_from_usid function, which returns process object given its
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 USID. The event stream is responsible for converting its internal handle
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 type into USID.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 Example is the TTY event stream. When a file descriptor signals input, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 event loop must determine process to which the input is destined. Thus,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 the implementation uses process input stream file descriptor as USID, by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 simply casting the fd value to USID type.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 There are two special USID values. One, USID_ERROR, indicates that the stream
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 pair cannot be created. The second, USID_DONTHASH, indicates that streams are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 created, but the event stream does not wish to be able to find the process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 by its USID. Specifically, if an event stream implementation never calls
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 get_process_from_usid, this value should always be returned, to prevent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 accumulating useless information on USID to process relationship.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 /* typedef unsigned int USID; in lisp.h */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 #define USID_ERROR ((USID)-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 #define USID_DONTHASH ((USID)0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 struct event_stream
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 int (*event_pending_p) (int);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
201 void (*next_event_cb) (Lisp_Event *);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
202 void (*handle_magic_event_cb) (Lisp_Event *);
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
203 void (*format_magic_event_cb) (Lisp_Event *, Lisp_Object pstream);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
204 int (*compare_magic_event_cb) (Lisp_Event *, Lisp_Event *);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
205 Hashcode (*hash_magic_event_cb)(Lisp_Event *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 int (*add_timeout_cb) (EMACS_TIME);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 void (*remove_timeout_cb) (int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 void (*select_console_cb) (struct console *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 void (*unselect_console_cb) (struct console *);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
210 void (*select_process_cb) (Lisp_Process *, int doin, int doerr);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
211 void (*unselect_process_cb) (Lisp_Process *, int doin, int doerr);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 void (*quit_p_cb) (void);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
213 void (*force_event_pending) (struct frame* f);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
214 void (*create_io_streams_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
215 void * /* errhandle*/,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 Lisp_Object* /* instream */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 Lisp_Object* /* outstream */,
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
218 Lisp_Object* /* errstream */,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
219 USID * /* in_usid */, USID * /* err_usid */,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 int /* flags */);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
221 void (*delete_io_streams_cb) (Lisp_Object /* instream */,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
222 Lisp_Object /* outstream */,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
223 Lisp_Object /* errstream */,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
224 USID * /* in_usid */, USID * /* err_usid */);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
225 int (*current_event_timestamp_cb) (struct console *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
228 /* Flags for create_io_streams_cb() FLAGS parameter */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 #define STREAM_PTY_FLUSHING 0x0001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 #define STREAM_NETWORK_CONNECTION 0x0002
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 extern struct event_stream *event_stream;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
234 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
235 Lisp_Object make_key_data (void);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
236 Lisp_Object make_button_data (void);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
237 Lisp_Object make_motion_data (void);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
238 Lisp_Object make_process_data (void);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
239 Lisp_Object make_timeout_data (void);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
240 Lisp_Object make_magic_data (void);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
241 Lisp_Object make_magic_eval_data (void);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
242 Lisp_Object make_eval_data (void);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
243 Lisp_Object make_misc_user_data (void);
937
4a2ad9252ff5 [xemacs-hg @ 2002-07-30 07:21:49 by michaels]
michaels
parents: 934
diff changeset
244 #endif /* USE_KKCC */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
245
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 typedef enum emacs_event_type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 empty_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 key_press_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 button_press_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 button_release_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 pointer_motion_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 process_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 timeout_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 magic_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 magic_eval_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 eval_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 misc_user_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 dead_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 } emacs_event_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 #define first_event_type empty_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 #define last_event_type dead_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
265 #ifdef MULE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
266
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
267 enum alternative_key_chars
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
268 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
269 KEYCHAR_CURRENT_LANGENV,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
270 KEYCHAR_DEFAULT_USER,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
271 KEYCHAR_DEFAULT_SYSTEM,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
272 KEYCHAR_UNDERLYING_VIRTUAL_KEY_CURRENT_LANGENV,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
273 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_USER,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
274 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_SYSTEM,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
275 KEYCHAR_QWERTY,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
276 KEYCHAR_LAST
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
277 };
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
278
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
279 #endif /* MULE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
281 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
282 struct Lisp_Key_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
283 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 struct key_data
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
285 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
287 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
288 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
289 #endif /* USE_KKCC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
290 /* What keysym this is; a character or a symbol. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
291 Lisp_Object keysym;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
292 /* Modifiers held down when key was pressed: control, meta, etc.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
293 Also includes buttons. For many keys, Shift is not a bit; that
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
294 is implicit in the keyboard layout. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
295 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
296 #ifdef MULE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
297 /* Alternate character interpretations for this key in different
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
298 keyboard layouts. This deals with the problem of pressing C-x in
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
299 the Russian layout (the so-called "Russian C-x problem"), for
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
300 example: `x' gets mapped to a Cyrillic character, so what do we
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
301 do? For that matter, what about `C-x b'? What we do is look the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
302 key up in the default locales (current language environment, user
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
303 default, system default), then check to see if the underlying
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
304 virtual key is alphabetic in the same three defaults, then
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
305 finally check US ASCII. We ignore the underlying virtual key for
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
306 the current layout to avoid the problem of a French speaker
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
307 (AZERTY layout) who temporarily switches to Russian: The virtual
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
308 keys underlying Russian are US-ASCII, so what the French speaker
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
309 things of as C-a (the key just to the right of TAB) appears as
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
310 C-q. (#### We should probably ignore the current char and look
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
311 *ONLY* in alt_keychars for all control keys. What about the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
312 English speaker who temporarily switches to the French layout and
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
313 finds C-q mapped to C-a?) */
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
314 Ichar alt_keychars[KEYCHAR_LAST];
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
315 #endif /* MULE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
318 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
319 typedef struct Lisp_Key_Data Lisp_Key_Data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
320
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
321 DECLARE_LRECORD (key_data, Lisp_Key_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
322 #define XKEY_DATA(x) XRECORD (x, key_data, Lisp_Key_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
323 #define wrap_key_data(p) wrap_record (p, key_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
324 #define KEY_DATAP(x) RECORDP (x, key_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
325 #define CHECK_KEY_DATA(x) CHECK_RECORD (x, key_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
326 #define CONCHECK_KEY_DATA(x) CONCHECK_RECORD (x, key_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
327
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
328 #define XKEY_DATA_KEYSYM(d) (XKEY_DATA (d)->keysym)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
329 #define KEY_DATA_KEYSYM(d) ((d)->keysym)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
330 #define XKEY_DATA_MODIFIERS(d) (XKEY_DATA (d)->modifiers)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
331 #define KEY_DATA_MODIFIERS(d) ((d)->modifiers)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
332
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
333 #define XSET_KEY_DATA_KEYSYM(d, k) (XKEY_DATA (d)->keysym = (k))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
334 #define SET_KEY_DATA_KEYSYM(d, k) ((d)->keysym = k)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
335 #define XSET_KEY_DATA_MODIFIERS(d, m) (XKEY_DATA (d)->modifiers = m)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
336 #define SET_KEY_DATA_MODIFIERS(d, m) ((d)->modifiers = m)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
337 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
338
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
339 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
340 struct Lisp_Button_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
341 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 struct button_data
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
343 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
345 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
346 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
347 #endif /* USE_KKCC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
348 /* What button went down or up. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
349 int button;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
350 /* Bucky-bits on that button: shift, control, meta, etc. Also
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
351 includes other buttons (not the one pressed). */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
352 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
353 /* Where it was at the button-state-change (in pixels). */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
354 int x, y;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
356 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
357 typedef struct Lisp_Button_Data Lisp_Button_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
359 DECLARE_LRECORD (button_data, Lisp_Button_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
360 #define XBUTTON_DATA(x) XRECORD (x, button_data, Lisp_Button_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
361 #define wrap_button_data(p) wrap_record (p, button_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
362 #define BUTTON_DATAP(x) RECORDP (x, button_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
363 #define CHECK_BUTTON_DATA(x) CHECK_RECORD (x, button_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
364 #define CONCHECK_BUTTON_DATA(x) CONCHECK_RECORD (x, button_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
365
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
366 #define XBUTTON_DATA_BUTTON(d) (XBUTTON_DATA (d)->button)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
367 #define XBUTTON_DATA_MODIFIERS(d) (XBUTTON_DATA (d)->modifiers)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
368 #define XBUTTON_DATA_X(d) (XBUTTON_DATA (d)->x)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
369 #define XBUTTON_DATA_Y(d) (XBUTTON_DATA (d)->y)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
370
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
371 #define XSET_BUTTON_DATA_BUTTON(d, b) (XBUTTON_DATA (d)->button = (b))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
372 #define XSET_BUTTON_DATA_MODIFIERS(d, m) (XBUTTON_DATA (d)->modifiers = (m))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
373 #define XSET_BUTTON_DATA_X(d, new_x) (XBUTTON_DATA (d)->x = (new_x))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
374 #define XSET_BUTTON_DATA_Y(d, new_y) (XBUTTON_DATA (d)->y = (new_y))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
375 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
376
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
377 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
378 struct Lisp_Motion_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
379 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 struct motion_data
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
381 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
383 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
384 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
385 #endif /* USE_KKCC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
386 /* Where it was after it moved (in pixels). */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
387 int x, y;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
388 /* Bucky-bits down when the motion was detected. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
389 int modifiers;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
391 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
392 typedef struct Lisp_Motion_Data Lisp_Motion_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
394 DECLARE_LRECORD (motion_data, Lisp_Motion_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
395 #define XMOTION_DATA(x) XRECORD (x, motion_data, Lisp_Motion_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
396 #define wrap_motion_data(p) wrap_record (p, motion_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
397 #define MOTION_DATAP(x) RECORDP (x, motion_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
398 #define CHECK_MOTION_DATA(x) CHECK_RECORD (x, motion_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
399 #define CONCHECK_MOTION_DATA(x) CONCHECK_RECORD (x, motion_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
400
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
401 #define XMOTION_DATA_X(d) (XMOTION_DATA (d)->x)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
402 #define XMOTION_DATA_Y(d) (XMOTION_DATA (d)->y)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
403 #define XMOTION_DATA_MODIFIERS(d) (XMOTION_DATA (d)->modifiers)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
404
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
405 #define XSET_MOTION_DATA_X(d, new_x) (XMOTION_DATA (d)->x = (new_x))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
406 #define XSET_MOTION_DATA_Y(d, new_y) (XMOTION_DATA (d)->y = (new_y))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
407 #define XSET_MOTION_DATA_MODIFIERS(d, m) (XMOTION_DATA (d)->modifiers = (m))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
408 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
409
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
410 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
411 struct Lisp_Process_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
412 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 struct process_data
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
414 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 {
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
416 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
417 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
418 #endif /* USE_KKCC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
419 /* the XEmacs "process" object in question */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
420 Lisp_Object process;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
422 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
423 typedef struct Lisp_Process_Data Lisp_Process_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
425 DECLARE_LRECORD (process_data, Lisp_Process_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
426 #define XPROCESS_DATA(x) XRECORD (x, process_data, Lisp_Process_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
427 #define wrap_process_data(p) wrap_record (p, process_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
428 #define PROCESS_DATAP(x) RECORDP (x, process_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
429 #define CHECK_PROCESS_DATA(x) CHECK_RECORD (x, process_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
430 #define CONCHECK_PROCESS_DATA(x) CONCHECK_RECORD (x, process_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
431
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
432 #define XPROCESS_DATA_PROCESS(d) (XPROCESS_DATA (d)->process)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
433 #define XSET_PROCESS_DATA_PROCESS(d, p) (XPROCESS_DATA (d)->process = (p))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
434 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
435
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
436 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
437 struct Lisp_Timeout_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
438 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 struct timeout_data
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
440 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
442 /*
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
443 interval_id The ID returned when the associated call to
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
444 add_timeout_cb() was made
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
445 ------ the rest of the fields are filled in by XEmacs -----
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
446 id_number The XEmacs timeout ID for this timeout (more
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
447 than one timeout event can have the same value
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
448 here, since XEmacs timeouts, as opposed to
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
449 add_timeout_cb() timeouts, can resignal
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
450 themselves)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
451 function An elisp function to call when this timeout is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
452 processed.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
453 object The object passed to that function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
454 */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
455 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
456 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
457 #endif /* USE_KKCC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
458 int interval_id;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
459 int id_number;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
460 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
461 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
463 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
464 typedef struct Lisp_Timeout_Data Lisp_Timeout_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
466 DECLARE_LRECORD (timeout_data, Lisp_Timeout_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
467 #define XTIMEOUT_DATA(x) XRECORD (x, timeout_data, Lisp_Timeout_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
468 #define wrap_timeout_data(p) wrap_record(p, timeout_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
469 #define TIMEOUT_DATAP(x) RECORDP (x, timeout_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
470 #define CHECK_TIMEOUT_DATA(x) CHECK_RECORD (x, timeout_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
471 #define CONCHECK_TIMEOUT_DATA(x) CONCHECK_RECORD (x, timeout_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
472
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
473 #define XTIMEOUT_DATA_INTERVAL_ID(d) XTIMEOUT_DATA (d)->interval_id
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
474 #define XTIMEOUT_DATA_ID_NUMBER(d) XTIMEOUT_DATA (d)->id_number
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
475 #define XTIMEOUT_DATA_FUNCTION(d) XTIMEOUT_DATA (d)->function
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
476 #define XTIMEOUT_DATA_OBJECT(d) XTIMEOUT_DATA (d)->object
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
477
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
478 #define XSET_TIMEOUT_DATA_INTERVAL_ID(d, i) XTIMEOUT_DATA (d)->interval_id = (i)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
479 #define XSET_TIMEOUT_DATA_ID_NUMBER(d, n) XTIMEOUT_DATA (d)->id_number = (n)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
480 #define XSET_TIMEOUT_DATA_FUNCTION(d, f) XTIMEOUT_DATA (d)->function = f
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
481 #define XSET_TIMEOUT_DATA_OBJECT(d, o) XTIMEOUT_DATA (d)->object = o
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
482 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
483
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
484 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
485 struct Lisp_Eval_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
486 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 struct eval_data
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
488 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
490 /* This kind of event is used internally; sometimes the window system
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
491 interface would like to inform XEmacs of some user action (such as
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
492 focusing on another frame) but needs that to happen synchronously
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
493 with the other user input, like keypresses. This is useful when
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
494 events are reported through callbacks rather than in the standard
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
495 event stream.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
496
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
497 function An elisp function to call with this event object.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
498 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
499 */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
500 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
501 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
502 #endif /* USE_KKCC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
503 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
504 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
506 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
507 typedef struct Lisp_Eval_Data Lisp_Eval_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
509 DECLARE_LRECORD (eval_data, Lisp_Eval_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
510 #define XEVAL_DATA(x) XRECORD (x, eval_data, Lisp_Eval_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
511 #define wrap_eval_data(p) wrap_record(p, eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
512 #define EVAL_DATAP(x) RECORDP (x, eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
513 #define CHECK_EVAL_DATA(x) CHECK_RECORD (x, eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
514 #define CONCHECK_EVAL_DATA(x) CONCHECK_RECORD (x, eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
515
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
516 #define XEVAL_DATA_FUNCTION(d) (XEVAL_DATA (d)->function)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
517 #define XEVAL_DATA_OBJECT(d) (XEVAL_DATA (d)->object)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
518
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
519 #define XSET_EVAL_DATA_FUNCTION(d, f) (XEVAL_DATA (d)->function = f)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
520 #define XSET_EVAL_DATA_OBJECT(d, o) (XEVAL_DATA (d)->object = o)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
521 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
522
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
523 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
524 struct Lisp_Misc_User_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
525 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 struct misc_user_data
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
527 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
529 /* #### The misc-user type is serious junk. It should be separated
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
530 out into different events. There's no reason to create
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
531 sub-subtypes of events.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
532
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
533 function An elisp function to call with this event object.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
534 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
535 button What button went down or up.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
536 modifiers Bucky-bits on that button: shift, control, meta, etc.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
537 x, y Where it was at the button-state-change (in pixels).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
538 This is similar to an eval_event, except that it is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
539 generated by user actions: selections in the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
540 menubar, scrollbar actions, or drag and drop actions.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
541 It is a "command" event, like key and mouse presses
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
542 (and unlike mouse motion, process output, and enter
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
543 and leave window hooks). In many ways, eval_events
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
544 are not the same as keypresses or misc_user_events.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
545 The button, modifiers, x, and y parts are only used
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
546 by the XEmacs Drag'n'Drop system. Don't depend on their
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
547 values for other types of misc_user_events.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
548 */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
549 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
550 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
551 #endif /* USE_KKCC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
552 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
553 Lisp_Object object;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
554 int button;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
555 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
556 int x, y;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
558 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
559 typedef struct Lisp_Misc_User_Data Lisp_Misc_User_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
561 DECLARE_LRECORD (misc_user_data, Lisp_Misc_User_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
562 #define XMISC_USER_DATA(x) XRECORD (x, misc_user_data, Lisp_Misc_User_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
563 #define wrap_misc_user_data(p) wrap_record(p, misc_user_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
564 #define MISC_USER_DATAP(x) RECORDP (x, misc_user_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
565 #define CHECK_MISC_USER_DATA(x) CHECK_RECORD (x, misc_user_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
566 #define CONCHECK_MISC_USER_DATA(x) CONCHECK_RECORD (x, misc_user_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
567
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
568 #define XMISC_USER_DATA_FUNCTION(d) (XMISC_USER_DATA (d)->function)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
569 #define XMISC_USER_DATA_OBJECT(d) (XMISC_USER_DATA (d)->object)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
570 #define XMISC_USER_DATA_BUTTON(d) (XMISC_USER_DATA (d)->button)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
571 #define XMISC_USER_DATA_MODIFIERS(d) (XMISC_USER_DATA (d)->modifiers)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
572 #define XMISC_USER_DATA_X(d) (XMISC_USER_DATA (d)->x)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
573 #define XMISC_USER_DATA_Y(d) (XMISC_USER_DATA (d)->y)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
574
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
575 #define XSET_MISC_USER_DATA_FUNCTION(d, f) (XMISC_USER_DATA (d)->function = (f))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
576 #define XSET_MISC_USER_DATA_OBJECT(d, o) (XMISC_USER_DATA (d)->object = (o))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
577 #define XSET_MISC_USER_DATA_BUTTON(d, b) (XMISC_USER_DATA (d)->button = (b))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
578 #define XSET_MISC_USER_DATA_MODIFIERS(d, m) (XMISC_USER_DATA (d)->modifiers = (m))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
579 #define XSET_MISC_USER_DATA_X(d, new_x) (XMISC_USER_DATA (d)->x = (new_x))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
580 #define XSET_MISC_USER_DATA_Y(d, new_y) (XMISC_USER_DATA (d)->y = (new_y))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
581 #endif /* USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
582
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
583 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
584 typedef void (*lisp_obj_arg_fun) (Lisp_Object);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
585
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
586
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
587 struct Lisp_Magic_Eval_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
588 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 struct magic_eval_data
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
590 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
592 /* This is like an eval event but its contents are not
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
593 Lisp-accessible. This allows for "internal eval events" that call
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
594 non-Lisp-accessible functions. Externally, a magic_eval_event just
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
595 appears as a magic_event; the Lisp programmer need not know
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
596 anything more.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
597
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
598 internal_function An unexported function to call with this event
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
599 object. This allows eval events to call internal
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
600 functions. For a normal eval event, this field
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
601 will always be 0.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
602 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
603
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
604 */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
605 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
606 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
607 #endif /* USE_KKCC */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
608 void (*internal_function) (Lisp_Object);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
609 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
611 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
612 typedef struct Lisp_Magic_Eval_Data Lisp_Magic_Eval_Data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
613
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
614 DECLARE_LRECORD (magic_eval_data, Lisp_Magic_Eval_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
615 #define XMAGIC_EVAL_DATA(x) XRECORD (x, magic_eval_data, Lisp_Magic_Eval_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
616 #define wrap_magic_eval_data(p) wrap_record(p, magic_eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
617 #define MAGIC_EVAL_DATAP(x) RECORDP (x, magic_eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
618 #define CHECK_MAGIC_EVAL_DATA(x) CHECK_RECORD (x, magic_eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
619 #define CONCHECK_MAGIC_EVAL_DATA(x) CONCHECK_RECORD (x, magic_eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
620
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
621 #define XMAGIC_EVAL_DATA_INTERNAL_FUNCTION(d) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
622 XMAGIC_EVAL_DATA (d)->internal_function
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
623 #define XMAGIC_EVAL_DATA_INTERNAL_FUNOBJ(d) (XMAGIC_EVAL_DATA (d)->internal_function)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
624 #define XMAGIC_EVAL_DATA_OBJECT(d) (XMAGIC_EVAL_DATA (d)->object)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
625
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
626 #define XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION(d, f) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
627 (XMAGIC_EVAL_DATA (d)->internal_function = f)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
628 #define XSET_MAGIC_EVAL_DATA_INTERNAL_FUNOBJ(d, f) (XMAGIC_EVAL_DATA (d)->internal_function = (f))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
629 #define XSET_MAGIC_EVAL_DATA_OBJECT(d, o) (XMAGIC_EVAL_DATA (d)->object = (o))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
630 #endif /* USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 #if defined (HAVE_X_WINDOWS) && defined(emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 # include <X11/Xlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
636 #ifdef HAVE_GTK
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
637 #include <gdk/gdk.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
638 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
639
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
640
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
641 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
642 struct Lisp_Magic_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
643 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
644 struct lrecord_header lheader;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
645
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
646 union {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
647 #ifdef HAVE_GTK
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
648 GdkEvent gdk_event;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
649 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
650 #ifdef HAVE_X_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
651 XEvent x_event;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
652 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
653 #ifdef HAVE_MS_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
654 int mswindows_event;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
655 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
656 } underlying;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
657 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
658
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
659 typedef struct Lisp_Magic_Data Lisp_Magic_Data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
660
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
661 DECLARE_LRECORD (magic_data, Lisp_Magic_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
662 #define XMAGIC_DATA(x) XRECORD (x, magic_data, Lisp_Magic_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
663 #define wrap_magic_data(p) wrap_record(p, magic_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
664 #define MAGIC_DATAP(x) RECORDP (x, magic_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
665 #define CHECK_MAGIC_DATA(x) CHECK_RECORD (x, magic_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
666 #define CONCHECK_MAGIC_DATA(x) CONCHECK_RECORD (x, magic_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
667
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
668 #define XMAGIC_DATA_UNDERLYING(d) (XMAGIC_DATA (d)->underlying)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
669 #define XSET_MAGIC_DATA_UNDERLYING(d, u) (XMAGIC_DATA (d)->underlying = (u))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
670
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
671 #ifdef HAVE_GTK
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
672 #define XMAGIC_DATA_GDK_EVENT(d) (XMAGIC_DATA (d)->underlying.gdk_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
673 #define XSET_MAGIC_DATA_GDK_EVENT(d, e) (XMAGIC_DATA (d)->underlying.gdk_event = (e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
674 #endif /*HAVE_GTK*/
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
675
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
676 #ifdef HAVE_X_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
677 #define XMAGIC_DATA_X_EVENT(d) (XMAGIC_DATA (d)->underlying.x_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
678 #define XSET_MAGIC_DATA_X_EVENT(d, e) (XMAGIC_DATA (d)->underlying.x_event = (e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
679 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
680
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
681 #ifdef HAVE_MS_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
682 #define XMAGIC_DATA_MSWINDOWS_EVENT(d) (XMAGIC_DATA (d)->underlying.mswindows_event)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
683 #define XSET_MAGIC_DATA_MSWINDOWS_EVENT(d, e) (XMAGIC_DATA (d)->underlying.mswindows_event = (e))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
684 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
685
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
686 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 union magic_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
689 /* No user-serviceable parts within. This is for things like
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
690 KeymapNotify and ExposeRegion events and so on that XEmacs itself
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
691 doesn't care about, but which it must do something with for proper
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
692 interaction with the window system.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
693
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
694 Magic_events are handled somewhat asynchronously, just like
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
695 subprocess filters. However, occasionally a magic_event needs to
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
696 be handled synchronously; in that case, the asynchronous handling
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
697 of the magic_event will push an eval_event back onto the queue,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
698 which will be handled synchronously later. This is one of the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
699 reasons why eval_events exist; I'm not entirely happy with this
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
700 aspect of this event model.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
701 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
702
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
703 #ifdef HAVE_GTK
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
704 GdkEvent underlying_gdk_event;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
705 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 #ifdef HAVE_X_WINDOWS
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
707 XEvent underlying_x_event;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 #ifdef HAVE_MS_WINDOWS
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
710 int underlying_mswindows_event;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
713 #endif /* not USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
714
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 struct Lisp_Timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 {
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
718 struct lcrecord_header header;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 int id; /* Id we use to identify the timeout over its lifetime */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 int interval_id; /* Id for this particular interval; this may
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
721 be different each time the timeout is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
722 signalled.*/
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 Lisp_Object function, object; /* Function and object associated
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
724 with timeout. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 EMACS_TIME next_signal_time; /* Absolute time when the timeout
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
726 is next going to be signalled. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 unsigned int resignal_msecs; /* How far after the next timeout
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
728 should the one after that
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
729 occur? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 };
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
731 typedef struct Lisp_Timeout Lisp_Timeout;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
733 DECLARE_LRECORD (timeout, Lisp_Timeout);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
734 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout)
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 593
diff changeset
735 #define wrap_timeout(p) wrap_record (p, timeout)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 #define TIMEOUTP(x) RECORDP (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 struct Lisp_Event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 /* header->next (aka XEVENT_NEXT ()) is used as follows:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 - For dead events, this is the next dead one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 - For events on the command_event_queue, the next one on the queue.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 - Likewise for events chained in the command builder.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 - Otherwise it's Qnil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 struct lrecord_header lheader;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
749 Lisp_Object next;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
750 emacs_event_type event_type;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
751
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
752 /* Where this event occurred on. This will be a frame, device,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
753 console, or nil, depending on the event type. It is important
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
754 that an object of a more specific type than is actually generated
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
755 is not substituted -- e.g. there should not be a frame inserted
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
756 when a key-press event occurs, because events on dead channels
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
757 are automatically ignored.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
758
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
759 Specifically:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
760
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
761 -- for button and mouse-motion events, channel will be a
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
762 frame. (The translation to a window occurs later.)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
763
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
764 -- for keyboard events, channel will be a console. Note that
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
765 fake keyboard events (generated by `character-to-event' or
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
766 something that calls this, such as macros) need to have the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
767 selected console stored into them when the event is created.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
768 This is so that the correct console-local variables (e.g. the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
769 command builder) will get affected.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
770
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
771 -- for timer, process, magic-eval, and eval events, channel will
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
772 be nil.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
773
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
774 -- for misc-user events, channel will be a frame.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
775
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
776 -- for magic events, channel will be a frame (usually) or a
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
777 device. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
778 Lisp_Object channel;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
779
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
780 /* When this event occurred -- if not known, this is made up. ####
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
781 All timestamps should be measured as milliseconds since XEmacs
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
782 started. Currently they are raw server timestamps. (The X
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
783 protocol doesn't provide any easy way of translating between
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
784 server time and real process time; yuck.) */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
785 unsigned int timestamp;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
786
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
787 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
788 Lisp_Object event_data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
789 #else /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 union
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
792 struct key_data key;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
793 struct button_data button;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
794 struct motion_data motion;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
795 struct process_data process;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
796 struct timeout_data timeout;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
797 struct eval_data eval; /* misc_user_event no longer uses this */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
798 struct misc_user_data misc; /* because it needs position information */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
799 union magic_data magic;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
800 struct magic_eval_data magic_eval;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 } event;
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
802 #endif /* not USE_KKCC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
805 DECLARE_LRECORD (event, Lisp_Event);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
806 #define XEVENT(x) XRECORD (x, event, Lisp_Event)
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 593
diff changeset
807 #define wrap_event(p) wrap_record (p, event)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 #define EVENTP(x) RECORDP (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 DECLARE_LRECORD (command_builder, struct command_builder);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 #define EVENT_CHANNEL(a) ((a)->channel)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 #define EVENT_TYPE(a) ((a)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 #define XEVENT_TYPE(a) (XEVENT (a)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 #define EVENT_NEXT(a) ((a)->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 #define XEVENT_NEXT(e) (XEVENT (e)->next)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
819
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
820 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
821 #define XEVENT_DATA(ev) (XEVENT (ev)->event_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
822 #define EVENT_DATA(ev) ((ev)->event_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
823 #define XEVENT_CHANNEL(ev) (XEVENT (ev)->channel)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
824 #define EVENT_TIMESTAMP(ev) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
825 ((ev)->timestamp)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
826 #define XEVENT_TIMESTAMP(ev) EVENT_TIMESTAMP (XEVENT (ev))
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
827
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
828 #define SET_EVENT_TIMESTAMP_ZERO(ev) \
943
345b7d75cab4 [xemacs-hg @ 2002-08-01 08:28:18 by michaels]
michaels
parents: 937
diff changeset
829 ((ev)->timestamp = 0)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
830 #define SET_EVENT_TIMESTAMP(ev, t) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
831 (ev)->timestamp = (t)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
832 #define XSET_EVENT_TIMESTAMP(ev, t) SET_EVENT_TIMESTAMP (XEVENT (ev), t)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
833
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
834
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
835 #define SET_EVENT_CHANNEL(ev, c) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
836 do { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
837 Lisp_Event *mac_event = (ev); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
838 mac_event->channel = (c); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
839 } while (0)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
840 #define XSET_EVENT_CHANNEL(ev, c) SET_EVENT_CHANNEL (XEVENT (ev), c)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
841
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
842 #define SET_EVENT_DATA(ev, d) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
843 do { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
844 Lisp_Event *mac_event = (ev); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
845 mac_event->event_data = (d); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
846 } while (0)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
847 #define XSET_EVENT_DATA(ev, d) SET_EVENT_DATA (XEVENT (ev), d)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
848
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
849 INLINE_HEADER void set_event_type(struct Lisp_Event *event, emacs_event_type t);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
850 INLINE_HEADER void
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
851 set_event_type(struct Lisp_Event *event, emacs_event_type t)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
852 {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
853 event->event_type = t;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
854
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
855 switch (t) {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
856 case key_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
857 event->event_data = make_key_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
858 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
859 case button_press_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
860 case button_release_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
861 event->event_data = make_button_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
862 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
863 case pointer_motion_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
864 event->event_data = make_motion_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
865 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
866 case process_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
867 event->event_data = make_process_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
868 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
869 case timeout_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
870 event->event_data = make_timeout_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
871 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
872 case magic_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
873 event->event_data = make_magic_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
874 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
875 case magic_eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
876 event->event_data = make_magic_eval_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
877 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
878 case eval_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
879 event->event_data = make_eval_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
880 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
881 case misc_user_event:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
882 event->event_data = make_misc_user_data ();
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
883 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
884 default:
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
885 break;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
886 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
887 }
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
888 #define XSET_EVENT_TYPE(ev, t) set_event_type (XEVENT (ev), t)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
889 #define SET_EVENT_TYPE(ev, t) set_event_type (ev, t)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
890
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
891
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
892 #define SET_EVENT_NEXT(ev, n) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
893 do { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
894 Lisp_Event *mac_event = (ev); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
895 mac_event->next = (n); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
896 } while (0)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
897 #define XSET_EVENT_NEXT(ev, n) SET_EVENT_NEXT (XEVENT (ev), n)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
898
943
345b7d75cab4 [xemacs-hg @ 2002-08-01 08:28:18 by michaels]
michaels
parents: 937
diff changeset
899 #else /* NOT USE_KKCC */
345b7d75cab4 [xemacs-hg @ 2002-08-01 08:28:18 by michaels]
michaels
parents: 937
diff changeset
900 #define XSET_EVENT_NEXT(e, n) do { (XEVENT (e)->next = (n)); } while (0)
345b7d75cab4 [xemacs-hg @ 2002-08-01 08:28:18 by michaels]
michaels
parents: 937
diff changeset
901 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 #define EVENT_CHAIN_LOOP(event, chain) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 for (event = chain; !NILP (event); event = XEVENT_NEXT (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
908 #define CHECK_LIVE_EVENT(x) do { \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
909 CHECK_EVENT (x); \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
910 if (! EVENT_LIVE_P (XEVENT (x))) \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
911 dead_wrong_type_argument (Qevent_live_p, (x)); \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 } while (0)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
913 #define CONCHECK_LIVE_EVENT(x) do { \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
914 CONCHECK_EVENT (x); \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
915 if (! EVENT_LIVE_P (XEVENT (x))) \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
916 x = wrong_type_argument (Qevent_live_p, (x)); \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 } while (0)
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 EXFUN (Fcharacter_to_event, 4);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 EXFUN (Fdeallocate_event, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 EXFUN (Fevent_glyph_extent, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 EXFUN (Fevent_modeline_position, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 EXFUN (Fevent_over_modeline_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 EXFUN (Fevent_over_toolbar_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 EXFUN (Fevent_over_vertical_divider_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 EXFUN (Fevent_point, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 EXFUN (Fevent_window, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 EXFUN (Fmake_event, 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 extern Lisp_Object Qcancel_mode_internal;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
934 extern Lisp_Object Vmodifier_keys_sticky_time;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
936 /* The modifiers XEmacs knows about; these appear in key and button events. */
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
937
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
938 #define XEMACS_MOD_CONTROL (1<<0)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
939 #define XEMACS_MOD_META (1<<1)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
940 #define XEMACS_MOD_SUPER (1<<2)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
941 #define XEMACS_MOD_HYPER (1<<3)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
942 #define XEMACS_MOD_ALT (1<<4)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
943 #define XEMACS_MOD_SHIFT (1<<5) /* not used for dual-case characters */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
944 #define XEMACS_MOD_BUTTON1 (1<<6)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
945 #define XEMACS_MOD_BUTTON2 (1<<7)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
946 #define XEMACS_MOD_BUTTON3 (1<<8)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
947 #define XEMACS_MOD_BUTTON4 (1<<9)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
948 #define XEMACS_MOD_BUTTON5 (1<<10)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
949
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
950 /* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
951 if there are both Alt and Meta keys. If there are no Meta keys,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
952 then Alt generates XEMACS_MOD_META instead.
428
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 /* Maybe this should be trickier */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 #define KEYSYM(x) (intern (x))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 /* from events.c */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
959 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
960 void format_event_object (Eistring *buf, Lisp_Object event, int brief);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
961 #else /* not USE_KKCC */
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 788
diff changeset
962 void format_event_object (Eistring *buf, Lisp_Event *event, int brief);
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
963 #endif /* not USE_KKCC */
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
964 #ifdef USE_KKCC
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
965 //void format_event_data_object (Eistring *buf, Lisp_Object data, int brief);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
966 void copy_event_data (Lisp_Object dest, Lisp_Object src);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
967 #endif /* USE_KKCC */
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
968 void character_to_event (Ichar c, Lisp_Event *event,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
969 struct console *con,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
970 int use_console_meta_flag,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
971 int do_backspace_mapping);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
972 void zero_event (Lisp_Event *e);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 void deallocate_event_chain (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 Lisp_Object event_chain_tail (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
978 Lisp_Object *tail);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 int event_chain_count (Lisp_Object event_chain);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
980 Lisp_Object transfer_event_chain_pointer (Lisp_Object pointer,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
981 Lisp_Object old_chain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
982 Lisp_Object new_chain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 void 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
984 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 Lisp_Object event_chain_find_previous (Lisp_Object event_chain,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
986 Lisp_Object event);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 Lisp_Object copy_event_chain (Lisp_Object event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 /* True if this is a non-internal event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 (keyboard press, menu, scrollbar, mouse button) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 int command_event_p (Lisp_Object event);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
992 void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
993 Ichar event_to_character (Lisp_Event *, int, int, int);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 struct console *event_console_or_selected (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 /* from event-stream.c */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
997 Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
999 void event_stream_handle_magic_event (Lisp_Event *event);
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1000 void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1001 int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1002 Hashcode event_stream_hash_magic_event (Lisp_Event *e);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 void event_stream_select_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 void event_stream_unselect_console (struct console *con);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1005 void event_stream_select_process (Lisp_Process *proc, int doin, int doerr);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1006 void event_stream_unselect_process (Lisp_Process *proc, int doin, int doerr);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1007 void event_stream_create_io_streams (void* inhandle, void* outhandle,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1008 void *errhandle, Lisp_Object* instream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1009 Lisp_Object* outstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1010 Lisp_Object* errstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1011 USID* in_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1012 USID* err_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1013 int flags);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1014 void event_stream_delete_io_streams (Lisp_Object instream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1015 Lisp_Object outstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1016 Lisp_Object errstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1017 USID* in_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1018 USID* err_usid);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 void event_stream_quit_p (void);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1020 void run_pre_idle_hook (void);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 struct low_level_timeout
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 int id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 EMACS_TIME time;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 struct low_level_timeout *next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 };
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 int add_low_level_timeout (struct low_level_timeout **timeout_list,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1030 EMACS_TIME thyme);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 void remove_low_level_timeout (struct low_level_timeout **timeout_list,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1032 int id);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 int get_low_level_timeout_interval (struct low_level_timeout *
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1034 timeout_list, EMACS_TIME *interval);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 int pop_low_level_timeout (struct low_level_timeout **timeout_list,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1036 EMACS_TIME *time_out);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 int event_stream_generate_wakeup (unsigned int milliseconds,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1038 unsigned int vanilliseconds,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1039 Lisp_Object function,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1040 Lisp_Object object,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1041 int async_p);
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
1042 int event_stream_resignal_wakeup (int interval_id, int async_p,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1043 Lisp_Object *function, Lisp_Object *object);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 void event_stream_disable_wakeup (int id, int async_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
1046 /* from signal.c */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
1047 int signal_add_async_interval_timeout (EMACS_TIME thyme);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
1048 void signal_remove_async_interval_timeout (int id);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 /* from event-stream.c -- focus sanity */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 extern int focus_follows_mouse;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 void investigate_frame_change (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev);
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 Lisp_Object extract_this_command_keys_nth_mouse_event (int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 void single_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 void any_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 int in_single_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 extern int emacs_is_blocking;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 extern volatile int sigint_happened;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 #ifdef HAVE_UNIXOID_EVENT_LOOP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 /* from event-unixoid.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 /* Ceci n'est pas un pipe. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 extern int signal_event_pipe[];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 void signal_fake_event (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 void drain_signal_event_pipe (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 extern int fake_event_occurred;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 int event_stream_unixoid_select_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 int event_stream_unixoid_unselect_console (struct console *con);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1081 void event_stream_unixoid_select_process (Lisp_Process *proc, int doin,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1082 int doerr, int *infd, int *errfd);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1083 void event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1084 int doerr, int *infd, int *errfd);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1085 int read_event_from_tty_or_stream_desc (Lisp_Event *event,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1086 struct console *con);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1087 void event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1088 void *errhandle,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1089 Lisp_Object* instream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1090 Lisp_Object* outstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1091 Lisp_Object* errstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1092 USID* in_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1093 USID* err_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1094 int flags);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1095 void event_stream_unixoid_delete_io_streams (Lisp_Object instream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1096 Lisp_Object outstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1097 Lisp_Object errstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1098 USID* in_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1099 USID* err_usid);
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 /* Beware: this evil macro evaluates its arg many times */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd)))
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 #endif /* HAVE_UNIXOID_EVENT_LOOP */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 /* Define this if you want the tty event stream to be used when the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 first console is tty, even if HAVE_X_WINDOWS is defined */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 /* #define DEBUG_TTY_EVENT_STREAM */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1111 /* #### a hack, until accelerator shit is cleaned up */
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 /* This structure is what we use to encapsulate the state of a command sequence
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1114 being composed; key events are executed by adding themselves to the command
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1115 builder; if the command builder is then complete (does not still represent
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1116 a prefix key sequence) it executes the corresponding command.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1117 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1118 struct command_builder
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1119 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1120 struct lcrecord_header header;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1121 Lisp_Object console; /* back pointer to the console this command
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1122 builder is for */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1123 #if 0
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1124 /* #### Not implemented: nil, or an event representing the first
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1125 event read after the last command completed. Threaded. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1126 Lisp_Object prefix_events;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1127 #endif /* 0 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1128 /* nil, or an event chain representing the events in the current
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1129 keymap-lookup sequence. NOTE: All events in the chain MUST be
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1130 freshly allocated, with no pointers to them elsewhere. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1131 Lisp_Object current_events;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1132 /* Last elt of current_events */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1133 Lisp_Object most_current_event;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1134 /* Last elt before function map code took over. What this means is:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1135 All prefixes up to (but not including) this event have non-nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1136 bindings, but the prefix including this event has a nil binding.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1137 Any events in the chain after this one were read solely because
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1138 we're part of a possible function key. If we end up with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1139 something that's not part of a possible function key, we have to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1140 unread all of those events. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1141 Lisp_Object last_non_munged_event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1142 /* One set of values for function-key-map, one for key-translation-map */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1143 struct munging_key_translation
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1144 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1145 /* First event that can begin a possible function key sequence
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1146 (to be translated according to function-key-map). Normally
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1147 this is the first event in the chain. However, once we've
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1148 translated a sequence through function-key-map, this will point
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1149 to the first event after the translated sequence: we don't ever
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1150 want to translate any events twice through function-key-map, or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1151 things could get really screwed up (e.g. if the user created a
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1152 translation loop). If this is nil, then the next-read event is
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1153 the first that can begin a function key sequence. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1154 Lisp_Object first_mungeable_event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1155 } munge_me[2];
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
1156 Ibyte *echo_buf;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1157
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1158 Bytecount echo_buf_length; /* size of echo_buf */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1159 Bytecount echo_buf_index; /* index into echo_buf
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1160 * -1 before doing echoing for new cmd */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1161 /* Self-insert-command is magic in that it doesn't always push an undo-
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1162 boundary: up to 20 consecutive self-inserts can happen before an undo-
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1163 boundary is pushed. This variable is that counter.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1164 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1165 int self_insert_countdown;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1166 };
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1167
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1168 #endif /* INCLUDED_events_h_ */