annotate src/events.h @ 773:4bc4fecf15da

[xemacs-hg @ 2002-03-13 10:16:26 by ben] fix a Makefile problem -- need two pound signs for a comment in Makefile.in.in
author ben
date Wed, 13 Mar 2002 10:16:26 +0000
parents 943eaba38521
children 026c5bf9c134
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.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995, 1996 Ben Wing.
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 /* There is one object called an event_stream. This object contains
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 callback functions for doing the window-system-dependent operations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 that XEmacs requires.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 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
35 event_stream structure will contain functions that can cope with input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 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
37 frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 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
40 multiple heterogeneous machines, X11 and SunView, or X11 and NeXT, for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 example, then it will be necessary to construct an event_stream structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 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
43 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
44 and for mswindows.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 To implement this for one window system is relatively simple.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 To implement this for multiple window systems is trickier and may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 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
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 Note that these callbacks are *NOT* console methods; that's because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 the routines are not specific to a particular console type but must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 be able to simultaneously cope with all allowable console types.
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 The slots of the event_stream structure:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 next_event_cb A function which fills in an XEmacs_event structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 with the next event available. If there is no event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 available, then this should block.
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 IMPORTANT: timer events and especially process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 events *must not* be returned if there are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 events of other types available; otherwise you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 can end up with an infinite loop in Fdiscard_input().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 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
66 read. If called with an argument of 0, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 should say whether calling the next_event_cb will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 block. If called with an argument of 1, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 should say whether there are user-generated events
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 pending (that is, keypresses or mouse-clicks). This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 is used for redisplay optimization, among other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 things. On dumb ttys, these two results are the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 same, but under a window system, they are not.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 If this function is not sure whether there are events
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 to be read, it *must* return 0. Otherwise various
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 undesirable effects will occur, such as redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 not occurring until the next event occurs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 handle_magic_event_cb XEmacs calls this with an event structure which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 contains window-system dependent information that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 XEmacs doesn't need to know about, but which must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 happen in order. If the next_event_cb never returns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 an event of type "magic", this will never be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 add_timeout_cb Called with an EMACS_TIME, the absolute time at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 which a wakeup event should be generated; and a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 void *, which is an arbitrary value that will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 returned in the timeout event. The timeouts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 generated by this function should be one-shots:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 they fire once and then disappear. This callback
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 should return an int id-number which uniquely
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 identifies this wakeup. If an implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 doesn't have microseconds or millisecond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 granularity, it should round up to the closest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 value it can deal with.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 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
99 discard. This id number must have been returned by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 the add_timeout_cb. If the given wakeup has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 already expired, this should do nothing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 select_process_cb These callbacks tell the underlying implementation to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 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
105 which are polled for inferior-process input. When
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 input becomes available on the given process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 connection, an event of type "process" should be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 generated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 select_console_cb These callbacks tell the underlying implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 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
112 which are polled for user-input.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 select_device_cb These callbacks are used by Unixoid event loops
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 unselect_device_cb (those that use select() and file descriptors and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 have a separate input fd per device).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 create_stream_pair_cb These callbacks are called by process code to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 delete_stream_pair_cb create and delete a pair of input and output lstreams
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 which are used for subprocess I/O.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 quitp_cb A handler function called from the `QUIT' macro which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 should check whether the quit character has been
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 typed. On systems with SIGIO, this will not be called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 unless the `sigio_happened' flag is true (it is set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 from the SIGIO handler).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 XEmacs has its own event structures, which are distinct from the event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 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
130 event_stream layer to translate to this format.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 Stream pairs description
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 ------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 Since there are many possible processes/event loop combinations, the event code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 is responsible for creating an appropriate lstream type. The process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 implementation does not care about that implementation.
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 The Create stream pair function is passed two void* values, which identify
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 process-dependent 'handles'. The process implementation uses these handles
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 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
144 handle types of any process implementation. Since only one process
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 implementation exists in a particular XEmacs configuration, preprocessing
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
146 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
147 handle types.
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 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
150 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
151 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
152 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
153 system with X-Windows. In this case, Win32 process implementation passes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 handles of type HANDLE, and the create_stream_pair function must call
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 appropriate function to get file descriptors given HANDLEs, so that these
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 descriptors may be passed to XtAddInput.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 The handle given may have special denying value, in which case the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 corresponding lstream should not be created.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 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
162 by processes implementation, in its platform-independent part. There is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 the get_process_from_usid function, which returns process object given its
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 USID. The event stream is responsible for converting its internal handle
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 type into USID.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 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
168 event loop must determine process to which the input is destined. Thus,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 the implementation uses process input stream file descriptor as USID, by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 simply casting the fd value to USID type.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 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
173 pair cannot be created. The second, USID_DONTHASH, indicates that streams are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 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
175 by its USID. Specifically, if an event stream implementation never calls
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 get_process_from_usid, this value should always be returned, to prevent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 accumulating useless information on USID to process relationship.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 */
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 /* typedef unsigned int USID; in lisp.h */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 #define USID_ERROR ((USID)-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 #define USID_DONTHASH ((USID)0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
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 struct event_stream
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 int (*event_pending_p) (int);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
188 void (*next_event_cb) (Lisp_Event *);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
189 void (*handle_magic_event_cb) (Lisp_Event *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 int (*add_timeout_cb) (EMACS_TIME);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 void (*remove_timeout_cb) (int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 void (*select_console_cb) (struct console *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 void (*unselect_console_cb) (struct console *);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
194 void (*select_process_cb) (Lisp_Process *);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
195 void (*unselect_process_cb) (Lisp_Process *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 void (*quit_p_cb) (void);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
197 void (*force_event_pending) (struct frame* f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 Lisp_Object* /* instream */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 Lisp_Object* /* outstream */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 int /* flags */);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 USID (*delete_stream_pair_cb) (Lisp_Object /* instream */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 Lisp_Object /* outstream */);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
204 int (*current_event_timestamp_cb) (struct console *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 /* Flags for create_stream_pair_cb() FLAGS parameter */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 #define STREAM_PTY_FLUSHING 0x0001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 #define STREAM_NETWORK_CONNECTION 0x0002
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 extern struct event_stream *event_stream;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 typedef enum emacs_event_type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 empty_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 key_press_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 button_press_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 button_release_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 pointer_motion_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 process_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 timeout_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 magic_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 magic_eval_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 eval_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 misc_user_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 dead_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 } emacs_event_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 #define first_event_type empty_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 #define last_event_type dead_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
232 #ifdef MULE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
233
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
234 enum alternative_key_chars
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
235 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
236 KEYCHAR_CURRENT_LANGENV,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
237 KEYCHAR_DEFAULT_USER,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
238 KEYCHAR_DEFAULT_SYSTEM,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
239 KEYCHAR_UNDERLYING_VIRTUAL_KEY_CURRENT_LANGENV,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
240 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_USER,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
241 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_SYSTEM,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
242 KEYCHAR_QWERTY,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
243 KEYCHAR_LAST
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
244 };
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
245
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
246 #endif /* MULE */
428
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 struct key_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
250 /* 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
251 Lisp_Object keysym;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
252 /* 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
253 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
254 is implicit in the keyboard layout. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
255 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
256 #ifdef MULE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
257 /* Alternate character interpretations for this key in different
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
258 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
259 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
260 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
261 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
262 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
263 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
264 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
265 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
266 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
267 (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
268 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
269 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
270 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
271 *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
272 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
273 finds C-q mapped to C-a?) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
274 Emchar alt_keychars[KEYCHAR_LAST];
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
275 #endif /* MULE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 struct button_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
280 /* What button went down or up. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
281 int button;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
282 /* 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
283 includes other buttons (not the one pressed). */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
284 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
285 /* 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
286 int x, y;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 struct motion_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
291 /* Where it was after it moved (in pixels). */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
292 int x, y;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
293 /* Bucky-bits down when the motion was detected. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
294 int modifiers;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 struct process_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
299 /* the XEmacs "process" object in question */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
300 Lisp_Object process;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 struct timeout_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
305 /*
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
306 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
307 add_timeout_cb() was made
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
308 ------ 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
309 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
310 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
311 here, since XEmacs timeouts, as opposed to
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
312 add_timeout_cb() timeouts, can resignal
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
313 themselves)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
314 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
315 processed.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
316 object The object passed to that function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
317 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
318 int interval_id;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
319 int id_number;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
320 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
321 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 struct eval_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
326 /* 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
327 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
328 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
329 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
330 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
331 event stream.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
332
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
333 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
334 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
335 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
336 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
337 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 struct misc_user_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
342 /* #### 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
343 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
344 sub-subtypes of events.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
345
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
346 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
347 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
348 button What button went down or up.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
349 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
350 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
351 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
352 generated by user actions: selections in the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
353 menubar, scrollbar actions, or drag and drop actions.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
354 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
355 (and unlike mouse motion, process output, and enter
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
356 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
357 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
358 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
359 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
360 values for other types of misc_user_events.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
361 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
362 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
363 Lisp_Object object;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
364 int button;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
365 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
366 int x, y;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 struct magic_eval_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
371 /* 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
372 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
373 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
374 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
375 anything more.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
376
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
377 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
378 object. This allows eval events to call internal
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
379 functions. For a normal eval event, this field
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
380 will always be 0.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
381 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
382
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
383 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
384 void (*internal_function) (Lisp_Object);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
385 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 #if defined (HAVE_X_WINDOWS) && defined(emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 # include <X11/Xlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
392 #ifdef HAVE_GTK
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
393 #include <gdk/gdk.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
394 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
395
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 union magic_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
398 /* 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
399 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
400 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
401 interaction with the window system.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
402
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
403 Magic_events are handled somewhat asynchronously, just like
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
404 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
405 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
406 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
407 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
408 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
409 aspect of this event model.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
410 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
411
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 #ifdef HAVE_TTY
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
413 char underlying_tty_event;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 #endif
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
415 #ifdef HAVE_GTK
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
416 GdkEvent underlying_gdk_event;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
417 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 #ifdef HAVE_X_WINDOWS
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
419 XEvent underlying_x_event;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 #ifdef HAVE_MS_WINDOWS
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
422 int underlying_mswindows_event;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 struct Lisp_Timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 {
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
428 struct lcrecord_header header;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 int id; /* Id we use to identify the timeout over its lifetime */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 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
431 be different each time the timeout is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
432 signalled.*/
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 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
434 with timeout. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 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
436 is next going to be signalled. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 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
438 should the one after that
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
439 occur? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 };
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
441 typedef struct Lisp_Timeout Lisp_Timeout;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
443 DECLARE_LRECORD (timeout, Lisp_Timeout);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
444 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 #define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout)
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 593
diff changeset
446 #define wrap_timeout(p) wrap_record (p, timeout)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 #define TIMEOUTP(x) RECORDP (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 struct Lisp_Event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 /* header->next (aka XEVENT_NEXT ()) is used as follows:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 - For dead events, this is the next dead one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 - 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
456 - Likewise for events chained in the command builder.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 - Otherwise it's Qnil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 struct lrecord_header lheader;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
460 Lisp_Object next;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
461 emacs_event_type event_type;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
462
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
463 /* 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
464 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
465 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
466 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
467 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
468 are automatically ignored.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
469
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
470 Specifically:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
471
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
472 -- 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
473 frame. (The translation to a window occurs later.)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
474
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
475 -- 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
476 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
477 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
478 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
479 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
480 command builder) will get affected.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
481
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
482 -- 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
483 be nil.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
484
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
485 -- 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
486
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
487 -- 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
488 device. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
489 Lisp_Object channel;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
490
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
491 /* 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
492 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
493 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
494 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
495 server time and real process time; yuck.) */
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 unsigned int timestamp;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 union
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
500 struct key_data key;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
501 struct button_data button;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
502 struct motion_data motion;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
503 struct process_data process;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
504 struct timeout_data timeout;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
505 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
506 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
507 union magic_data magic;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
508 struct magic_eval_data magic_eval;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 } event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
512 DECLARE_LRECORD (event, Lisp_Event);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
513 #define XEVENT(x) XRECORD (x, event, Lisp_Event)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 #define XSETEVENT(x, p) XSETRECORD (x, p, event)
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 593
diff changeset
515 #define wrap_event(p) wrap_record (p, event)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 #define EVENTP(x) RECORDP (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 DECLARE_LRECORD (command_builder, struct command_builder);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 #define EVENT_CHANNEL(a) ((a)->channel)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 #define EVENT_TYPE(a) ((a)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 #define XEVENT_TYPE(a) (XEVENT (a)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 #define EVENT_NEXT(a) ((a)->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 #define XEVENT_NEXT(e) (XEVENT (e)->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 #define XSET_EVENT_NEXT(e, n) do { (XEVENT (e)->next = (n)); } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 #define EVENT_CHAIN_LOOP(event, chain) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 for (event = chain; !NILP (event); event = XEVENT_NEXT (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
534 #define CHECK_LIVE_EVENT(x) do { \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
535 CHECK_EVENT (x); \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
536 if (! EVENT_LIVE_P (XEVENT (x))) \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
537 dead_wrong_type_argument (Qevent_live_p, (x)); \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 } while (0)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
539 #define CONCHECK_LIVE_EVENT(x) do { \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
540 CONCHECK_EVENT (x); \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
541 if (! EVENT_LIVE_P (XEVENT (x))) \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
542 x = wrong_type_argument (Qevent_live_p, (x)); \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 EXFUN (Fcharacter_to_event, 4);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 EXFUN (Fdeallocate_event, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 EXFUN (Fevent_glyph_extent, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 EXFUN (Fevent_modeline_position, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 EXFUN (Fevent_over_modeline_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 EXFUN (Fevent_over_toolbar_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 EXFUN (Fevent_over_vertical_divider_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 EXFUN (Fevent_point, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 EXFUN (Fevent_window, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 EXFUN (Fmake_event, 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 extern Lisp_Object Qcancel_mode_internal;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
560 extern Lisp_Object Vmodifier_keys_sticky_time;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
562 /* 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
563
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
564 #define XEMACS_MOD_CONTROL (1<<0)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
565 #define XEMACS_MOD_META (1<<1)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
566 #define XEMACS_MOD_SUPER (1<<2)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
567 #define XEMACS_MOD_HYPER (1<<3)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
568 #define XEMACS_MOD_ALT (1<<4)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
569 #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
570 #define XEMACS_MOD_BUTTON1 (1<<6)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
571 #define XEMACS_MOD_BUTTON2 (1<<7)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
572 #define XEMACS_MOD_BUTTON3 (1<<8)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
573 #define XEMACS_MOD_BUTTON4 (1<<9)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
574 #define XEMACS_MOD_BUTTON5 (1<<10)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
575
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
576 /* 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
577 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
578 then Alt generates XEMACS_MOD_META instead.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 #ifdef emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 /* Maybe this should be trickier */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 #define KEYSYM(x) (intern (x))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 /* from events.c */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
586 void format_event_object (char *buf, Lisp_Event *e, int brief);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
587 void character_to_event (Emchar c, Lisp_Event *event,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
588 struct console *con,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
589 int use_console_meta_flag,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
590 int do_backspace_mapping);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
591 void zero_event (Lisp_Event *e);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 void deallocate_event_chain (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 Lisp_Object event_chain_tail (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 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
597 Lisp_Object *tail);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 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
599 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
600 Lisp_Object old_chain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
601 Lisp_Object new_chain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 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
603 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 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
605 Lisp_Object event);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 Lisp_Object copy_event_chain (Lisp_Object event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 /* True if this is a non-internal event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 (keyboard press, menu, scrollbar, mouse button) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 int command_event_p (Lisp_Object event);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
611 void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
612 Emchar event_to_character (Lisp_Event *, int, int, int);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 struct console *event_console_or_selected (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 /* from event-stream.c */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
616 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
617 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
618 void event_stream_next_event (Lisp_Event *event);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
619 void event_stream_handle_magic_event (Lisp_Event *event);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 void event_stream_select_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 void event_stream_unselect_console (struct console *con);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
622 void event_stream_select_process (Lisp_Process *proc);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
623 void event_stream_unselect_process (Lisp_Process *proc);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 USID event_stream_create_stream_pair (void* inhandle, void* outhandle,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
625 Lisp_Object* instream, Lisp_Object* outstream, int flags);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 void event_stream_quit_p (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 struct low_level_timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 int id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 EMACS_TIME time;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 struct low_level_timeout *next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 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
637 EMACS_TIME thyme);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 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
639 int id);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 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
641 timeout_list, EMACS_TIME *interval);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 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
643 EMACS_TIME *time_out);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 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
645 unsigned int vanilliseconds,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
646 Lisp_Object function,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
647 Lisp_Object object,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
648 int async_p);
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
649 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
650 Lisp_Object *function, Lisp_Object *object);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 void event_stream_disable_wakeup (int id, int async_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
653 /* from signal.c */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
654 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
655 void signal_remove_async_interval_timeout (int id);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 /* from event-stream.c -- focus sanity */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 extern int focus_follows_mouse;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 void investigate_frame_change (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 Lisp_Object extract_this_command_keys_nth_mouse_event (int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 void single_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 void any_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 int in_single_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 extern int emacs_is_blocking;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 extern volatile int sigint_happened;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 #ifdef HAVE_UNIXOID_EVENT_LOOP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 /* from event-unixoid.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 /* Ceci n'est pas un pipe. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 extern int signal_event_pipe[];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 void signal_fake_event (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 void drain_signal_event_pipe (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 extern int fake_event_occurred;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 int event_stream_unixoid_select_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 int event_stream_unixoid_unselect_console (struct console *con);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
688 int event_stream_unixoid_select_process (Lisp_Process *proc);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
689 int event_stream_unixoid_unselect_process (Lisp_Process *proc);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
690 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
691 struct console *con);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
693 Lisp_Object* instream,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
694 Lisp_Object* outstream,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
695 int flags);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
697 Lisp_Object outstream);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 /* Beware: this evil macro evaluates its arg many times */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 #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
701
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 #endif /* HAVE_UNIXOID_EVENT_LOOP */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 /* 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
705 first console is tty, even if HAVE_X_WINDOWS is defined */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 /* #define DEBUG_TTY_EVENT_STREAM */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 #endif /* emacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
710 /* #### a hack, until accelerator shit is cleaned up */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
711
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
712 /* 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
713 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
714 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
715 a prefix key sequence) it executes the corresponding command.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
716 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
717 struct command_builder
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
718 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
719 struct lcrecord_header header;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
720 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
721 builder is for */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
722 #if 0
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
723 /* #### 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
724 event read after the last command completed. Threaded. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
725 Lisp_Object prefix_events;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
726 #endif /* 0 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
727 /* 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
728 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
729 freshly allocated, with no pointers to them elsewhere. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
730 Lisp_Object current_events;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
731 /* Last elt of current_events */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
732 Lisp_Object most_current_event;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
733 /* 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
734 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
735 bindings, but the prefix including this event has a nil binding.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
736 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
737 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
738 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
739 unread all of those events. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
740 Lisp_Object last_non_munged_event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
741 /* 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
742 struct munging_key_translation
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
743 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
744 /* First event that can begin a possible function key sequence
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
745 (to be translated according to function-key-map). Normally
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
746 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
747 translated a sequence through function-key-map, this will point
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
748 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
749 want to translate any events twice through function-key-map, or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
750 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
751 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
752 the first that can begin a function key sequence. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
753 Lisp_Object first_mungeable_event;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
754 } munge_me[2];
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
755
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 617
diff changeset
756 Intbyte *echo_buf;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
757 Bytecount echo_buf_length; /* size of echo_buf */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
758 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
759 * -1 before doing echoing for new cmd */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
760 /* 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
761 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
762 boundary is pushed. This variable is that counter.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
763 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
764 int self_insert_countdown;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
765 };
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
766
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
767 #endif /* INCLUDED_events_h_ */