annotate src/events.h @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Definitions for the new event model;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 created 16-jul-91 by Jamie Zawinski
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #ifndef _XEMACS_EVENTS_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #define _XEMACS_EVENTS_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include "systime.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 /* There is one object, called an event_stream. This object contains
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 callback functions for doing the window-system dependent operations that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 XEmacs requires.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 If XEmacs is compiled with support for X11 and the X Toolkit, then this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 event_stream structure will contain functions that can cope with input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 on XEmacs windows on multiple displays, as well as input from dumb tty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 If it is desired to have XEmacs able to open frames on the displays of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 multiple heterogeneous machines, X11 and SunView, or X11 and NeXT, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 example, then it will be necessary to construct an event_stream structure
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 that can cope with the given types. Currently, the only implemented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 event_streams are for dumb-ttys, and for X11 plus dumb-ttys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 To implement this for one window system is relatively simple.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 To implement this for multiple window systems is trickier and may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 not be possible in all situations, but it's been done for X and TTY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 Note that these callbacks are *NOT* console methods; that's because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 the routines are not specific to a particular console type but must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 be able to simultaneously cope with all allowable console types.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 The slots of the event_stream structure:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 next_event_cb A function which fills in an XEmacs_event struture
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 with the next event available. If there is no event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 available, then this should block.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 IMPORTANT: timer events and especially process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 events *must not* be returned if there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 events of other types available; otherwise you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 can end up with an infinite loop in Fdiscard_input().
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 event_pending_cb A function which says whether there are events to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 read. If called with an argument of 0, then this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 should say whether calling the next_event_cb will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 block. If called with an argument of 1, then this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 should say whether there are user-generated events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 pending (that is, keypresses or mouse-clicks). This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 is used for redisplay optimization, among other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 things. On dumb ttys, these two results are the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 same, but under a window system, they are not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 If this function is not sure whether there are events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 to be read, it *must* return 0. Otherwise various
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 undesirable effects will occur, such as redisplay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 not occurring until the next event occurs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 handle_magic_event_cb XEmacs calls this with an event structure which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 contains window-system dependent information that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 XEmacs doesn't need to know about, but which must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 happen in order. If the next_event_cb never returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 an event of type "magic", this will never be used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 add_timeout_cb Called with an EMACS_TIME, the absolute time at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 which a wakeup event should be generated; and a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 void *, which is an arbitrary value that will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 returned in the timeout event. The timeouts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 generated by this function should be one-shots:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 they fire once and then disappear. This callback
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 should return an int id-number which uniquely
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 identifies this wakeup. If an implementation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 doesn't have microseconds or millisecond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 granularity, it should round up to the closest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 value it can deal with.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 remove_timeout_cb Called with an int, the id number of a wakeup to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 discard. This id number must have been returned by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 the add_timeout_cb. If the given wakeup has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 already expired, this should do nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 select_process_cb These callbacks tell the underlying implementation to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 unselect_process_cb add or remove a file descriptor from the list of fds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 which are polled for inferior-process input. When
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 input becomes available on the given process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 connection, an event of type "process" should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 generated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 select_console_cb These callbacks tell the underlying implementation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 unselect_console_cb to add or remove a console from the list of consoles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 which are polled for user-input.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 select_device_cb These callbacks are used by Unixoid event loops
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 unselect_device_cb (those that use select() and file descriptors and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 have a separate input fd per device).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 quitp_cb A handler function called from the `QUIT' macro which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 should check whether the quit character has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 typed. On systems with SIGIO, this will not be called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 unless the `sigio_happened' flag is true (it is set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 from the SIGIO handler).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 XEmacs has its own event structures, which are distinct from the event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 structures used by X or any other window system. It is the job of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 event_stream layer to translate to this format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 NOTE: #### All timestamps should be measured as milliseconds since XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 started. Currently many or most events have a 0 as their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 timestamp value, and for other timestamps, they are raw server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 timestamps. (The X protocol doesn't provide any easy way of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 translating between server time and real process time; yuck.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 Every event type has the following structures:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 channel Where this event occurred on. This will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 a frame, device, console, or nil, depending on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 event type. It is important that an object of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 a more specific type than is actually generated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 is not substituted -- e.g. there should not be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 a frame inserted when a key-press event occurs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 because events on dead channels are automatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 Specifically:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 -- for button and mouse-motion events, channel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 will be a frame. (The translation to a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 occurs later.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 -- for keyboard events, channel will be a console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 Note that fake keyboard events (generated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 by `character-to-event' or something that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 calls this, such as macros) need to have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 the selected console stored into them when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 the event is created. This is so that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 correct console-local variables (e.g. the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 command builder) will get affected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 -- for timer, process, magic-eval, and eval events,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 channel will be nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 -- for scrollbar misc-user events, channel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 will be a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 -- for menubar misc-user events, channel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 will be a frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 -- for magic events, channel will be a frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (usually) or a device.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 timestamp When this event occurred -- if not known, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 is made up.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 In addition, the following structures are specific to particular event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 types:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 key_press_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 key What keysym this is; an integer or a symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 If this is an integer, it will be in the printing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ASCII range: >32 and <127.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 modifiers Bucky-bits on that key: control, meta, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 For most keys, Shift is not a bit; that is implicit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 in the keyboard layout.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 button_press_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 button_release_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 button What button went down or up.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 modifiers Bucky-bits on that button: shift, control, meta, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 x, y Where it was at the button-state-change (in pixels).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 pointer_motion_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 x, y Where it was after it moved (in pixels).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 modifiers Bucky-bits down when the motion was detected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (Possibly not all window systems will provide this?)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 process_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 process the XEmacs "process" object in question
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 timeout_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 interval_id The ID returned when the associated call to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 add_timeout_cb() was made
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ------ the rest of the fields are filled in by XEmacs -----
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 id_number The XEmacs timeout ID for this timeout (more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 than one timeout event can have the same value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 here, since XEmacs timeouts, as opposed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 add_timeout_cb() timeouts, can resignal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 themselves)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 function An elisp function to call when this timeout is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 processed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 object The object passed to that function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 eval_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 function An elisp function to call with this event object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 internal_function An unexported function to call with this event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 object. This allows eval events to call internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 functions. For a normal eval event, this field
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 will always be 0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 object Anything.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 This kind of event is used internally; sometimes the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 window system interface would like to inform XEmacs of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 some user action (such as focusing on another frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 but needs that to happen synchronously with the other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 user input, like keypresses. This is useful when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 events are reported through callbacks rather
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 than in the standard event stream.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 misc_user_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 function An elisp function to call with this event object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 internal_function Ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 object Anything.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 This is similar to an eval_event, except that it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 generated by user actions: selections in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 menubar or scrollbar actions. It is a "command"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 event, like key and mouse presses (and unlike mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 motion, process output, and enter and leave window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 hooks). In many ways, eval_events are not the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 as keypresses or misc_user_events.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 magic_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 No user-serviceable parts within. This is for things
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 like KeymapNotify and ExposeRegion events and so on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 that XEmacs itself doesn't care about, but which it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 must do something with for proper interaction with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 the window system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 Magic_events are handled somewhat asynchronously, just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 like subprocess filters. However, occasionally a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 magic_event needs to be handled synchronously; in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 case, the asynchronous handling of the magic_event will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 push an eval_event back onto the queue, which will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 handled synchronously later. This is one of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 reasons why eval_events exist; I'm not entirely happy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 with this aspect of this event model.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 magic_eval_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 This is like an eval event but its contents are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 not Lisp-accessible. This allows for "internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 eval events" that call non-Lisp-accessible functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 Externally, a magic_eval_event just appears as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 a magic_event; the Lisp programmer need not know
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 anything more.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 struct Lisp_Event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 struct Lisp_Process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 struct event_stream
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 int (*event_pending_p) (int);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 void (*next_event_cb) (struct Lisp_Event *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 void (*handle_magic_event_cb) (struct Lisp_Event *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 int (*add_timeout_cb) (EMACS_TIME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 void (*remove_timeout_cb) (int);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 void (*select_console_cb) (struct console *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 void (*unselect_console_cb) (struct console *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 void (*select_process_cb) (struct Lisp_Process *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 void (*unselect_process_cb) (struct Lisp_Process *);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 void (*quit_p_cb) (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 extern struct event_stream *event_stream;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 typedef enum emacs_event_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 empty_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 key_press_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 button_press_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 button_release_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 pointer_motion_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 process_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 timeout_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 magic_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 magic_eval_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 eval_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 misc_user_event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 dead_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 } emacs_event_type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 #define first_event_type empty_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 #define last_event_type dead_event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 struct key_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 Lisp_Object keysym;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 unsigned char modifiers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 struct button_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 int button;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 unsigned char modifiers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 int x, y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 struct motion_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 int x, y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 unsigned char modifiers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 struct process_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 Lisp_Object process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 struct timeout_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 int interval_id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 int id_number;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 Lisp_Object function, object;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 struct eval_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 Lisp_Object function;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 Lisp_Object object;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 struct magic_eval_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 void (*internal_function) (Lisp_Object);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 Lisp_Object object;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 #if defined (HAVE_X_WINDOWS) && defined(emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 # include <X11/Xlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 #if defined (HAVE_NEXTSTEP) && defined(emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 # import <appkit/appkit.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 union magic_data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 char underlying_tty_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 #ifdef HAVE_X_WINDOWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 XEvent underlying_x_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 #ifdef HAVE_NEXTSTEP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 NXEvent underlying_ns_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 struct Lisp_Event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 /* header->next (aka XEVENT_NEXT ()) is used as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 - For dead events, this is the next dead one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 - For events on the command_event_queue, the next one on the queue.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 - Likewise for events chained in the command builder.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 - Otherwise it's Qnil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 struct lrecord_header lheader;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 Lisp_Object next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 emacs_event_type event_type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 Lisp_Object channel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 unsigned int timestamp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 union
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 struct key_data key;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 struct button_data button;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 struct motion_data motion;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 struct process_data process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 struct timeout_data timeout;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 struct eval_data eval; /* misc_user_event uses this too */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 union magic_data magic;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 struct magic_eval_data magic_eval;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 } event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 DECLARE_LRECORD (event, struct Lisp_Event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 #define XEVENT(x) XRECORD (x, event, struct Lisp_Event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 #define XSETEVENT(x, p) XSETRECORD (x, p, event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 #define EVENTP(x) RECORDP (x, event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 #define GC_EVENTP(x) GC_RECORDP (x, event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 DECLARE_LRECORD (command_builder, struct command_builder);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 #define EVENT_CHANNEL(a) ((a)->channel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 #define EVENT_TYPE(a) ((a)->event_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 #define XEVENT_TYPE(a) (XEVENT (a)->event_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 #define EVENT_NEXT(a) ((a)->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 #define XEVENT_NEXT(e) (XEVENT (e)->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 #define XSET_EVENT_NEXT(e, n) do { (XEVENT (e)->next = (n)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 #define EVENT_CHAIN_LOOP(event, chain) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 for (event = chain; !NILP (event); event = XEVENT_NEXT (event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 #define CHECK_LIVE_EVENT(x) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 do { CHECK_EVENT (x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 if (! EVENTP (x) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 || ! EVENT_LIVE_P (XEVENT (x))) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 dead_wrong_type_argument (Qevent_live_p, (x)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 #define CONCHECK_LIVE_EVENT(x) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 do { CONCHECK_EVENT (x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 if (! EVENTP (x) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 || ! EVENT_LIVE_P (XEVENT (x))) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 x = wrong_type_argument (Qevent_live_p, (x)); } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 extern Lisp_Object Qevent_live_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 /* The modifiers XEmacs knows about; these appear in key and button events.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 #define MOD_CONTROL (1<<0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 #define MOD_META (1<<1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 #define MOD_SUPER (1<<2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 #define MOD_HYPER (1<<3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 #define MOD_ALT (1<<4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 #define MOD_SHIFT (1<<5) /* not used for dual-case characters */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 /* Note: under X Windows, MOD_ALT is generated by the Alt key if there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 both Alt and Meta keys. If there are no Meta keys, then Alt generates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 MOD_META instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 #ifdef emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 /* Maybe this should be trickier */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 #define KEYSYM(x) (intern (x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 Lisp_Object allocate_command_builder (Lisp_Object console);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 void format_event_object (char *buf, struct Lisp_Event *e, int brief);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 void character_to_event (Emchar c, struct Lisp_Event *event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 struct console *con,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 int use_console_meta_flag);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 void zero_event (struct Lisp_Event *e);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 void deallocate_event_chain (Lisp_Object event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 Lisp_Object event_chain_tail (Lisp_Object event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 Lisp_Object *tail);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 int event_chain_count (Lisp_Object event_chain);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 Lisp_Object event_chain_find_previous (Lisp_Object event_chain,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 Lisp_Object event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 Lisp_Object copy_event_chain (Lisp_Object event_chain);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 /* True is this is a non-internal event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (keyboard press, menu, scrollbar, mouse button) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 int command_event_p (Lisp_Object event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 struct console *event_console_or_selected (Lisp_Object event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 int event_stream_event_pending_p (int user);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 void event_stream_next_event (struct Lisp_Event *event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 void event_stream_handle_magic_event (struct Lisp_Event *event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 void event_stream_select_console (struct console *c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 void event_stream_unselect_console (struct console *c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 void event_stream_select_process (struct Lisp_Process *proc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 void event_stream_unselect_process (struct Lisp_Process *proc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 void event_stream_quit_p (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 struct low_level_timeout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 int id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 EMACS_TIME time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 struct low_level_timeout *next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 int add_low_level_timeout (struct low_level_timeout **timeout_list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 EMACS_TIME thyme);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 void remove_low_level_timeout (struct low_level_timeout **timeout_list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 int id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 int get_low_level_timeout_interval (struct low_level_timeout *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 timeout_list, EMACS_TIME *interval);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 int pop_low_level_timeout (struct low_level_timeout **timeout_list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 EMACS_TIME *time_out);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 int event_stream_generate_wakeup (unsigned int milliseconds,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 unsigned int vanilliseconds,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 Lisp_Object function,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 Lisp_Object object,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 int async_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 void event_stream_disable_wakeup (int id, int async_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 void event_stream_deal_with_async_timeout (int interval_id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 /* from signal.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 int event_stream_add_async_timeout (EMACS_TIME thyme);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 void event_stream_remove_async_timeout (int id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 Lisp_Object extract_this_command_keys_nth_mouse_event (int n);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 void single_console_state (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 void any_console_state (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 int in_single_console_state (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 #ifdef HAVE_UNIXOID_EVENT_LOOP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 /* Ceci n'est pas un pipe. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 extern int signal_event_pipe[];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 void signal_fake_event (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 void drain_signal_event_pipe (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 extern int fake_event_occurred;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 int event_stream_unixoid_select_console (struct console *con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 int event_stream_unixoid_unselect_console (struct console *con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 int event_stream_unixoid_select_process (struct Lisp_Process *proc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 int event_stream_unixoid_unselect_process (struct Lisp_Process *proc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 int read_event_from_tty_or_stream_desc (struct Lisp_Event *event,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 struct console *c, int fd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 #endif /* HAVE_UNIXOID_EVENT_LOOP */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 extern int emacs_is_blocking;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 extern Lisp_Object Vcontrolling_terminal;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 extern volatile int sigint_happened;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 /* Define this if you want the tty event stream to be used when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 first console is tty, even if HAVE_X_WINDOWS is defined */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 /* #define DEBUG_TTY_EVENT_STREAM */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 #endif /* emacs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 #endif /* _XEMACS_EVENTS_H_ */