annotate src/events.h @ 432:3a7e78e1142d r21-2-24

Import from CVS: tag r21-2-24
author cvs
date Mon, 13 Aug 2007 11:29:58 +0200
parents 3ecd8885ac67
children 8de8e3f6228a
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 #ifndef _XEMACS_EVENTS_H_
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #define _XEMACS_EVENTS_H_
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 event_streams are for dumb-ttys, and for X11 plus dumb-ttys.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 To implement this for one window system is relatively simple.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 To implement this for multiple window systems is trickier and may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 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
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 Note that these callbacks are *NOT* console methods; that's because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 the routines are not specific to a particular console type but must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 be able to simultaneously cope with all allowable console types.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 The slots of the event_stream structure:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 next_event_cb A function which fills in an XEmacs_event structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 with the next event available. If there is no event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 available, then this should block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 IMPORTANT: timer events and especially process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 events *must not* be returned if there are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 events of other types available; otherwise you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 can end up with an infinite loop in Fdiscard_input().
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 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
65 read. If called with an argument of 0, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 should say whether calling the next_event_cb will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 block. If called with an argument of 1, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 should say whether there are user-generated events
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 pending (that is, keypresses or mouse-clicks). This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 is used for redisplay optimization, among other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 things. On dumb ttys, these two results are the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 same, but under a window system, they are not.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 If this function is not sure whether there are events
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 to be read, it *must* return 0. Otherwise various
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 undesirable effects will occur, such as redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 not occurring until the next event occurs.
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 handle_magic_event_cb XEmacs calls this with an event structure which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 contains window-system dependent information that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 XEmacs doesn't need to know about, but which must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 happen in order. If the next_event_cb never returns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 an event of type "magic", this will never be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 add_timeout_cb Called with an EMACS_TIME, the absolute time at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 which a wakeup event should be generated; and a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 void *, which is an arbitrary value that will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 returned in the timeout event. The timeouts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 generated by this function should be one-shots:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 they fire once and then disappear. This callback
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 should return an int id-number which uniquely
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 identifies this wakeup. If an implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 doesn't have microseconds or millisecond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 granularity, it should round up to the closest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 value it can deal with.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 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
98 discard. This id number must have been returned by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 the add_timeout_cb. If the given wakeup has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 already expired, this should do nothing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 select_process_cb These callbacks tell the underlying implementation to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 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
104 which are polled for inferior-process input. When
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 input becomes available on the given process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 connection, an event of type "process" should be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 generated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 select_console_cb These callbacks tell the underlying implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 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
111 which are polled for user-input.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 select_device_cb These callbacks are used by Unixoid event loops
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 unselect_device_cb (those that use select() and file descriptors and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 have a separate input fd per device).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 create_stream_pair_cb These callbacks are called by process code to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 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
119 which are used for subprocess I/O.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 quitp_cb A handler function called from the `QUIT' macro which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 should check whether the quit character has been
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 typed. On systems with SIGIO, this will not be called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 unless the `sigio_happened' flag is true (it is set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 from the SIGIO handler).
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 XEmacs has its own event structures, which are distinct from the event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 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
129 event_stream layer to translate to this format.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 NOTE: #### All timestamps should be measured as milliseconds since XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 started. Currently many or most events have a 0 as their
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 timestamp value, and for other timestamps, they are raw server
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 timestamps. (The X protocol doesn't provide any easy way of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 translating between server time and real process time; yuck.)
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 Every event type has the following structures:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 channel Where this event occurred on. This will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 a frame, device, console, or nil, depending on the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 event type. It is important that an object of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 a more specific type than is actually generated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 is not substituted -- e.g. there should not be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 a frame inserted when a key-press event occurs,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 because events on dead channels are automatically
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 ignored.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 Specifically:
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 -- for button and mouse-motion events, channel
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 will be a frame. (The translation to a window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 occurs later.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 -- for keyboard events, channel will be a console.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 Note that fake keyboard events (generated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 by `character-to-event' or something that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 calls this, such as macros) need to have
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 the selected console stored into them when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 the event is created. This is so that the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 correct console-local variables (e.g. the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 command builder) will get affected.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 -- for timer, process, magic-eval, and eval events,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 channel will be nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 -- for misc-user events, channel will be a frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 -- for magic events, channel will be a frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 (usually) or a device.
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 timestamp When this event occurred -- if not known, this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 is made up.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 In addition, the following structures are specific to particular event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 types:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 key_press_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 key What keysym this is; an integer or a symbol.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 If this is an integer, it will be in the printing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 ASCII range: >32 and <127.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 modifiers Bucky-bits on that key: control, meta, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 For many keys, Shift is not a bit; that is implicit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 in the keyboard layout.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 button_press_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 button_release_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 button What button went down or up.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 modifiers Bucky-bits on that button: shift, control, meta, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 x, y Where it was at the button-state-change (in pixels).
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 pointer_motion_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 x, y Where it was after it moved (in pixels).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 modifiers Bucky-bits down when the motion was detected.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 (Possibly not all window systems will provide this?)
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 process_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 process the XEmacs "process" object in question
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 timeout_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 interval_id The ID returned when the associated call to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 add_timeout_cb() was made
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 ------ the rest of the fields are filled in by XEmacs -----
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 id_number The XEmacs timeout ID for this timeout (more
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 than one timeout event can have the same value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 here, since XEmacs timeouts, as opposed to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 add_timeout_cb() timeouts, can resignal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 themselves)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 function An elisp function to call when this timeout is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 processed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 object The object passed to that function.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 eval_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 function An elisp function to call with this event object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 internal_function An unexported function to call with this event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 object. This allows eval events to call internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 functions. For a normal eval event, this field
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 will always be 0.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 object Anything.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 This kind of event is used internally; sometimes the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 window system interface would like to inform XEmacs of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 some user action (such as focusing on another frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 but needs that to happen synchronously with the other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 user input, like keypresses. This is useful when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 events are reported through callbacks rather
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 than in the standard event stream.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 misc_user_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 function An elisp function to call with this event object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 internal_function Ignored.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 object Anything.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 button What button went down or up.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 modifiers Bucky-bits on that button: shift, control, meta, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 x, y Where it was at the button-state-change (in pixels).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 This is similar to an eval_event, except that it is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 generated by user actions: selections in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 menubar, scrollbar actions, or drag and drop actions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 It is a "command" event, like key and mouse presses
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 (and unlike mouse motion, process output, and enter
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 and leave window hooks). In many ways, eval_events
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 are not the same as keypresses or misc_user_events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 The button, modifiers, x, and y parts are only used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 by the XEmacs Drag'n'Drop system. Don't depend on their
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 values for other types of misc_user_events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 magic_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 No user-serviceable parts within. This is for things
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 like KeymapNotify and ExposeRegion events and so on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 that XEmacs itself doesn't care about, but which it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 must do something with for proper interaction with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 the window system.
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 Magic_events are handled somewhat asynchronously, just
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 like subprocess filters. However, occasionally a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 magic_event needs to be handled synchronously; in that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 case, the asynchronous handling of the magic_event will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 push an eval_event back onto the queue, which will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 handled synchronously later. This is one of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 reasons why eval_events exist; I'm not entirely happy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 with this aspect of this event model.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 magic_eval_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 This is like an eval event but its contents are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 not Lisp-accessible. This allows for "internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 eval events" that call non-Lisp-accessible functions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 Externally, a magic_eval_event just appears as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 a magic_event; the Lisp programmer need not know
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 anything more.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 Stream pairs description
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 ------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 Since there are many possible processes/event loop combinations, the event code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 is responsible for creating an appropriate lstream type. The process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 implementation does not care about that implementation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 The Create stream pair function is passed two void* values, which identify
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 process-dependent 'handles'. The process implementation uses these handles
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 to communicate with child processes. The function must be prepared to receive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 handle types of any process implementation. Since there only one process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 implementation exists in a particular XEmacs configuration, preprocessing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 is a mean of compiling in the support for the code which deals with particular
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 handle types.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 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
284 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
285 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
286 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
287 system with X-Windows. In this case, Win32 process implementation passes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 handles of type HANDLE, and the create_stream_pair function must call
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 appropriate function to get file descriptors given HANDLEs, so that these
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 descriptors may be passed to XtAddInput.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 The handle given may have special denying value, in which case the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 corresponding lstream should not be created.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 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
296 by processes implementation, in its platform-independent part. There is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 the get_process_from_usid function, which returns process object given its
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 USID. The event stream is responsible for converting its internal handle
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 type into USID.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 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
302 event loop must determine process to which the input is destined. Thus,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 the implementation uses process input stream file descriptor as USID, by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 simply casting the fd value to USID type.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 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
307 pair cannot be created. The second, USID_DONTHASH, indicates that streams are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 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
309 by its USID. Specifically, if an event stream implementation never calls
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 get_process_from_usid, this value should always be returned, to prevent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 accumulating useless information on USID to process relationship.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 /* typedef unsigned int USID; in lisp.h */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 #define USID_ERROR ((USID)-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 #define USID_DONTHASH ((USID)0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 struct Lisp_Event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 struct Lisp_Process;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 struct event_stream
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 int (*event_pending_p) (int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 void (*next_event_cb) (struct Lisp_Event *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 void (*handle_magic_event_cb) (struct Lisp_Event *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 int (*add_timeout_cb) (EMACS_TIME);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 void (*remove_timeout_cb) (int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 void (*select_console_cb) (struct console *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 void (*unselect_console_cb) (struct console *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 void (*select_process_cb) (struct Lisp_Process *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 void (*unselect_process_cb) (struct Lisp_Process *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 void (*quit_p_cb) (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 Lisp_Object* /* instream */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 Lisp_Object* /* outstream */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 int /* flags */);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 USID (*delete_stream_pair_cb) (Lisp_Object /* instream */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 Lisp_Object /* outstream */);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 /* Flags for create_stream_pair_cb() FLAGS parameter */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 #define STREAM_PTY_FLUSHING 0x0001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 #define STREAM_NETWORK_CONNECTION 0x0002
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 extern struct event_stream *event_stream;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 typedef enum emacs_event_type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 empty_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 key_press_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 button_press_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 button_release_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 pointer_motion_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 process_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 timeout_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 magic_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 magic_eval_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 eval_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 misc_user_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 dead_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 } emacs_event_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 #define first_event_type empty_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 #define last_event_type dead_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366
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 struct key_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 Lisp_Object keysym;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 unsigned char modifiers;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 struct button_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 int button;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 unsigned char modifiers;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 struct motion_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 unsigned char modifiers;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 };
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 struct process_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 Lisp_Object process;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 struct timeout_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 int interval_id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 int id_number;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 Lisp_Object function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 Lisp_Object object;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 struct eval_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 Lisp_Object function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 Lisp_Object object;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 struct misc_user_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 Lisp_Object function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 Lisp_Object object;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 int button;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 unsigned char modifiers;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 int x, y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 struct magic_eval_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 void (*internal_function) (Lisp_Object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 Lisp_Object object;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 #if defined (HAVE_X_WINDOWS) && defined(emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 # include <X11/Xlib.h>
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 union magic_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 #ifdef HAVE_TTY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 char underlying_tty_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 #ifdef HAVE_X_WINDOWS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 XEvent underlying_x_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 #ifdef HAVE_MS_WINDOWS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 int underlying_mswindows_event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 struct Lisp_Timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 {
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
440 struct lcrecord_header header;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 int id; /* Id we use to identify the timeout over its lifetime */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 int interval_id; /* Id for this particular interval; this may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 be different each time the timeout is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 signalled.*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 Lisp_Object function, object; /* Function and object associated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 with timeout. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 EMACS_TIME next_signal_time; /* Absolute time when the timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 is next going to be signalled. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 unsigned int resignal_msecs; /* How far after the next timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 should the one after that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 occur? */
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 DECLARE_LRECORD (timeout, struct Lisp_Timeout);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 #define XTIMEOUT(x) XRECORD (x, timeout, struct Lisp_Timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 #define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 #define TIMEOUTP(x) RECORDP (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 struct Lisp_Event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 /* header->next (aka XEVENT_NEXT ()) is used as follows:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 - For dead events, this is the next dead one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 - 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
466 - Likewise for events chained in the command builder.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 - Otherwise it's Qnil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 struct lrecord_header lheader;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 Lisp_Object next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 emacs_event_type event_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 Lisp_Object channel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 unsigned int timestamp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 union
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 struct key_data key;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 struct button_data button;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 struct motion_data motion;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 struct process_data process;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 struct timeout_data timeout;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 struct eval_data eval; /* misc_user_event no longer uses this */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 struct misc_user_data misc; /* because it needs position information */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 union magic_data magic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 struct magic_eval_data magic_eval;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 } event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 DECLARE_LRECORD (event, struct Lisp_Event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 #define XEVENT(x) XRECORD (x, event, struct Lisp_Event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 #define XSETEVENT(x, p) XSETRECORD (x, p, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 #define EVENTP(x) RECORDP (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 DECLARE_LRECORD (command_builder, struct command_builder);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 #define EVENT_CHANNEL(a) ((a)->channel)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 #define EVENT_TYPE(a) ((a)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 #define XEVENT_TYPE(a) (XEVENT (a)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 #define EVENT_NEXT(a) ((a)->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 #define XEVENT_NEXT(e) (XEVENT (e)->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 #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
503
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 #define EVENT_CHAIN_LOOP(event, chain) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 for (event = chain; !NILP (event); event = XEVENT_NEXT (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 #define CHECK_LIVE_EVENT(x) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 CHECK_EVENT (x); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 if (! EVENT_LIVE_P (XEVENT (x))) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 dead_wrong_type_argument (Qevent_live_p, (x)); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 #define CONCHECK_LIVE_EVENT(x) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 CONCHECK_EVENT (x); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 if (! EVENT_LIVE_P (XEVENT (x))) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 x = wrong_type_argument (Qevent_live_p, (x)); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 } while (0)
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 EXFUN (Fcharacter_to_event, 4);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 EXFUN (Fdeallocate_event, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 EXFUN (Fevent_glyph_extent, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 EXFUN (Fevent_modeline_position, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 EXFUN (Fevent_over_modeline_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 EXFUN (Fevent_over_toolbar_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 EXFUN (Fevent_over_vertical_divider_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 EXFUN (Fevent_point, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 EXFUN (Fevent_window, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 EXFUN (Fmake_event, 2);
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 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 extern Lisp_Object Qcancel_mode_internal;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 /* Note: under X Windows, MOD_ALT is generated by the Alt key if there are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 both Alt and Meta keys. If there are no Meta keys, then Alt generates
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 MOD_META instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 #ifdef emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 /* Maybe this should be trickier */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 #define KEYSYM(x) (intern (x))
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 /* from events.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 void format_event_object (char *buf, struct Lisp_Event *e, int brief);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 void character_to_event (Emchar c, struct Lisp_Event *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 struct console *con,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 int use_console_meta_flag,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 int do_backspace_mapping);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 void zero_event (struct Lisp_Event *e);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 void deallocate_event_chain (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 Lisp_Object event_chain_tail (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 int event_chain_count (Lisp_Object event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 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
560 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 Lisp_Object event_chain_find_previous (Lisp_Object event_chain,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 Lisp_Object copy_event_chain (Lisp_Object event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 /* True if this is a non-internal event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 (keyboard press, menu, scrollbar, mouse button) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 int command_event_p (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 struct console *event_console_or_selected (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 /* from event-stream.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 Lisp_Object allocate_command_builder (Lisp_Object console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 void event_stream_next_event (struct Lisp_Event *event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 void event_stream_handle_magic_event (struct Lisp_Event *event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 void event_stream_select_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 void event_stream_unselect_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 void event_stream_select_process (struct Lisp_Process *proc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 void event_stream_unselect_process (struct Lisp_Process *proc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 USID event_stream_create_stream_pair (void* inhandle, void* outhandle,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 Lisp_Object* instream, Lisp_Object* outstream, int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 void event_stream_quit_p (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 struct low_level_timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 int id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 EMACS_TIME time;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 struct low_level_timeout *next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 int add_low_level_timeout (struct low_level_timeout **timeout_list,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 EMACS_TIME thyme);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 void remove_low_level_timeout (struct low_level_timeout **timeout_list,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 int id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 int get_low_level_timeout_interval (struct low_level_timeout *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 timeout_list, EMACS_TIME *interval);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 int pop_low_level_timeout (struct low_level_timeout **timeout_list,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 EMACS_TIME *time_out);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 int event_stream_generate_wakeup (unsigned int milliseconds,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 unsigned int vanilliseconds,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 Lisp_Object function,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 Lisp_Object object,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 int async_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 void event_stream_disable_wakeup (int id, int async_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 void event_stream_deal_with_async_timeout (int interval_id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 int event_stream_add_async_timeout (EMACS_TIME thyme);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 void event_stream_remove_async_timeout (int id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 /* from event-stream.c -- focus sanity */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 extern int focus_follows_mouse;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 void investigate_frame_change (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 Lisp_Object extract_this_command_keys_nth_mouse_event (int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 void single_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 void any_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 int in_single_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 extern int emacs_is_blocking;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 extern volatile int sigint_happened;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 #ifdef HAVE_UNIXOID_EVENT_LOOP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 /* from event-unixoid.c */
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 /* Ceci n'est pas un pipe. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 extern int signal_event_pipe[];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 void signal_fake_event (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 void drain_signal_event_pipe (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 extern int fake_event_occurred;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 int event_stream_unixoid_select_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 int event_stream_unixoid_unselect_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 int event_stream_unixoid_select_process (struct Lisp_Process *proc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 int event_stream_unixoid_unselect_process (struct Lisp_Process *proc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 int read_event_from_tty_or_stream_desc (struct Lisp_Event *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 struct console *con, int fd);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 Lisp_Object* instream,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 Lisp_Object* outstream,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 Lisp_Object outstream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 /* Beware: this evil macro evaluates its arg many times */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 #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
654
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 #endif /* HAVE_UNIXOID_EVENT_LOOP */
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 /* 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
658 first console is tty, even if HAVE_X_WINDOWS is defined */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 /* #define DEBUG_TTY_EVENT_STREAM */
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 #endif /* emacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 #endif /* _XEMACS_EVENTS_H_ */