annotate src/events.h @ 1268:fffe735e63ee

[xemacs-hg @ 2003-02-07 11:50:50 by ben] fixes for menu crashes + better preemption behavior This contains two related changes: (1) Fix problems with reentrant calling of lwlib and associated crashes when selecting menu items. (2) Improve redisplay handling of preemption. Turn on lazy lock and hold down page-down or page-up and you'll see what I mean. They are related because they both touch on the code that retrieves events and handles the internal queues. console-msw.h, event-msw.c, event-stream.c, events.h, menubar-msw.c, menubar-x.c, menubar.h: mswindows_protect_modal_loop() has been generalized to event_stream_protect_modal_loop(), and moved to event-stream.c. mswindows_in_modal_loop ->in_modal_loop likewise. Changes in event-msw.c and menubar-msw.c for the new names and calling format (use structures instead of static variables in menubar-msw.c). Delete former in_menu_callback and use in_modal_loop in its place. Remove emacs_mswindows_quit_check_disallowed_p(), superseded by in_modal_loop. Use event_stream_protect_modal_loop() in pre_activate_callback() so that we get no lwlib reentrancy. Rearrange some of the code in event-msw.c to be grouped better. Make mswindows_drain_windows_queue() respect in_modal_loop and do nothing if so. cmdloop.c, event-stream.c: Don't conditionalize on LWLIB_MENUBARS_LUCID when giving error when in_modal_loop, and give better error. event-Xt.c, event-gtk.c: If in_modal_loop, only retrieve process and timeout events. Don't retrieve any X events because processing them can lead to reentrancy in lwlib -> death. event-stream.c: Remove unused parameter to check_event_stream_ok() and change all callers. lisp.h, event-stream.c: Rearrange some functions for increased clarity -- in particular, group all the input-pending/QUIT-related stuff together, and put right next to next-event stuff, to which it's related. Add the concept of "HOW_MANY" -- when asking whether user input is pending, you can ask if at least HOW_MANY events are pending, not just if any are. Add parameter to detect_input_pending() for this. Change recursive_sit_for from a Lisp_Object (which could only be Qt or Qnil) to an int, like it should be. event-Xt.c, event-gtk.c, event-xlike-inc.c: New file. Abstract out similar code in event_{Xt/gtk}_pending_p() and write only once, using include-file tricks. Rewrite this function to implement HOW_MANY and only process events when not in_modal_loop. event-msw.c: Implement HOW_MANY and only process events when not in_modal_loop. event-tty.c: Implement HOW_MANY. redisplay.c: Add var `max-preempts' to control maximum number of preempts. (#### perhaps not useful) Rewrite preemption check so that, rather than preempting when any user events are available, only preempt when a certain number (currently 4) of them are backed up. This effectively allows redisplay to proceed to completion in the presence of a fast auto-repeat (usually the auto-repeating is generated dynamically as necessary), and you get much better display behavior with lazy-lock active. event-unixoid.c: Comment changes. event-stream.c: Rewrite discard-input much more simply and safely using the drain-queue functions. I think the old version might loop forever if called when in_modal_loop. SEMI-UNRELATED CHANGES: ----------------------- event-stream.c: Turn QUIT-checking back on when running the pre-idle hook so it can be quit out of. indent.c: Document exact functioning of `vertical-motion' better, and its differences from GNU Emacs.
author ben
date Fri, 07 Feb 2003 11:50:54 +0000
parents 416490619c01
children ecf1ebac70d8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Definitions for the new event model;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 created 16-jul-91 by Jamie Zawinski
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
4 Copyright (C) 1995, 1996, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
25 #ifndef INCLUDED_events_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
26 #define INCLUDED_events_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "systime.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 /* There is one object called an event_stream. This object contains
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 callback functions for doing the window-system-dependent operations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 that XEmacs requires.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 If XEmacs is compiled with support for X11 and the X Toolkit, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 event_stream structure will contain functions that can cope with input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 on XEmacs windows on multiple displays, as well as input from dumb tty
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 If it is desired to have XEmacs able to open frames on the displays of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 multiple heterogeneous machines, X11 and SunView, or X11 and NeXT, for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 example, then it will be necessary to construct an event_stream structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 that can cope with the given types. Currently, the only implemented
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
43 event_streams are for dumb-ttys, and for X11 plus dumb-ttys,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
44 and for mswindows.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 To implement this for one window system is relatively simple.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 To implement this for multiple window systems is trickier and may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 not be possible in all situations, but it's been done for X and TTY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 Note that these callbacks are *NOT* console methods; that's because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 the routines are not specific to a particular console type but must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 be able to simultaneously cope with all allowable console types.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 The slots of the event_stream structure:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 next_event_cb A function which fills in an XEmacs_event structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 with the next event available. If there is no event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 available, then this should block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 IMPORTANT: timer events and especially process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 events *must not* be returned if there are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 events of other types available; otherwise you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 can end up with an infinite loop in Fdiscard_input().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 event_pending_cb A function which says whether there are events to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 read. If called with an argument of 0, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 should say whether calling the next_event_cb will
1268
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
68 block. If called with a non-zero argument, then this
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
69 should say whether there are that many user-generated
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
70 events pending (that is, keypresses, mouse-clicks,
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
71 dialog-box selection events, etc.). (This is used for
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
72 redisplay optimization, among other things.) The
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
73 difference is that the former includes process events
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
74 and timer events, but the latter doesn't.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 If this function is not sure whether there are events
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 to be read, it *must* return 0. Otherwise various
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 undesirable effects will occur, such as redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 not occurring until the next event occurs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 handle_magic_event_cb XEmacs calls this with an event structure which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 contains window-system dependent information that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 XEmacs doesn't need to know about, but which must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 happen in order. If the next_event_cb never returns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 an event of type "magic", this will never be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
87 format_magic_event_cb Called with a magic event; print a representation of
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
88 the innards of the event to PSTREAM.
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
89
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
90 compare_magic_event_cb Called with two magic events; return non-zero if
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
91 the innards of the two are equal, zero otherwise.
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
92
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
93 hash_magic_event_cb Called with a magic event; return a hash of the
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
94 innards of the event.
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
95
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 add_timeout_cb Called with an EMACS_TIME, the absolute time at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 which a wakeup event should be generated; and a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 void *, which is an arbitrary value that will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 returned in the timeout event. The timeouts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 generated by this function should be one-shots:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 they fire once and then disappear. This callback
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 should return an int id-number which uniquely
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 identifies this wakeup. If an implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 doesn't have microseconds or millisecond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 granularity, it should round up to the closest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 value it can deal with.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 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
109 discard. This id number must have been returned by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 the add_timeout_cb. If the given wakeup has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 already expired, this should do nothing.
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_process_cb These callbacks tell the underlying implementation to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 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
115 which are polled for inferior-process input. When
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 input becomes available on the given process
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 connection, an event of type "process" should be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 generated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 select_console_cb These callbacks tell the underlying implementation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 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
122 which are polled for user-input.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 select_device_cb These callbacks are used by Unixoid event loops
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 unselect_device_cb (those that use select() and file descriptors and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 have a separate input fd per device).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
128 create_io_streams_cb These callbacks are called by process code to
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
129 delete_io_streams_cb create the input and output lstreams which are used
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
130 for subprocess I/O.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 quitp_cb A handler function called from the `QUIT' macro which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 should check whether the quit character has been
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 typed. On systems with SIGIO, this will not be called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 unless the `sigio_happened' flag is true (it is set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 from the SIGIO handler).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 XEmacs has its own event structures, which are distinct from the event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 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
140 event_stream layer to translate to this format.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 Stream pairs description
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 ------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
147 Since there are many possible processes/event loop combinations, the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
148 event code is responsible for creating an appropriate lstream type. The
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
149 process implementation does not care about that implementation.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
151 The Create stream pair function is passed two void* values, which
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
152 identify process-dependent 'handles'. The process implementation uses
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
153 these handles to communicate with child processes. The function must be
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
154 prepared to receive handle types of any process implementation. Since
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
155 only one process implementation exists in a particular XEmacs
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
156 configuration, preprocessing is a means of compiling in the support for
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
157 the code which deals with particular handle types.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 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
160 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
161 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
162 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
163 system with X-Windows. In this case, Win32 process implementation passes
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
164 handles of type HANDLE, and the create_io_streams function must call
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 appropriate function to get file descriptors given HANDLEs, so that these
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 descriptors may be passed to XtAddInput.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 The handle given may have special denying value, in which case the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 corresponding lstream should not be created.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 The 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
172 by processes implementation, in its platform-independent part. There is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 the get_process_from_usid function, which returns process object given its
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 USID. The event stream is responsible for converting its internal handle
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 type into USID.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 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
178 event loop must determine process to which the input is destined. Thus,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 the implementation uses process input stream file descriptor as USID, by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 simply casting the fd value to USID type.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 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
183 pair cannot be created. The second, USID_DONTHASH, indicates that streams are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 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
185 by its USID. Specifically, if an event stream implementation never calls
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 get_process_from_usid, this value should always be returned, to prevent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 accumulating useless information on USID to process relationship.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 /* typedef unsigned int USID; in lisp.h */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 #define USID_ERROR ((USID)-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 #define USID_DONTHASH ((USID)0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193
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 struct event_stream
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 int (*event_pending_p) (int);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
198 void (*next_event_cb) (Lisp_Event *);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
199 void (*handle_magic_event_cb) (Lisp_Event *);
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
200 void (*format_magic_event_cb) (Lisp_Event *, Lisp_Object pstream);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
201 int (*compare_magic_event_cb) (Lisp_Event *, Lisp_Event *);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
202 Hashcode (*hash_magic_event_cb)(Lisp_Event *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 int (*add_timeout_cb) (EMACS_TIME);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 void (*remove_timeout_cb) (int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 void (*select_console_cb) (struct console *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 void (*unselect_console_cb) (struct console *);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
207 void (*select_process_cb) (Lisp_Process *, int doin, int doerr);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
208 void (*unselect_process_cb) (Lisp_Process *, int doin, int doerr);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
209 void (*drain_queue_cb) (void);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
210 void (*force_event_pending_cb)(struct frame* f);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
211 void (*create_io_streams_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
212 void * /* errhandle*/,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 Lisp_Object* /* instream */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 Lisp_Object* /* outstream */,
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
215 Lisp_Object* /* errstream */,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
216 USID * /* in_usid */, USID * /* err_usid */,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 int /* flags */);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
218 void (*delete_io_streams_cb) (Lisp_Object /* instream */,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
219 Lisp_Object /* outstream */,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
220 Lisp_Object /* errstream */,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
221 USID * /* in_usid */, USID * /* err_usid */);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
222 int (*current_event_timestamp_cb) (struct console *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
225 /* Flags for create_io_streams_cb() FLAGS parameter */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 #define STREAM_PTY_FLUSHING 0x0001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 #define STREAM_NETWORK_CONNECTION 0x0002
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 extern struct event_stream *event_stream;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
231 #ifdef EVENT_DATA_AS_OBJECTS
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
232 #define EVENT_FOO_BAR_1(extractor, field) ((extractor)->field)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
233 #define EVENT_FOO_BAR(e, uptype, downtype, field) EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
234 #define SET_EVENT_FOO_BAR_1(extractor, field, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
235 do { (extractor)->field = (val); } while (0)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
236 #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) SET_EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
237 #else
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
238 #define EVENT_FOO_BAR(e, uptype, downtype, field) ((e)->event.downtype.field)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
239 #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
240 do { (e)->event.downtype.field = (val); } while (0)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
241 #endif
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
242
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 typedef enum emacs_event_type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 empty_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 key_press_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 button_press_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 button_release_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 pointer_motion_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 process_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 timeout_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 magic_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 magic_eval_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 eval_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 misc_user_event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 dead_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 } emacs_event_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 #define first_event_type empty_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 #define last_event_type dead_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
262 #ifdef MULE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
263
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
264 enum alternative_key_chars
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
265 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
266 KEYCHAR_CURRENT_LANGENV,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
267 KEYCHAR_DEFAULT_USER,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
268 KEYCHAR_DEFAULT_SYSTEM,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
269 KEYCHAR_UNDERLYING_VIRTUAL_KEY_CURRENT_LANGENV,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
270 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_USER,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
271 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_SYSTEM,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
272 KEYCHAR_QWERTY,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
273 KEYCHAR_LAST
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
274 };
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
275
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
276 #endif /* MULE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
278 struct Lisp_Key_Data
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
280 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
281 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
282 #endif /* EVENT_DATA_AS_OBJECTS */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
283 /* What keysym this is; a character or a symbol. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
284 Lisp_Object keysym;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
285 /* Modifiers held down when key was pressed: control, meta, etc.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
286 Also includes buttons. For many keys, Shift is not a bit; that
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
287 is implicit in the keyboard layout. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
288 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
289 #ifdef MULE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
290 /* Alternate character interpretations for this key in different
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
291 keyboard layouts. This deals with the problem of pressing C-x in
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
292 the Russian layout (the so-called "Russian C-x problem"), for
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
293 example: `x' gets mapped to a Cyrillic character, so what do we
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
294 do? For that matter, what about `C-x b'? What we do is look the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
295 key up in the default locales (current language environment, user
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
296 default, system default), then check to see if the underlying
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
297 virtual key is alphabetic in the same three defaults, then
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
298 finally check US ASCII. We ignore the underlying virtual key for
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
299 the current layout to avoid the problem of a French speaker
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
300 (AZERTY layout) who temporarily switches to Russian: The virtual
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
301 keys underlying Russian are US-ASCII, so what the French speaker
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
302 things of as C-a (the key just to the right of TAB) appears as
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
303 C-q. (#### We should probably ignore the current char and look
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
304 *ONLY* in alt_keychars for all control keys. What about the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
305 English speaker who temporarily switches to the French layout and
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
306 finds C-q mapped to C-a?) */
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
307 Ichar alt_keychars[KEYCHAR_LAST];
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
308 #endif /* MULE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
311 typedef struct Lisp_Key_Data Lisp_Key_Data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
312
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
313 #define KEY_DATA_KEYSYM(d) ((d)->keysym)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
314 #define KEY_DATA_MODIFIERS(d) ((d)->modifiers)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
315 #define SET_KEY_DATA_KEYSYM(d, k) ((d)->keysym = k)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
316 #define SET_KEY_DATA_MODIFIERS(d, m) ((d)->modifiers = m)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
317
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
318 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
319 DECLARE_LRECORD (key_data, Lisp_Key_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
320 #define XKEY_DATA(x) XRECORD (x, key_data, Lisp_Key_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
321 #define wrap_key_data(p) wrap_record (p, key_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
322 #define KEY_DATAP(x) RECORDP (x, key_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
323 #define CHECK_KEY_DATA(x) CHECK_RECORD (x, key_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
324 #define CONCHECK_KEY_DATA(x) CONCHECK_RECORD (x, key_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
325 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
326
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
327 #define EVENT_KEY_KEYSYM(e) EVENT_FOO_BAR (e, KEY, key, keysym)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
328 #define XEVENT_KEY_KEYSYM(e) EVENT_KEY_KEYSYM (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
329 #define SET_EVENT_KEY_KEYSYM(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
330 SET_EVENT_FOO_BAR (e, KEY, key, keysym, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
331 #define XSET_EVENT_KEY_KEYSYM(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
332 SET_EVENT_KEY_KEYSYM (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
333
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
334 #define EVENT_KEY_MODIFIERS(e) EVENT_FOO_BAR (e, KEY, key, modifiers)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
335 #define XEVENT_KEY_MODIFIERS(e) EVENT_KEY_MODIFIERS (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
336 #define SET_EVENT_KEY_MODIFIERS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
337 SET_EVENT_FOO_BAR (e, KEY, key, modifiers, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
338 #define XSET_EVENT_KEY_MODIFIERS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
339 SET_EVENT_KEY_MODIFIERS (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
340
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
341 #define EVENT_KEY_ALT_KEYCHARS(e, n) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
342 EVENT_FOO_BAR (e, KEY, key, alt_keychars[n])
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
343 #define XEVENT_KEY_ALT_KEYCHARS(e, n) EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
344 #define SET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
345 SET_EVENT_FOO_BAR (e, KEY, key, alt_keychars[n], val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
346 #define XSET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
347 SET_EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
348
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
349 struct Lisp_Button_Data
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
351 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
352 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
353 #endif /* EVENT_DATA_AS_OBJECTS */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
354 /* What button went down or up. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
355 int button;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
356 /* Bucky-bits on that button: shift, control, meta, etc. Also
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
357 includes other buttons (not the one pressed). */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
358 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
359 /* Where it was at the button-state-change (in pixels). */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
360 int x, y;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
362 typedef struct Lisp_Button_Data Lisp_Button_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
364 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
365 DECLARE_LRECORD (button_data, Lisp_Button_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
366 #define XBUTTON_DATA(x) XRECORD (x, button_data, Lisp_Button_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
367 #define wrap_button_data(p) wrap_record (p, button_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
368 #define BUTTON_DATAP(x) RECORDP (x, button_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
369 #define CHECK_BUTTON_DATA(x) CHECK_RECORD (x, button_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
370 #define CONCHECK_BUTTON_DATA(x) CONCHECK_RECORD (x, button_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
371 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
372
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
373 #define EVENT_BUTTON_BUTTON(e) EVENT_FOO_BAR (e, BUTTON, button, button)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
374 #define XEVENT_BUTTON_BUTTON(e) EVENT_BUTTON_BUTTON (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
375 #define SET_EVENT_BUTTON_BUTTON(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
376 SET_EVENT_FOO_BAR (e, BUTTON, button, button, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
377 #define XSET_EVENT_BUTTON_BUTTON(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
378 SET_EVENT_BUTTON_BUTTON (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
379
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
380 #define EVENT_BUTTON_MODIFIERS(e) EVENT_FOO_BAR (e, BUTTON, button, modifiers)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
381 #define XEVENT_BUTTON_MODIFIERS(e) EVENT_BUTTON_MODIFIERS (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
382 #define SET_EVENT_BUTTON_MODIFIERS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
383 SET_EVENT_FOO_BAR (e, BUTTON, button, modifiers, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
384 #define XSET_EVENT_BUTTON_MODIFIERS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
385 SET_EVENT_BUTTON_MODIFIERS (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
386
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
387 #define EVENT_BUTTON_X(e) EVENT_FOO_BAR (e, BUTTON, button, x)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
388 #define XEVENT_BUTTON_X(e) EVENT_BUTTON_X (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
389 #define SET_EVENT_BUTTON_X(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
390 SET_EVENT_FOO_BAR (e, BUTTON, button, x, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
391 #define XSET_EVENT_BUTTON_X(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
392 SET_EVENT_BUTTON_X (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
393
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
394 #define EVENT_BUTTON_Y(e) EVENT_FOO_BAR (e, BUTTON, button, y)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
395 #define XEVENT_BUTTON_Y(e) EVENT_BUTTON_Y (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
396 #define SET_EVENT_BUTTON_Y(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
397 SET_EVENT_FOO_BAR (e, BUTTON, button, y, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
398 #define XSET_EVENT_BUTTON_Y(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
399 SET_EVENT_BUTTON_Y (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
400
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
401 struct Lisp_Motion_Data
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
403 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
404 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
405 #endif /* EVENT_DATA_AS_OBJECTS */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
406 /* Where it was after it moved (in pixels). */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
407 int x, y;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
408 /* Bucky-bits down when the motion was detected. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
409 int modifiers;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
411 typedef struct Lisp_Motion_Data Lisp_Motion_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
413 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
414 DECLARE_LRECORD (motion_data, Lisp_Motion_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
415 #define XMOTION_DATA(x) XRECORD (x, motion_data, Lisp_Motion_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
416 #define wrap_motion_data(p) wrap_record (p, motion_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
417 #define MOTION_DATAP(x) RECORDP (x, motion_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
418 #define CHECK_MOTION_DATA(x) CHECK_RECORD (x, motion_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
419 #define CONCHECK_MOTION_DATA(x) CONCHECK_RECORD (x, motion_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
420 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
421
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
422 #define EVENT_MOTION_X(e) EVENT_FOO_BAR (e, MOTION, motion, x)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
423 #define XEVENT_MOTION_X(e) EVENT_MOTION_X (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
424 #define SET_EVENT_MOTION_X(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
425 SET_EVENT_FOO_BAR (e, MOTION, motion, x, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
426 #define XSET_EVENT_MOTION_X(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
427 SET_EVENT_MOTION_X (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
428
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
429 #define EVENT_MOTION_Y(e) EVENT_FOO_BAR (e, MOTION, motion, y)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
430 #define XEVENT_MOTION_Y(e) EVENT_MOTION_Y (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
431 #define SET_EVENT_MOTION_Y(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
432 SET_EVENT_FOO_BAR (e, MOTION, motion, y, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
433 #define XSET_EVENT_MOTION_Y(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
434 SET_EVENT_MOTION_Y (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
435
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
436 #define EVENT_MOTION_MODIFIERS(e) EVENT_FOO_BAR (e, MOTION, motion, modifiers)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
437 #define XEVENT_MOTION_MODIFIERS(e) EVENT_MOTION_MODIFIERS (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
438 #define SET_EVENT_MOTION_MODIFIERS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
439 SET_EVENT_FOO_BAR (e, MOTION, motion, modifiers, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
440 #define XSET_EVENT_MOTION_MODIFIERS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
441 SET_EVENT_MOTION_MODIFIERS (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
442
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
443 struct Lisp_Process_Data
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
445 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
446 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
447 #endif /* EVENT_DATA_AS_OBJECTS */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
448 /* the XEmacs "process" object in question */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
449 Lisp_Object process;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
451 typedef struct Lisp_Process_Data Lisp_Process_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
453 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
454 DECLARE_LRECORD (process_data, Lisp_Process_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
455 #define XPROCESS_DATA(x) XRECORD (x, process_data, Lisp_Process_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
456 #define wrap_process_data(p) wrap_record (p, process_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
457 #define PROCESS_DATAP(x) RECORDP (x, process_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
458 #define CHECK_PROCESS_DATA(x) CHECK_RECORD (x, process_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
459 #define CONCHECK_PROCESS_DATA(x) CONCHECK_RECORD (x, process_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
460 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
461
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
462 #define EVENT_PROCESS_PROCESS(e) EVENT_FOO_BAR (e, PROCESS, process, process)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
463 #define XEVENT_PROCESS_PROCESS(e) EVENT_PROCESS_PROCESS (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
464 #define SET_EVENT_PROCESS_PROCESS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
465 SET_EVENT_FOO_BAR (e, PROCESS, process, process, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
466 #define XSET_EVENT_PROCESS_PROCESS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
467 SET_EVENT_PROCESS_PROCESS (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
468
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
469 struct Lisp_Timeout_Data
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
471 /*
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
472 interval_id The ID returned when the associated call to
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
473 add_timeout_cb() was made
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
474 ------ the rest of the fields are filled in by XEmacs -----
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
475 id_number The XEmacs timeout ID for this timeout (more
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
476 than one timeout event can have the same value
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
477 here, since XEmacs timeouts, as opposed to
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
478 add_timeout_cb() timeouts, can resignal
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
479 themselves)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
480 function An elisp function to call when this timeout is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
481 processed.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
482 object The object passed to that function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
483 */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
484 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
485 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
486 #endif /* EVENT_DATA_AS_OBJECTS */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
487 int interval_id;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
488 int id_number;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
489 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
490 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
492 typedef struct Lisp_Timeout_Data Lisp_Timeout_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
494 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
495 DECLARE_LRECORD (timeout_data, Lisp_Timeout_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
496 #define XTIMEOUT_DATA(x) XRECORD (x, timeout_data, Lisp_Timeout_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
497 #define wrap_timeout_data(p) wrap_record(p, timeout_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
498 #define TIMEOUT_DATAP(x) RECORDP (x, timeout_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
499 #define CHECK_TIMEOUT_DATA(x) CHECK_RECORD (x, timeout_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
500 #define CONCHECK_TIMEOUT_DATA(x) CONCHECK_RECORD (x, timeout_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
501 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
502
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
503 #define EVENT_TIMEOUT_INTERVAL_ID(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
504 #define XEVENT_TIMEOUT_INTERVAL_ID(e) EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
505 #define SET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
506 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
507 #define XSET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
508 SET_EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
509
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
510 #define EVENT_TIMEOUT_ID_NUMBER(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
511 #define XEVENT_TIMEOUT_ID_NUMBER(e) EVENT_TIMEOUT_ID_NUMBER (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
512 #define SET_EVENT_TIMEOUT_ID_NUMBER(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
513 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
514 #define XSET_EVENT_TIMEOUT_ID_NUMBER(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
515 SET_EVENT_TIMEOUT_ID_NUMBER (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
516
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
517 #define EVENT_TIMEOUT_FUNCTION(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, function)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
518 #define XEVENT_TIMEOUT_FUNCTION(e) EVENT_TIMEOUT_FUNCTION (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
519 #define SET_EVENT_TIMEOUT_FUNCTION(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
520 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, function, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
521 #define XSET_EVENT_TIMEOUT_FUNCTION(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
522 SET_EVENT_TIMEOUT_FUNCTION (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
523
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
524 #define EVENT_TIMEOUT_OBJECT(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, object)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
525 #define XEVENT_TIMEOUT_OBJECT(e) EVENT_TIMEOUT_OBJECT (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
526 #define SET_EVENT_TIMEOUT_OBJECT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
527 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, object, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
528 #define XSET_EVENT_TIMEOUT_OBJECT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
529 SET_EVENT_TIMEOUT_OBJECT (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
530
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
531 struct Lisp_Eval_Data
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
533 /* This kind of event is used internally; sometimes the window system
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
534 interface would like to inform XEmacs of some user action (such as
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
535 focusing on another frame) but needs that to happen synchronously
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
536 with the other user input, like keypresses. This is useful when
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
537 events are reported through callbacks rather than in the standard
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
538 event stream.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
539
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
540 function An elisp function to call with this event object.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
541 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
542 */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
543 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
544 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
545 #endif /* EVENT_DATA_AS_OBJECTS */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
546 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
547 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
549 typedef struct Lisp_Eval_Data Lisp_Eval_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
551 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
552 DECLARE_LRECORD (eval_data, Lisp_Eval_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
553 #define XEVAL_DATA(x) XRECORD (x, eval_data, Lisp_Eval_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
554 #define wrap_eval_data(p) wrap_record(p, eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
555 #define EVAL_DATAP(x) RECORDP (x, eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
556 #define CHECK_EVAL_DATA(x) CHECK_RECORD (x, eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
557 #define CONCHECK_EVAL_DATA(x) CONCHECK_RECORD (x, eval_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
558 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
559
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
560 #define EVENT_EVAL_FUNCTION(e) EVENT_FOO_BAR (e, EVAL, eval, function)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
561 #define XEVENT_EVAL_FUNCTION(e) EVENT_EVAL_FUNCTION (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
562 #define SET_EVENT_EVAL_FUNCTION(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
563 SET_EVENT_FOO_BAR (e, EVAL, eval, function, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
564 #define XSET_EVENT_EVAL_FUNCTION(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
565 SET_EVENT_EVAL_FUNCTION (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
566
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
567 #define EVENT_EVAL_OBJECT(e) EVENT_FOO_BAR (e, EVAL, eval, object)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
568 #define XEVENT_EVAL_OBJECT(e) EVENT_EVAL_OBJECT (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
569 #define SET_EVENT_EVAL_OBJECT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
570 SET_EVENT_FOO_BAR (e, EVAL, eval, object, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
571 #define XSET_EVENT_EVAL_OBJECT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
572 SET_EVENT_EVAL_OBJECT (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
573
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
574 struct Lisp_Misc_User_Data
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
576 /* #### The misc-user type is serious junk. It should be separated
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
577 out into different events. There's no reason to create
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
578 sub-subtypes of events.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
579
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
580 function An elisp function to call with this event object.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
581 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
582 button What button went down or up.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
583 modifiers Bucky-bits on that button: shift, control, meta, etc.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
584 x, y Where it was at the button-state-change (in pixels).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
585 This is similar to an eval_event, except that it is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
586 generated by user actions: selections in the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
587 menubar, scrollbar actions, or drag and drop actions.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
588 It is a "command" event, like key and mouse presses
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
589 (and unlike mouse motion, process output, and enter
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
590 and leave window hooks). In many ways, eval_events
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
591 are not the same as keypresses or misc_user_events.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
592 The button, modifiers, x, and y parts are only used
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
593 by the XEmacs Drag'n'Drop system. Don't depend on their
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
594 values for other types of misc_user_events.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
595 */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
596 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
597 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
598 #endif /* EVENT_DATA_AS_OBJECTS */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
599 Lisp_Object function;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
600 Lisp_Object object;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
601 int button;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
602 int modifiers;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
603 int x, y;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
605 typedef struct Lisp_Misc_User_Data Lisp_Misc_User_Data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
607 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
608 DECLARE_LRECORD (misc_user_data, Lisp_Misc_User_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
609 #define XMISC_USER_DATA(x) XRECORD (x, misc_user_data, Lisp_Misc_User_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
610 #define wrap_misc_user_data(p) wrap_record(p, misc_user_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
611 #define MISC_USER_DATAP(x) RECORDP (x, misc_user_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
612 #define CHECK_MISC_USER_DATA(x) CHECK_RECORD (x, misc_user_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
613 #define CONCHECK_MISC_USER_DATA(x) CONCHECK_RECORD (x, misc_user_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
614 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
615
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
616 #define EVENT_MISC_USER_FUNCTION(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, function)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
617 #define XEVENT_MISC_USER_FUNCTION(e) EVENT_MISC_USER_FUNCTION (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
618 #define SET_EVENT_MISC_USER_FUNCTION(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
619 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, function, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
620 #define XSET_EVENT_MISC_USER_FUNCTION(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
621 SET_EVENT_MISC_USER_FUNCTION (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
622
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
623 #define EVENT_MISC_USER_OBJECT(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, object)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
624 #define XEVENT_MISC_USER_OBJECT(e) EVENT_MISC_USER_OBJECT (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
625 #define SET_EVENT_MISC_USER_OBJECT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
626 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, object, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
627 #define XSET_EVENT_MISC_USER_OBJECT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
628 SET_EVENT_MISC_USER_OBJECT (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
629
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
630 #define EVENT_MISC_USER_BUTTON(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, button)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
631 #define XEVENT_MISC_USER_BUTTON(e) EVENT_MISC_USER_BUTTON (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
632 #define SET_EVENT_MISC_USER_BUTTON(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
633 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, button, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
634 #define XSET_EVENT_MISC_USER_BUTTON(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
635 SET_EVENT_MISC_USER_BUTTON (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
636
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
637 #define EVENT_MISC_USER_MODIFIERS(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
638 #define XEVENT_MISC_USER_MODIFIERS(e) EVENT_MISC_USER_MODIFIERS (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
639 #define SET_EVENT_MISC_USER_MODIFIERS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
640 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
641 #define XSET_EVENT_MISC_USER_MODIFIERS(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
642 SET_EVENT_MISC_USER_MODIFIERS (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
643
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
644 #define EVENT_MISC_USER_X(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, x)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
645 #define XEVENT_MISC_USER_X(e) EVENT_MISC_USER_X (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
646 #define SET_EVENT_MISC_USER_X(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
647 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, x, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
648 #define XSET_EVENT_MISC_USER_X(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
649 SET_EVENT_MISC_USER_X (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
650
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
651 #define EVENT_MISC_USER_Y(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, y)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
652 #define XEVENT_MISC_USER_Y(e) EVENT_MISC_USER_Y (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
653 #define SET_EVENT_MISC_USER_Y(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
654 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, y, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
655 #define XSET_EVENT_MISC_USER_Y(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
656 SET_EVENT_MISC_USER_Y (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
657
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
658 struct Lisp_Magic_Eval_Data
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
660 /* This is like an eval event but its contents are not
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
661 Lisp-accessible. This allows for "internal eval events" that call
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
662 non-Lisp-accessible functions. Externally, a magic_eval_event just
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
663 appears as a magic_event; the Lisp programmer need not know
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
664 anything more.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
665
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
666 internal_function An unexported function to call with this event
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
667 object. This allows eval events to call internal
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
668 functions. For a normal eval event, this field
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
669 will always be 0.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
670 object Argument of function.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
671
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
672 */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
673 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
674 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
675 #endif /* EVENT_DATA_AS_OBJECTS */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
676 void (*internal_function) (Lisp_Object);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
677 Lisp_Object object;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 };
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
679 typedef struct Lisp_Magic_Eval_Data Lisp_Magic_Eval_Data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
680
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
681 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
682 DECLARE_LRECORD (magic_eval_data, Lisp_Magic_Eval_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
683 #define XMAGIC_EVAL_DATA(x) XRECORD (x, magic_eval_data, Lisp_Magic_Eval_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
684 #define wrap_magic_eval_data(p) wrap_record(p, magic_eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
685 #define MAGIC_EVAL_DATAP(x) RECORDP (x, magic_eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
686 #define CHECK_MAGIC_EVAL_DATA(x) CHECK_RECORD (x, magic_eval_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
687 #define CONCHECK_MAGIC_EVAL_DATA(x) CONCHECK_RECORD (x, magic_eval_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
688 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
689
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
690 #define EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
691 #define XEVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
692 #define SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
693 SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
694 #define XSET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
695 SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
696
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
697 #define EVENT_MAGIC_EVAL_OBJECT(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
698 #define XEVENT_MAGIC_EVAL_OBJECT(e) EVENT_MAGIC_EVAL_OBJECT (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
699 #define SET_EVENT_MAGIC_EVAL_OBJECT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
700 SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
701 #define XSET_EVENT_MAGIC_EVAL_OBJECT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
702 SET_EVENT_MAGIC_EVAL_OBJECT (XEVENT (e), val)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 #if defined (HAVE_X_WINDOWS) && defined(emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 # include <X11/Xlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
708 #ifdef HAVE_GTK
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
709 #include <gdk/gdk.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
710 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
711
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
712
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
713 struct Lisp_Magic_Data
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
714 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
715 /* No user-serviceable parts within. This is for things like
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
716 KeymapNotify and ExposeRegion events and so on that XEmacs itself
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
717 doesn't care about, but which it must do something with for proper
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
718 interaction with the window system.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
719
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
720 Magic_events are handled somewhat asynchronously, just like
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
721 subprocess filters. However, occasionally a magic_event needs to
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
722 be handled synchronously; in that case, the asynchronous handling
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
723 of the magic_event will push an eval_event back onto the queue,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
724 which will be handled synchronously later. This is one of the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
725 reasons why eval_events exist; I'm not entirely happy with this
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
726 aspect of this event model.
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
727 */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
728
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
729 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
730 struct lrecord_header lheader;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
731 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
732
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
733 union {
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
734 #ifdef HAVE_GTK
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
735 GdkEvent gdk_event;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
736 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
737 #ifdef HAVE_X_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
738 XEvent x_event;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
739 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
740 #ifdef HAVE_MS_WINDOWS
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
741 int mswindows_event;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
742 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
743 } underlying;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
744 };
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
745
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
746 typedef struct Lisp_Magic_Data Lisp_Magic_Data;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
747
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
748 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
749 DECLARE_LRECORD (magic_data, Lisp_Magic_Data);
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
750 #define XMAGIC_DATA(x) XRECORD (x, magic_data, Lisp_Magic_Data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
751 #define wrap_magic_data(p) wrap_record(p, magic_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
752 #define MAGIC_DATAP(x) RECORDP (x, magic_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
753 #define CHECK_MAGIC_DATA(x) CHECK_RECORD (x, magic_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
754 #define CONCHECK_MAGIC_DATA(x) CONCHECK_RECORD (x, magic_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
755 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
756
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
757 #define EVENT_MAGIC_UNDERLYING(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
758 #define XEVENT_MAGIC_UNDERLYING(e) EVENT_MAGIC_UNDERLYING (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
759 #define SET_EVENT_MAGIC_UNDERLYING(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
760 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
761 #define XSET_EVENT_MAGIC_UNDERLYING(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
762 SET_EVENT_MAGIC_UNDERLYING (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
763
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
764 #ifdef HAVE_GTK
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
765 #define EVENT_MAGIC_GDK_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
766 #define XEVENT_MAGIC_GDK_EVENT(e) EVENT_MAGIC_GDK_EVENT (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
767 #define SET_EVENT_MAGIC_GDK_EVENT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
768 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
769 #define XSET_EVENT_MAGIC_GDK_EVENT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
770 SET_EVENT_MAGIC_GDK_EVENT (XEVENT (e), val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
771 #endif
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
772
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
773 #ifdef HAVE_X_WINDOWS
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
774 #define EVENT_MAGIC_X_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
775 #define XEVENT_MAGIC_X_EVENT(e) EVENT_MAGIC_X_EVENT (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
776 #define SET_EVENT_MAGIC_X_EVENT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
777 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
778 #define XSET_EVENT_MAGIC_X_EVENT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
779 SET_EVENT_MAGIC_X_EVENT (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
780 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
781
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
782 #ifdef HAVE_MS_WINDOWS
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
783 #define EVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
784 #define XEVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
785 #define SET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
786 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event, val)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
787 #define XSET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
788 SET_EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e), val)
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
789 #endif
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
790
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 struct Lisp_Timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 {
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
793 struct lcrecord_header header;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 int id; /* Id we use to identify the timeout over its lifetime */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 int interval_id; /* Id for this particular interval; this may
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
796 be different each time the timeout is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
797 signalled.*/
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 Lisp_Object function, object; /* Function and object associated
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
799 with timeout. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 EMACS_TIME next_signal_time; /* Absolute time when the timeout
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
801 is next going to be signalled. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 unsigned int resignal_msecs; /* How far after the next timeout
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
803 should the one after that
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
804 occur? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 };
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
806 typedef struct Lisp_Timeout Lisp_Timeout;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
808 DECLARE_LRECORD (timeout, Lisp_Timeout);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
809 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout)
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 593
diff changeset
810 #define wrap_timeout(p) wrap_record (p, timeout)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 #define TIMEOUTP(x) RECORDP (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 struct Lisp_Event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 /* header->next (aka XEVENT_NEXT ()) is used as follows:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 - For dead events, this is the next dead one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 - 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
820 - Likewise for events chained in the command builder.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 - Otherwise it's Qnil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 struct lrecord_header lheader;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
824 Lisp_Object next;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
825 emacs_event_type event_type;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
826
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
827 /* Where this event occurred on. This will be a frame, device,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
828 console, or nil, depending on the event type. It is important
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
829 that an object of a more specific type than is actually generated
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
830 is not substituted -- e.g. there should not be a frame inserted
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
831 when a key-press event occurs, because events on dead channels
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
832 are automatically ignored.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
833
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
834 Specifically:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
835
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
836 -- for button and mouse-motion events, channel will be a
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
837 frame. (The translation to a window occurs later.)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
838
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
839 -- for keyboard events, channel will be a console. Note that
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
840 fake keyboard events (generated by `character-to-event' or
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
841 something that calls this, such as macros) need to have the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
842 selected console stored into them when the event is created.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
843 This is so that the correct console-local variables (e.g. the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
844 command builder) will get affected.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
845
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
846 -- for timer, process, magic-eval, and eval events, channel will
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
847 be nil.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
848
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
849 -- for misc-user events, channel will be a frame.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
850
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
851 -- for magic events, channel will be a frame (usually) or a
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
852 device. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
853 Lisp_Object channel;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
854
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
855 /* When this event occurred -- if not known, this is made up. ####
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
856 All timestamps should be measured as milliseconds since XEmacs
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
857 started. Currently they are raw server timestamps. (The X
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
858 protocol doesn't provide any easy way of translating between
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
859 server time and real process time; yuck.) */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
860 unsigned int timestamp;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
861
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
862 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
863 Lisp_Object event_data;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
864 #else /* not EVENT_DATA_AS_OBJECTS */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 union
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
867 Lisp_Key_Data key;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
868 Lisp_Button_Data button;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
869 Lisp_Motion_Data motion;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
870 Lisp_Process_Data process;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
871 Lisp_Timeout_Data timeout;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
872 Lisp_Eval_Data eval; /* misc_user_event no longer uses this */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
873 Lisp_Misc_User_Data misc_user;/* because it needs position information */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
874 Lisp_Magic_Data magic;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
875 Lisp_Magic_Eval_Data magic_eval;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 } event;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
877 #endif /* not EVENT_DATA_AS_OBJECTS */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
880 DECLARE_LRECORD (event, Lisp_Event);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
881 #define XEVENT(x) XRECORD (x, event, Lisp_Event)
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 593
diff changeset
882 #define wrap_event(p) wrap_record (p, event)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 #define EVENTP(x) RECORDP (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 DECLARE_LRECORD (command_builder, struct command_builder);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 #define EVENT_CHANNEL(a) ((a)->channel)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
890 #define XEVENT_CHANNEL(ev) (XEVENT (ev)->channel)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 #define EVENT_TYPE(a) ((a)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 #define XEVENT_TYPE(a) (XEVENT (a)->event_type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 #define EVENT_NEXT(a) ((a)->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894 #define XEVENT_NEXT(e) (XEVENT (e)->next)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
895 #define EVENT_TIMESTAMP(ev) ((ev)->timestamp)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
896 #define XEVENT_TIMESTAMP(ev) EVENT_TIMESTAMP (XEVENT (ev))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
897
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
898 #ifdef EVENT_DATA_AS_OBJECTS
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
899 #define XEVENT_DATA(ev) (XEVENT (ev)->event_data)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
900 #define EVENT_DATA(ev) ((ev)->event_data)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
901 #define SET_EVENT_DATA(ev, d) \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
902 do { \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
903 Lisp_Event *mac_event = (ev); \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
904 mac_event->event_data = (d); \
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
905 } while (0)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
906 #define XSET_EVENT_DATA(ev, d) SET_EVENT_DATA (XEVENT (ev), d)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
907 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
908
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
909 #define SET_EVENT_TIMESTAMP_ZERO(ev) ((ev)->timestamp = 0)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
910 #define SET_EVENT_TIMESTAMP(ev, t) ((ev)->timestamp = (t))
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
911 #define XSET_EVENT_TIMESTAMP(ev, t) SET_EVENT_TIMESTAMP (XEVENT (ev), t)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
912
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
913 #define SET_EVENT_CHANNEL(ev, c) \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
914 do { \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
915 Lisp_Event *mac_event = (ev); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
916 mac_event->channel = (c); \
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
917 } while (0)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
918 #define XSET_EVENT_CHANNEL(ev, c) SET_EVENT_CHANNEL (XEVENT (ev), c)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
919
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
920 DECLARE_INLINE_HEADER (
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
921 void
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
922 set_event_type (struct Lisp_Event *event, emacs_event_type t)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
923 )
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
924 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
925 #ifdef EVENT_DATA_AS_OBJECTS
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
926 switch (EVENT_TYPE (event))
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
927 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
928 case key_press_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
929 free_key_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
930 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
931 case button_press_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
932 case button_release_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
933 free_button_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
934 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
935 case pointer_motion_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
936 free_motion_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
937 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
938 case process_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
939 free_process_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
940 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
941 case timeout_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
942 free_timeout_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
943 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
944 case magic_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
945 free_magic_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
946 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
947 case magic_eval_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
948 free_magic_eval_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
949 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
950 case eval_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
951 free_eval_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
952 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
953 case misc_user_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
954 free_misc_user_data (event->event_data);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
955 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
956 default:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
957 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
958 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
959 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
960
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
961 event->event_type = t;
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
962
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
963 #ifdef EVENT_DATA_AS_OBJECTS
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
964 switch (t)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
965 {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
966 case key_press_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
967 event->event_data = make_key_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
968 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
969 case button_press_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
970 case button_release_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
971 event->event_data = make_button_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
972 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
973 case pointer_motion_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
974 event->event_data = make_motion_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
975 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
976 case process_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
977 event->event_data = make_process_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
978 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
979 case timeout_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
980 event->event_data = make_timeout_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
981 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
982 case magic_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
983 event->event_data = make_magic_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
984 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
985 case magic_eval_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
986 event->event_data = make_magic_eval_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
987 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
988 case eval_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
989 event->event_data = make_eval_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
990 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
991 case misc_user_event:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
992 event->event_data = make_misc_user_data ();
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
993 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
994 default:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
995 event->event_data = Qnil;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
996 break;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
997 }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
998 #endif /* EVENT_DATA_AS_OBJECTS */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
999 }
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1000
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1001 #define SET_EVENT_NEXT(ev, n) do { (ev)->next = (n); } while (0)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1002 #define XSET_EVENT_NEXT(ev, n) SET_EVENT_NEXT (XEVENT (ev), n)
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1003
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
1004 #define XSET_EVENT_TYPE(ev, t) set_event_type (XEVENT (ev), t)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
1005 #define SET_EVENT_TYPE(ev, t) set_event_type (ev, t)
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
1006
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 #define EVENT_CHAIN_LOOP(event, chain) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 for (event = chain; !NILP (event); event = XEVENT_NEXT (event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1012 #define CHECK_LIVE_EVENT(x) do { \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1013 CHECK_EVENT (x); \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1014 if (! EVENT_LIVE_P (XEVENT (x))) \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1015 dead_wrong_type_argument (Qevent_live_p, (x)); \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 } while (0)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1017 #define CONCHECK_LIVE_EVENT(x) do { \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1018 CONCHECK_EVENT (x); \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1019 if (! EVENT_LIVE_P (XEVENT (x))) \
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1020 x = wrong_type_argument (Qevent_live_p, (x)); \
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 EXFUN (Fcharacter_to_event, 4);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 EXFUN (Fdeallocate_event, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 EXFUN (Fevent_glyph_extent, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 EXFUN (Fevent_modeline_position, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 EXFUN (Fevent_over_modeline_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 EXFUN (Fevent_over_toolbar_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 EXFUN (Fevent_over_vertical_divider_p, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 EXFUN (Fevent_point, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 EXFUN (Fevent_window, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 EXFUN (Fmake_event, 2);
1268
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
1034 EXFUN (Fnext_command_event, 2);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 extern Lisp_Object Qcancel_mode_internal;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1039 extern Lisp_Object Vmodifier_keys_sticky_time;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1041 /* The modifiers XEmacs knows about; these appear in key and button events. */
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1042
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1043 #define XEMACS_MOD_CONTROL (1<<0)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1044 #define XEMACS_MOD_META (1<<1)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1045 #define XEMACS_MOD_SUPER (1<<2)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1046 #define XEMACS_MOD_HYPER (1<<3)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1047 #define XEMACS_MOD_ALT (1<<4)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1048 #define XEMACS_MOD_SHIFT (1<<5) /* not used for dual-case characters */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1049 #define XEMACS_MOD_BUTTON1 (1<<6)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1050 #define XEMACS_MOD_BUTTON2 (1<<7)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1051 #define XEMACS_MOD_BUTTON3 (1<<8)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1052 #define XEMACS_MOD_BUTTON4 (1<<9)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1053 #define XEMACS_MOD_BUTTON5 (1<<10)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1054
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1055 /* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1056 if there are both Alt and Meta keys. If there are no Meta keys,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1057 then Alt generates XEMACS_MOD_META instead.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 /* Maybe this should be trickier */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 #define KEYSYM(x) (intern (x))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 /* from events.c */
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
1064 void format_event_object (Eistring *buf, Lisp_Object event, int brief);
1229
416490619c01 [xemacs-hg @ 2003-01-23 02:16:42 by vins]
vins
parents: 1204
diff changeset
1065 /*void format_event_data_object (Eistring *buf, Lisp_Object data, int brief);*/
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 853
diff changeset
1066 void character_to_event (Ichar c, Lisp_Event *event,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1067 struct console *con,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1068 int use_console_meta_flag,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1069 int do_backspace_mapping);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1070 void zero_event (Lisp_Event *e);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1071
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1072 #define MECR_DEALLOCATE_EVENT 1
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1073
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 void deallocate_event_chain (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 Lisp_Object event_chain_tail (Lisp_Object event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1079 Lisp_Object *tail);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1080 int map_event_chain_remove (int (*fn) (Lisp_Object ev, void *user_data),
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1081 Lisp_Object *head, Lisp_Object *tail,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1082 void *user_data, int flags);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 int event_chain_count (Lisp_Object event_chain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 Lisp_Object event_chain_find_previous (Lisp_Object event_chain,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1085 Lisp_Object event);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 Lisp_Object copy_event_chain (Lisp_Object event_chain);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1088 Lisp_Object transfer_event_chain_pointer (Lisp_Object pointer,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1089 Lisp_Object old_chain,
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1090 Lisp_Object new_chain);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1091
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1092
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1093 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1094 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 /* True if this is a non-internal event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 (keyboard press, menu, scrollbar, mouse button) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 int command_event_p (Lisp_Object event);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1098 void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1099 Ichar event_to_character (Lisp_Object, int, int, int);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 struct console *event_console_or_selected (Lisp_Object event);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1101 void upshift_event (Lisp_Object event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1102 void downshift_event (Lisp_Object event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1103 int event_upshifted_p (Lisp_Object event);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 /* from event-stream.c */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1106 extern Lisp_Object dispatch_event_queue;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1107 Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1108 void enqueue_dispatch_event (Lisp_Object event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1109 Lisp_Object dequeue_dispatch_event (void);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1111 void event_stream_handle_magic_event (Lisp_Event *event);
788
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1112 void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1113 int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2);
026c5bf9c134 [xemacs-hg @ 2002-03-21 07:29:57 by ben]
ben
parents: 771
diff changeset
1114 Hashcode event_stream_hash_magic_event (Lisp_Event *e);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 void event_stream_select_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 void event_stream_unselect_console (struct console *con);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1117 void event_stream_select_process (Lisp_Process *proc, int doin, int doerr);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1118 void event_stream_unselect_process (Lisp_Process *proc, int doin, int doerr);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1119 void event_stream_create_io_streams (void* inhandle, void* outhandle,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1120 void *errhandle, Lisp_Object* instream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1121 Lisp_Object* outstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1122 Lisp_Object* errstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1123 USID* in_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1124 USID* err_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1125 int flags);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1126 void event_stream_delete_io_streams (Lisp_Object instream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1127 Lisp_Object outstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1128 Lisp_Object errstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1129 USID* in_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1130 USID* err_usid);
1268
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
1131 Lisp_Object event_stream_protect_modal_loop (const char *error_string,
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
1132 Lisp_Object (*bfun) (void *barg),
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
1133 void *barg, int flags);
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
1134 void event_stream_drain_queue (void);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 void event_stream_quit_p (void);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1136 void run_pre_idle_hook (void);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 struct low_level_timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 int id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 EMACS_TIME time;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 struct low_level_timeout *next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 int add_low_level_timeout (struct low_level_timeout **timeout_list,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1146 EMACS_TIME thyme);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 void remove_low_level_timeout (struct low_level_timeout **timeout_list,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1148 int id);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 int get_low_level_timeout_interval (struct low_level_timeout *
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1150 timeout_list, EMACS_TIME *interval);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 int pop_low_level_timeout (struct low_level_timeout **timeout_list,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1152 EMACS_TIME *time_out);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 int event_stream_generate_wakeup (unsigned int milliseconds,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1154 unsigned int vanilliseconds,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1155 Lisp_Object function,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1156 Lisp_Object object,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1157 int async_p);
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
1158 int event_stream_resignal_wakeup (int interval_id, int async_p,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1159 Lisp_Object *function, Lisp_Object *object);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 void event_stream_disable_wakeup (int id, int async_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
1162 /* from signal.c */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
1163 int signal_add_async_interval_timeout (EMACS_TIME thyme);
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 502
diff changeset
1164 void signal_remove_async_interval_timeout (int id);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 /* from event-stream.c -- focus sanity */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 extern int focus_follows_mouse;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168 void investigate_frame_change (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 Lisp_Object extract_this_command_keys_nth_mouse_event (int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 void single_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 void any_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 int in_single_console_state (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 extern int emacs_is_blocking;
1268
fffe735e63ee [xemacs-hg @ 2003-02-07 11:50:50 by ben]
ben
parents: 1229
diff changeset
1181 extern int in_modal_loop;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 extern volatile int sigint_happened;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 #ifdef HAVE_UNIXOID_EVENT_LOOP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185 /* from event-unixoid.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 /* Ceci n'est pas un pipe. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 extern int signal_event_pipe[];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 void signal_fake_event (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 void drain_signal_event_pipe (void);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1192 void drain_tty_devices (void);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 extern int fake_event_occurred;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 int event_stream_unixoid_select_console (struct console *con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 int event_stream_unixoid_unselect_console (struct console *con);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1198 void event_stream_unixoid_select_process (Lisp_Process *proc, int doin,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1199 int doerr, int *infd, int *errfd);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1200 void event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1201 int doerr, int *infd, int *errfd);
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1202 struct console *find_tty_or_stream_console_from_fd (int fd);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1203 int read_event_from_tty_or_stream_desc (Lisp_Event *event,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1204 struct console *con);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1205 void event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1206 void *errhandle,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1207 Lisp_Object* instream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1208 Lisp_Object* outstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1209 Lisp_Object* errstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1210 USID* in_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1211 USID* err_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1212 int flags);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1213 void event_stream_unixoid_delete_io_streams (Lisp_Object instream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1214 Lisp_Object outstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1215 Lisp_Object errstream,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1216 USID* in_usid,
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 826
diff changeset
1217 USID* err_usid);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1219 #endif /* HAVE_UNIXOID_EVENT_LOOP */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1220
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1221 /* The following is not inside of HAVE_UNIXOID_EVENT_LOOP because of the
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1222 possibility of combiling XEmacs with no-MSW, no-X, no-TTY --
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1223 process-unix.c is still compiled. #### Should we still compile
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1224 subprocesses with no event loops? */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 /* Beware: this evil macro evaluates its arg many times */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 #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
1227
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 /* 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
1229 first console is tty, even if HAVE_X_WINDOWS is defined */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 /* #define DEBUG_TTY_EVENT_STREAM */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1233 /* #### a hack, until accelerator shit is cleaned up */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1234
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1235 /* This structure is what we use to encapsulate the state of a command sequence
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1236 being composed; key events are executed by adding themselves to the command
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1237 builder; if the command builder is then complete (does not still represent
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1238 a prefix key sequence) it executes the corresponding command.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1239 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1240 struct command_builder
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1241 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1242 struct lcrecord_header header;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1243 Lisp_Object console; /* back pointer to the console this command
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1244 builder is for */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1245 #if 0
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1246 /* #### Not implemented: nil, or an event representing the first
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1247 event read after the last command completed. Threaded. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1248 Lisp_Object prefix_events;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1249 #endif /* 0 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1250 /* nil, or an event chain representing the events in the current
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1251 keymap-lookup sequence. NOTE: All events in the chain MUST be
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1252 freshly allocated, with no pointers to them elsewhere. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1253 Lisp_Object current_events;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1254 /* Last elt of current_events */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1255 Lisp_Object most_current_event;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1256 /* Last elt before function map code took over. What this means is:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1257 All prefixes up to (but not including) this event have non-nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1258 bindings, but the prefix including this event has a nil binding.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1259 Any events in the chain after this one were read solely because
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1260 we're part of a possible function key. If we end up with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1261 something that's not part of a possible function key, we have to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1262 unread all of those events. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1263 Lisp_Object last_non_munged_event;
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1264 /* One value for function-key-map, one for key-translation-map:
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1265 First event that can begin a possible function key sequence
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1266 (to be translated according to function-key-map). Normally
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1267 this is the first event in the chain. However, once we've
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1268 translated a sequence through function-key-map, this will point
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1269 to the first event after the translated sequence: we don't ever
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1270 want to translate any events twice through function-key-map, or
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1271 things could get really screwed up (e.g. if the user created a
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1272 translation loop). If this is nil, then the next-read event is
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1273 the first that can begin a function key sequence. */
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 943
diff changeset
1274 Lisp_Object first_mungeable_event[2];
934
c925bacdda60 [xemacs-hg @ 2002-07-29 09:21:12 by michaels]
michaels
parents: 867
diff changeset
1275 Ibyte *echo_buf;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1276
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1277 Bytecount echo_buf_length; /* size of echo_buf */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1278 Bytecount echo_buf_index; /* index into echo_buf
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1279 * -1 before doing echoing for new cmd */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1280 /* Self-insert-command is magic in that it doesn't always push an undo-
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1281 boundary: up to 20 consecutive self-inserts can happen before an undo-
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1282 boundary is pushed. This variable is that counter.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1283 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1284 int self_insert_countdown;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1285 };
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1286
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 432
diff changeset
1287 #endif /* INCLUDED_events_h_ */