Mercurial > hg > xemacs-beta
annotate src/events.h @ 5482:384423af8fb5 first-gplv3 r21-5-31
Update CHANGES-beta.
| author | Stephen J. Turnbull <stephen@xemacs.org> |
|---|---|
| date | Sat, 30 Apr 2011 12:50:14 +0900 |
| parents | 8d29f1c4bb98 |
| children | b79e1e02bf01 |
| rev | line source |
|---|---|
| 428 | 1 /* Definitions for the new event model; |
| 2 created 16-jul-91 by Jamie Zawinski | |
| 3 Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. | |
| 788 | 4 Copyright (C) 1995, 1996, 2002 Ben Wing. |
| 428 | 5 |
| 6 This file is part of XEmacs. | |
| 7 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5127
diff
changeset
|
8 XEmacs is free software: you can redistribute it and/or modify it |
| 428 | 9 under the terms of the GNU General Public License as published by the |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5127
diff
changeset
|
10 Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5127
diff
changeset
|
11 option) any later version. |
| 428 | 12 |
| 13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 16 for more details. | |
| 17 | |
| 18 You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5127
diff
changeset
|
19 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 428 | 20 |
| 21 /* Synched up with: Not in FSF. */ | |
| 22 | |
| 440 | 23 #ifndef INCLUDED_events_h_ |
| 24 #define INCLUDED_events_h_ | |
| 428 | 25 |
| 26 #include "systime.h" | |
| 27 | |
| 2367 | 28 /* |
| 428 | 29 |
| 2367 | 30 See also |
| 428 | 31 |
| 2367 | 32 (Info-goto-node "(internals)Event Stream Callback Routines") |
| 33 (Info-goto-node "(internals)Stream Pairs") | |
| 428 | 34 |
| 35 */ | |
| 36 | |
| 37 /* typedef unsigned int USID; in lisp.h */ | |
| 38 #define USID_ERROR ((USID)-1) | |
| 39 #define USID_DONTHASH ((USID)0) | |
| 40 | |
| 41 | |
| 42 struct event_stream | |
| 43 { | |
| 44 int (*event_pending_p) (int); | |
| 440 | 45 void (*next_event_cb) (Lisp_Event *); |
| 46 void (*handle_magic_event_cb) (Lisp_Event *); | |
| 788 | 47 void (*format_magic_event_cb) (Lisp_Event *, Lisp_Object pstream); |
| 48 int (*compare_magic_event_cb) (Lisp_Event *, Lisp_Event *); | |
| 49 Hashcode (*hash_magic_event_cb)(Lisp_Event *); | |
| 428 | 50 int (*add_timeout_cb) (EMACS_TIME); |
| 51 void (*remove_timeout_cb) (int); | |
| 52 void (*select_console_cb) (struct console *); | |
| 53 void (*unselect_console_cb) (struct console *); | |
| 853 | 54 void (*select_process_cb) (Lisp_Process *, int doin, int doerr); |
| 55 void (*unselect_process_cb) (Lisp_Process *, int doin, int doerr); | |
| 1204 | 56 void (*drain_queue_cb) (void); |
| 57 void (*force_event_pending_cb)(struct frame* f); | |
| 853 | 58 void (*create_io_streams_cb) (void* /* inhandle*/, void* /*outhandle*/ , |
| 59 void * /* errhandle*/, | |
| 428 | 60 Lisp_Object* /* instream */, |
| 61 Lisp_Object* /* outstream */, | |
| 853 | 62 Lisp_Object* /* errstream */, |
| 63 USID * /* in_usid */, USID * /* err_usid */, | |
| 428 | 64 int /* flags */); |
| 853 | 65 void (*delete_io_streams_cb) (Lisp_Object /* instream */, |
| 66 Lisp_Object /* outstream */, | |
| 67 Lisp_Object /* errstream */, | |
| 68 USID * /* in_usid */, USID * /* err_usid */); | |
| 442 | 69 int (*current_event_timestamp_cb) (struct console *); |
| 428 | 70 }; |
| 71 | |
| 853 | 72 /* Flags for create_io_streams_cb() FLAGS parameter */ |
| 428 | 73 #define STREAM_PTY_FLUSHING 0x0001 |
| 74 #define STREAM_NETWORK_CONNECTION 0x0002 | |
| 75 | |
| 76 extern struct event_stream *event_stream; | |
| 77 | |
| 1204 | 78 #ifdef EVENT_DATA_AS_OBJECTS |
| 79 #define EVENT_FOO_BAR_1(extractor, field) ((extractor)->field) | |
| 80 #define EVENT_FOO_BAR(e, uptype, downtype, field) EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field) | |
| 81 #define SET_EVENT_FOO_BAR_1(extractor, field, val) \ | |
| 82 do { (extractor)->field = (val); } while (0) | |
| 83 #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) SET_EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field, val) | |
| 84 #else | |
| 85 #define EVENT_FOO_BAR(e, uptype, downtype, field) ((e)->event.downtype.field) | |
| 86 #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) \ | |
| 87 do { (e)->event.downtype.field = (val); } while (0) | |
| 88 #endif | |
| 934 | 89 |
| 428 | 90 typedef enum emacs_event_type |
| 91 { | |
| 92 empty_event, | |
| 93 key_press_event, | |
| 94 button_press_event, | |
| 95 button_release_event, | |
| 96 pointer_motion_event, | |
| 97 process_event, | |
| 98 timeout_event, | |
| 99 magic_event, | |
| 100 magic_eval_event, | |
| 101 eval_event, | |
| 102 misc_user_event, | |
| 103 dead_event | |
| 104 } emacs_event_type; | |
| 105 | |
| 106 #define first_event_type empty_event | |
| 107 #define last_event_type dead_event | |
| 108 | |
| 771 | 109 enum alternative_key_chars |
| 110 { | |
| 111 KEYCHAR_CURRENT_LANGENV, | |
| 112 KEYCHAR_DEFAULT_USER, | |
| 113 KEYCHAR_DEFAULT_SYSTEM, | |
| 114 KEYCHAR_UNDERLYING_VIRTUAL_KEY_CURRENT_LANGENV, | |
| 115 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_USER, | |
| 116 KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_SYSTEM, | |
| 117 KEYCHAR_QWERTY, | |
| 118 KEYCHAR_LAST | |
| 119 }; | |
| 120 | |
| 934 | 121 struct Lisp_Key_Data |
| 428 | 122 { |
| 1204 | 123 #ifdef EVENT_DATA_AS_OBJECTS |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
124 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 125 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 771 | 126 /* What keysym this is; a character or a symbol. */ |
| 127 Lisp_Object keysym; | |
| 128 /* Modifiers held down when key was pressed: control, meta, etc. | |
| 129 Also includes buttons. For many keys, Shift is not a bit; that | |
| 130 is implicit in the keyboard layout. */ | |
| 131 int modifiers; | |
| 132 /* Alternate character interpretations for this key in different | |
| 133 keyboard layouts. This deals with the problem of pressing C-x in | |
| 134 the Russian layout (the so-called "Russian C-x problem"), for | |
| 135 example: `x' gets mapped to a Cyrillic character, so what do we | |
| 136 do? For that matter, what about `C-x b'? What we do is look the | |
| 137 key up in the default locales (current language environment, user | |
| 138 default, system default), then check to see if the underlying | |
| 139 virtual key is alphabetic in the same three defaults, then | |
| 140 finally check US ASCII. We ignore the underlying virtual key for | |
| 141 the current layout to avoid the problem of a French speaker | |
| 142 (AZERTY layout) who temporarily switches to Russian: The virtual | |
| 143 keys underlying Russian are US-ASCII, so what the French speaker | |
| 144 things of as C-a (the key just to the right of TAB) appears as | |
| 2828 | 145 C-q. |
| 146 | |
| 147 I've just implemented this in event-stream.c, and I really want to | |
| 148 see feedback from actual Russians about it, and whether it needs to | |
| 149 be much more complete than what I've done. E.g, the mapping back to | |
| 150 US Qwerty is hardcoded on the X11 side of things, and only deals | |
| 151 with the alphabetic characters. | |
| 152 | |
| 153 Also, I think it's downright confusing for people with Roman | |
| 154 letters on their keyboard to have random other letters than are | |
| 155 described as calling some command, call that command. So I want to | |
| 156 consider enabling it by language environment. | |
| 157 | |
| 158 [[ (#### We should probably ignore the current char and look | |
| 771 | 159 *ONLY* in alt_keychars for all control keys. What about the |
| 160 English speaker who temporarily switches to the French layout and | |
| 2828 | 161 finds C-q mapped to C-a?) ]] |
| 162 | |
| 163 No, we shouldn't. People who use the French layout expect that | |
| 164 pressing control with the key to the right of tab passes C-a to | |
| 165 emacs; English speakers (more exactly, Qwerty users) who | |
| 166 temporarily switch to the French layout encounter that issue in | |
| 167 every other app too, and they normally remap the keyboard in | |
| 168 software as soon as they can, or learn to live with Azerty. That | |
| 169 applies for all the Roman-alphabet keyboard layouts. Aidan Kehoe, | |
| 170 2005-05-15 | |
| 171 | |
| 172 I've taken out the dependency on MULE for this feature because it's | |
| 173 also useful in a non-Mule XEmacs where the user has set their font | |
| 174 to something ending in iso8859-5. How many of those users there | |
| 175 are, is another question. */ | |
| 867 | 176 Ichar alt_keychars[KEYCHAR_LAST]; |
| 428 | 177 }; |
| 178 | |
| 934 | 179 typedef struct Lisp_Key_Data Lisp_Key_Data; |
| 180 | |
| 1204 | 181 #define KEY_DATA_KEYSYM(d) ((d)->keysym) |
| 182 #define KEY_DATA_MODIFIERS(d) ((d)->modifiers) | |
| 183 #define SET_KEY_DATA_KEYSYM(d, k) ((d)->keysym = k) | |
| 184 #define SET_KEY_DATA_MODIFIERS(d, m) ((d)->modifiers = m) | |
| 185 | |
| 186 #ifdef EVENT_DATA_AS_OBJECTS | |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
187 DECLARE_LISP_OBJECT (key_data, Lisp_Key_Data); |
| 934 | 188 #define XKEY_DATA(x) XRECORD (x, key_data, Lisp_Key_Data) |
| 189 #define wrap_key_data(p) wrap_record (p, key_data) | |
| 190 #define KEY_DATAP(x) RECORDP (x, key_data) | |
| 191 #define CHECK_KEY_DATA(x) CHECK_RECORD (x, key_data) | |
| 192 #define CONCHECK_KEY_DATA(x) CONCHECK_RECORD (x, key_data) | |
| 1204 | 193 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 194 |
| 1204 | 195 #define EVENT_KEY_KEYSYM(e) EVENT_FOO_BAR (e, KEY, key, keysym) |
| 196 #define XEVENT_KEY_KEYSYM(e) EVENT_KEY_KEYSYM (XEVENT (e)) | |
| 197 #define SET_EVENT_KEY_KEYSYM(e, val) \ | |
| 198 SET_EVENT_FOO_BAR (e, KEY, key, keysym, val) | |
| 199 #define XSET_EVENT_KEY_KEYSYM(e, val) \ | |
| 200 SET_EVENT_KEY_KEYSYM (XEVENT (e), val) | |
| 934 | 201 |
| 1204 | 202 #define EVENT_KEY_MODIFIERS(e) EVENT_FOO_BAR (e, KEY, key, modifiers) |
| 203 #define XEVENT_KEY_MODIFIERS(e) EVENT_KEY_MODIFIERS (XEVENT (e)) | |
| 204 #define SET_EVENT_KEY_MODIFIERS(e, val) \ | |
| 205 SET_EVENT_FOO_BAR (e, KEY, key, modifiers, val) | |
| 206 #define XSET_EVENT_KEY_MODIFIERS(e, val) \ | |
| 207 SET_EVENT_KEY_MODIFIERS (XEVENT (e), val) | |
| 934 | 208 |
| 1204 | 209 #define EVENT_KEY_ALT_KEYCHARS(e, n) \ |
| 210 EVENT_FOO_BAR (e, KEY, key, alt_keychars[n]) | |
| 211 #define XEVENT_KEY_ALT_KEYCHARS(e, n) EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n) | |
| 212 #define SET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \ | |
| 213 SET_EVENT_FOO_BAR (e, KEY, key, alt_keychars[n], val) | |
| 214 #define XSET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \ | |
| 215 SET_EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n, val) | |
| 216 | |
| 934 | 217 struct Lisp_Button_Data |
| 428 | 218 { |
| 1204 | 219 #ifdef EVENT_DATA_AS_OBJECTS |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
220 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 221 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 771 | 222 /* What button went down or up. */ |
| 223 int button; | |
| 224 /* Bucky-bits on that button: shift, control, meta, etc. Also | |
| 225 includes other buttons (not the one pressed). */ | |
| 226 int modifiers; | |
| 227 /* Where it was at the button-state-change (in pixels). */ | |
| 228 int x, y; | |
| 428 | 229 }; |
| 934 | 230 typedef struct Lisp_Button_Data Lisp_Button_Data; |
| 428 | 231 |
| 1204 | 232 #ifdef EVENT_DATA_AS_OBJECTS |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
233 DECLARE_LISP_OBJECT (button_data, Lisp_Button_Data); |
| 934 | 234 #define XBUTTON_DATA(x) XRECORD (x, button_data, Lisp_Button_Data) |
| 235 #define wrap_button_data(p) wrap_record (p, button_data) | |
| 236 #define BUTTON_DATAP(x) RECORDP (x, button_data) | |
| 237 #define CHECK_BUTTON_DATA(x) CHECK_RECORD (x, button_data) | |
| 238 #define CONCHECK_BUTTON_DATA(x) CONCHECK_RECORD (x, button_data) | |
| 1204 | 239 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 240 |
| 1204 | 241 #define EVENT_BUTTON_BUTTON(e) EVENT_FOO_BAR (e, BUTTON, button, button) |
| 242 #define XEVENT_BUTTON_BUTTON(e) EVENT_BUTTON_BUTTON (XEVENT (e)) | |
| 243 #define SET_EVENT_BUTTON_BUTTON(e, val) \ | |
| 244 SET_EVENT_FOO_BAR (e, BUTTON, button, button, val) | |
| 245 #define XSET_EVENT_BUTTON_BUTTON(e, val) \ | |
| 246 SET_EVENT_BUTTON_BUTTON (XEVENT (e), val) | |
| 247 | |
| 248 #define EVENT_BUTTON_MODIFIERS(e) EVENT_FOO_BAR (e, BUTTON, button, modifiers) | |
| 249 #define XEVENT_BUTTON_MODIFIERS(e) EVENT_BUTTON_MODIFIERS (XEVENT (e)) | |
| 250 #define SET_EVENT_BUTTON_MODIFIERS(e, val) \ | |
| 251 SET_EVENT_FOO_BAR (e, BUTTON, button, modifiers, val) | |
| 252 #define XSET_EVENT_BUTTON_MODIFIERS(e, val) \ | |
| 253 SET_EVENT_BUTTON_MODIFIERS (XEVENT (e), val) | |
| 934 | 254 |
| 1204 | 255 #define EVENT_BUTTON_X(e) EVENT_FOO_BAR (e, BUTTON, button, x) |
| 256 #define XEVENT_BUTTON_X(e) EVENT_BUTTON_X (XEVENT (e)) | |
| 257 #define SET_EVENT_BUTTON_X(e, val) \ | |
| 258 SET_EVENT_FOO_BAR (e, BUTTON, button, x, val) | |
| 259 #define XSET_EVENT_BUTTON_X(e, val) \ | |
| 260 SET_EVENT_BUTTON_X (XEVENT (e), val) | |
| 934 | 261 |
| 1204 | 262 #define EVENT_BUTTON_Y(e) EVENT_FOO_BAR (e, BUTTON, button, y) |
| 263 #define XEVENT_BUTTON_Y(e) EVENT_BUTTON_Y (XEVENT (e)) | |
| 264 #define SET_EVENT_BUTTON_Y(e, val) \ | |
| 265 SET_EVENT_FOO_BAR (e, BUTTON, button, y, val) | |
| 266 #define XSET_EVENT_BUTTON_Y(e, val) \ | |
| 267 SET_EVENT_BUTTON_Y (XEVENT (e), val) | |
| 268 | |
| 934 | 269 struct Lisp_Motion_Data |
| 428 | 270 { |
| 1204 | 271 #ifdef EVENT_DATA_AS_OBJECTS |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
272 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 273 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 771 | 274 /* Where it was after it moved (in pixels). */ |
| 275 int x, y; | |
| 276 /* Bucky-bits down when the motion was detected. */ | |
| 277 int modifiers; | |
| 428 | 278 }; |
| 934 | 279 typedef struct Lisp_Motion_Data Lisp_Motion_Data; |
| 428 | 280 |
| 1204 | 281 #ifdef EVENT_DATA_AS_OBJECTS |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
282 DECLARE_LISP_OBJECT (motion_data, Lisp_Motion_Data); |
| 934 | 283 #define XMOTION_DATA(x) XRECORD (x, motion_data, Lisp_Motion_Data) |
| 284 #define wrap_motion_data(p) wrap_record (p, motion_data) | |
| 285 #define MOTION_DATAP(x) RECORDP (x, motion_data) | |
| 286 #define CHECK_MOTION_DATA(x) CHECK_RECORD (x, motion_data) | |
| 287 #define CONCHECK_MOTION_DATA(x) CONCHECK_RECORD (x, motion_data) | |
| 1204 | 288 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 289 |
| 1204 | 290 #define EVENT_MOTION_X(e) EVENT_FOO_BAR (e, MOTION, motion, x) |
| 291 #define XEVENT_MOTION_X(e) EVENT_MOTION_X (XEVENT (e)) | |
| 292 #define SET_EVENT_MOTION_X(e, val) \ | |
| 293 SET_EVENT_FOO_BAR (e, MOTION, motion, x, val) | |
| 294 #define XSET_EVENT_MOTION_X(e, val) \ | |
| 295 SET_EVENT_MOTION_X (XEVENT (e), val) | |
| 934 | 296 |
| 1204 | 297 #define EVENT_MOTION_Y(e) EVENT_FOO_BAR (e, MOTION, motion, y) |
| 298 #define XEVENT_MOTION_Y(e) EVENT_MOTION_Y (XEVENT (e)) | |
| 299 #define SET_EVENT_MOTION_Y(e, val) \ | |
| 300 SET_EVENT_FOO_BAR (e, MOTION, motion, y, val) | |
| 301 #define XSET_EVENT_MOTION_Y(e, val) \ | |
| 302 SET_EVENT_MOTION_Y (XEVENT (e), val) | |
| 303 | |
| 304 #define EVENT_MOTION_MODIFIERS(e) EVENT_FOO_BAR (e, MOTION, motion, modifiers) | |
| 305 #define XEVENT_MOTION_MODIFIERS(e) EVENT_MOTION_MODIFIERS (XEVENT (e)) | |
| 306 #define SET_EVENT_MOTION_MODIFIERS(e, val) \ | |
| 307 SET_EVENT_FOO_BAR (e, MOTION, motion, modifiers, val) | |
| 308 #define XSET_EVENT_MOTION_MODIFIERS(e, val) \ | |
| 309 SET_EVENT_MOTION_MODIFIERS (XEVENT (e), val) | |
| 310 | |
| 934 | 311 struct Lisp_Process_Data |
| 428 | 312 { |
| 1204 | 313 #ifdef EVENT_DATA_AS_OBJECTS |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
314 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 315 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 771 | 316 /* the XEmacs "process" object in question */ |
| 317 Lisp_Object process; | |
| 428 | 318 }; |
| 934 | 319 typedef struct Lisp_Process_Data Lisp_Process_Data; |
| 428 | 320 |
| 1204 | 321 #ifdef EVENT_DATA_AS_OBJECTS |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
322 DECLARE_LISP_OBJECT (process_data, Lisp_Process_Data); |
| 934 | 323 #define XPROCESS_DATA(x) XRECORD (x, process_data, Lisp_Process_Data) |
| 324 #define wrap_process_data(p) wrap_record (p, process_data) | |
| 325 #define PROCESS_DATAP(x) RECORDP (x, process_data) | |
| 326 #define CHECK_PROCESS_DATA(x) CHECK_RECORD (x, process_data) | |
| 327 #define CONCHECK_PROCESS_DATA(x) CONCHECK_RECORD (x, process_data) | |
| 1204 | 328 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 329 |
| 1204 | 330 #define EVENT_PROCESS_PROCESS(e) EVENT_FOO_BAR (e, PROCESS, process, process) |
| 331 #define XEVENT_PROCESS_PROCESS(e) EVENT_PROCESS_PROCESS (XEVENT (e)) | |
| 332 #define SET_EVENT_PROCESS_PROCESS(e, val) \ | |
| 333 SET_EVENT_FOO_BAR (e, PROCESS, process, process, val) | |
| 334 #define XSET_EVENT_PROCESS_PROCESS(e, val) \ | |
| 335 SET_EVENT_PROCESS_PROCESS (XEVENT (e), val) | |
| 336 | |
| 934 | 337 struct Lisp_Timeout_Data |
| 428 | 338 { |
| 771 | 339 /* |
| 340 interval_id The ID returned when the associated call to | |
| 341 add_timeout_cb() was made | |
| 342 ------ the rest of the fields are filled in by XEmacs ----- | |
| 343 id_number The XEmacs timeout ID for this timeout (more | |
| 344 than one timeout event can have the same value | |
| 345 here, since XEmacs timeouts, as opposed to | |
| 346 add_timeout_cb() timeouts, can resignal | |
| 347 themselves) | |
| 348 function An elisp function to call when this timeout is | |
| 349 processed. | |
| 350 object The object passed to that function. | |
| 351 */ | |
| 1204 | 352 #ifdef EVENT_DATA_AS_OBJECTS |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
353 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 354 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 771 | 355 int interval_id; |
| 356 int id_number; | |
| 357 Lisp_Object function; | |
| 358 Lisp_Object object; | |
| 428 | 359 }; |
| 934 | 360 typedef struct Lisp_Timeout_Data Lisp_Timeout_Data; |
| 428 | 361 |
| 1204 | 362 #ifdef EVENT_DATA_AS_OBJECTS |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
363 DECLARE_LISP_OBJECT (timeout_data, Lisp_Timeout_Data); |
| 934 | 364 #define XTIMEOUT_DATA(x) XRECORD (x, timeout_data, Lisp_Timeout_Data) |
| 365 #define wrap_timeout_data(p) wrap_record(p, timeout_data) | |
| 366 #define TIMEOUT_DATAP(x) RECORDP (x, timeout_data) | |
| 367 #define CHECK_TIMEOUT_DATA(x) CHECK_RECORD (x, timeout_data) | |
| 368 #define CONCHECK_TIMEOUT_DATA(x) CONCHECK_RECORD (x, timeout_data) | |
| 1204 | 369 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 370 |
| 1204 | 371 #define EVENT_TIMEOUT_INTERVAL_ID(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id) |
| 372 #define XEVENT_TIMEOUT_INTERVAL_ID(e) EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e)) | |
| 373 #define SET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \ | |
| 374 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id, val) | |
| 375 #define XSET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \ | |
| 376 SET_EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e), val) | |
| 377 | |
| 378 #define EVENT_TIMEOUT_ID_NUMBER(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number) | |
| 379 #define XEVENT_TIMEOUT_ID_NUMBER(e) EVENT_TIMEOUT_ID_NUMBER (XEVENT (e)) | |
| 380 #define SET_EVENT_TIMEOUT_ID_NUMBER(e, val) \ | |
| 381 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number, val) | |
| 382 #define XSET_EVENT_TIMEOUT_ID_NUMBER(e, val) \ | |
| 383 SET_EVENT_TIMEOUT_ID_NUMBER (XEVENT (e), val) | |
| 934 | 384 |
| 1204 | 385 #define EVENT_TIMEOUT_FUNCTION(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, function) |
| 386 #define XEVENT_TIMEOUT_FUNCTION(e) EVENT_TIMEOUT_FUNCTION (XEVENT (e)) | |
| 387 #define SET_EVENT_TIMEOUT_FUNCTION(e, val) \ | |
| 388 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, function, val) | |
| 389 #define XSET_EVENT_TIMEOUT_FUNCTION(e, val) \ | |
| 390 SET_EVENT_TIMEOUT_FUNCTION (XEVENT (e), val) | |
| 934 | 391 |
| 1204 | 392 #define EVENT_TIMEOUT_OBJECT(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, object) |
| 393 #define XEVENT_TIMEOUT_OBJECT(e) EVENT_TIMEOUT_OBJECT (XEVENT (e)) | |
| 394 #define SET_EVENT_TIMEOUT_OBJECT(e, val) \ | |
| 395 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, object, val) | |
| 396 #define XSET_EVENT_TIMEOUT_OBJECT(e, val) \ | |
| 397 SET_EVENT_TIMEOUT_OBJECT (XEVENT (e), val) | |
| 398 | |
| 934 | 399 struct Lisp_Eval_Data |
| 428 | 400 { |
| 771 | 401 /* This kind of event is used internally; sometimes the window system |
| 402 interface would like to inform XEmacs of some user action (such as | |
| 403 focusing on another frame) but needs that to happen synchronously | |
| 404 with the other user input, like keypresses. This is useful when | |
| 405 events are reported through callbacks rather than in the standard | |
| 406 event stream. | |
| 407 | |
| 408 function An elisp function to call with this event object. | |
| 409 object Argument of function. | |
| 410 */ | |
| 1204 | 411 #ifdef EVENT_DATA_AS_OBJECTS |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
412 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 413 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 771 | 414 Lisp_Object function; |
| 415 Lisp_Object object; | |
| 428 | 416 }; |
| 934 | 417 typedef struct Lisp_Eval_Data Lisp_Eval_Data; |
| 428 | 418 |
| 1204 | 419 #ifdef EVENT_DATA_AS_OBJECTS |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
420 DECLARE_LISP_OBJECT (eval_data, Lisp_Eval_Data); |
| 934 | 421 #define XEVAL_DATA(x) XRECORD (x, eval_data, Lisp_Eval_Data) |
| 422 #define wrap_eval_data(p) wrap_record(p, eval_data) | |
| 423 #define EVAL_DATAP(x) RECORDP (x, eval_data) | |
| 424 #define CHECK_EVAL_DATA(x) CHECK_RECORD (x, eval_data) | |
| 425 #define CONCHECK_EVAL_DATA(x) CONCHECK_RECORD (x, eval_data) | |
| 1204 | 426 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 427 |
| 1204 | 428 #define EVENT_EVAL_FUNCTION(e) EVENT_FOO_BAR (e, EVAL, eval, function) |
| 429 #define XEVENT_EVAL_FUNCTION(e) EVENT_EVAL_FUNCTION (XEVENT (e)) | |
| 430 #define SET_EVENT_EVAL_FUNCTION(e, val) \ | |
| 431 SET_EVENT_FOO_BAR (e, EVAL, eval, function, val) | |
| 432 #define XSET_EVENT_EVAL_FUNCTION(e, val) \ | |
| 433 SET_EVENT_EVAL_FUNCTION (XEVENT (e), val) | |
| 934 | 434 |
| 1204 | 435 #define EVENT_EVAL_OBJECT(e) EVENT_FOO_BAR (e, EVAL, eval, object) |
| 436 #define XEVENT_EVAL_OBJECT(e) EVENT_EVAL_OBJECT (XEVENT (e)) | |
| 437 #define SET_EVENT_EVAL_OBJECT(e, val) \ | |
| 438 SET_EVENT_FOO_BAR (e, EVAL, eval, object, val) | |
| 439 #define XSET_EVENT_EVAL_OBJECT(e, val) \ | |
| 440 SET_EVENT_EVAL_OBJECT (XEVENT (e), val) | |
| 934 | 441 |
| 442 struct Lisp_Misc_User_Data | |
| 428 | 443 { |
| 771 | 444 /* #### The misc-user type is serious junk. It should be separated |
| 445 out into different events. There's no reason to create | |
| 446 sub-subtypes of events. | |
| 447 | |
| 448 function An elisp function to call with this event object. | |
| 449 object Argument of function. | |
| 450 button What button went down or up. | |
| 451 modifiers Bucky-bits on that button: shift, control, meta, etc. | |
| 452 x, y Where it was at the button-state-change (in pixels). | |
| 453 This is similar to an eval_event, except that it is | |
| 454 generated by user actions: selections in the | |
| 455 menubar, scrollbar actions, or drag and drop actions. | |
| 456 It is a "command" event, like key and mouse presses | |
| 457 (and unlike mouse motion, process output, and enter | |
| 458 and leave window hooks). In many ways, eval_events | |
| 459 are not the same as keypresses or misc_user_events. | |
| 460 The button, modifiers, x, and y parts are only used | |
| 461 by the XEmacs Drag'n'Drop system. Don't depend on their | |
| 462 values for other types of misc_user_events. | |
| 463 */ | |
| 1204 | 464 #ifdef EVENT_DATA_AS_OBJECTS |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
465 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 466 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 771 | 467 Lisp_Object function; |
| 468 Lisp_Object object; | |
| 469 int button; | |
| 470 int modifiers; | |
| 471 int x, y; | |
| 428 | 472 }; |
| 934 | 473 typedef struct Lisp_Misc_User_Data Lisp_Misc_User_Data; |
| 428 | 474 |
| 1204 | 475 #ifdef EVENT_DATA_AS_OBJECTS |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
476 DECLARE_LISP_OBJECT (misc_user_data, Lisp_Misc_User_Data); |
| 934 | 477 #define XMISC_USER_DATA(x) XRECORD (x, misc_user_data, Lisp_Misc_User_Data) |
| 478 #define wrap_misc_user_data(p) wrap_record(p, misc_user_data) | |
| 479 #define MISC_USER_DATAP(x) RECORDP (x, misc_user_data) | |
| 480 #define CHECK_MISC_USER_DATA(x) CHECK_RECORD (x, misc_user_data) | |
| 481 #define CONCHECK_MISC_USER_DATA(x) CONCHECK_RECORD (x, misc_user_data) | |
| 1204 | 482 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 483 |
| 1204 | 484 #define EVENT_MISC_USER_FUNCTION(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, function) |
| 485 #define XEVENT_MISC_USER_FUNCTION(e) EVENT_MISC_USER_FUNCTION (XEVENT (e)) | |
| 486 #define SET_EVENT_MISC_USER_FUNCTION(e, val) \ | |
| 487 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, function, val) | |
| 488 #define XSET_EVENT_MISC_USER_FUNCTION(e, val) \ | |
| 489 SET_EVENT_MISC_USER_FUNCTION (XEVENT (e), val) | |
| 490 | |
| 491 #define EVENT_MISC_USER_OBJECT(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, object) | |
| 492 #define XEVENT_MISC_USER_OBJECT(e) EVENT_MISC_USER_OBJECT (XEVENT (e)) | |
| 493 #define SET_EVENT_MISC_USER_OBJECT(e, val) \ | |
| 494 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, object, val) | |
| 495 #define XSET_EVENT_MISC_USER_OBJECT(e, val) \ | |
| 496 SET_EVENT_MISC_USER_OBJECT (XEVENT (e), val) | |
| 934 | 497 |
| 1204 | 498 #define EVENT_MISC_USER_BUTTON(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, button) |
| 499 #define XEVENT_MISC_USER_BUTTON(e) EVENT_MISC_USER_BUTTON (XEVENT (e)) | |
| 500 #define SET_EVENT_MISC_USER_BUTTON(e, val) \ | |
| 501 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, button, val) | |
| 502 #define XSET_EVENT_MISC_USER_BUTTON(e, val) \ | |
| 503 SET_EVENT_MISC_USER_BUTTON (XEVENT (e), val) | |
| 504 | |
| 505 #define EVENT_MISC_USER_MODIFIERS(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers) | |
| 506 #define XEVENT_MISC_USER_MODIFIERS(e) EVENT_MISC_USER_MODIFIERS (XEVENT (e)) | |
| 507 #define SET_EVENT_MISC_USER_MODIFIERS(e, val) \ | |
| 508 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers, val) | |
| 509 #define XSET_EVENT_MISC_USER_MODIFIERS(e, val) \ | |
| 510 SET_EVENT_MISC_USER_MODIFIERS (XEVENT (e), val) | |
| 934 | 511 |
| 1204 | 512 #define EVENT_MISC_USER_X(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, x) |
| 513 #define XEVENT_MISC_USER_X(e) EVENT_MISC_USER_X (XEVENT (e)) | |
| 514 #define SET_EVENT_MISC_USER_X(e, val) \ | |
| 515 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, x, val) | |
| 516 #define XSET_EVENT_MISC_USER_X(e, val) \ | |
| 517 SET_EVENT_MISC_USER_X (XEVENT (e), val) | |
| 934 | 518 |
| 1204 | 519 #define EVENT_MISC_USER_Y(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, y) |
| 520 #define XEVENT_MISC_USER_Y(e) EVENT_MISC_USER_Y (XEVENT (e)) | |
| 521 #define SET_EVENT_MISC_USER_Y(e, val) \ | |
| 522 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, y, val) | |
| 523 #define XSET_EVENT_MISC_USER_Y(e, val) \ | |
| 524 SET_EVENT_MISC_USER_Y (XEVENT (e), val) | |
| 934 | 525 |
| 526 struct Lisp_Magic_Eval_Data | |
| 428 | 527 { |
| 771 | 528 /* This is like an eval event but its contents are not |
| 529 Lisp-accessible. This allows for "internal eval events" that call | |
| 530 non-Lisp-accessible functions. Externally, a magic_eval_event just | |
| 531 appears as a magic_event; the Lisp programmer need not know | |
| 532 anything more. | |
| 533 | |
| 534 internal_function An unexported function to call with this event | |
| 535 object. This allows eval events to call internal | |
| 536 functions. For a normal eval event, this field | |
| 537 will always be 0. | |
| 538 object Argument of function. | |
| 539 | |
| 540 */ | |
| 1204 | 541 #ifdef EVENT_DATA_AS_OBJECTS |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
542 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 543 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 771 | 544 void (*internal_function) (Lisp_Object); |
| 545 Lisp_Object object; | |
| 428 | 546 }; |
| 934 | 547 typedef struct Lisp_Magic_Eval_Data Lisp_Magic_Eval_Data; |
| 548 | |
| 1204 | 549 #ifdef EVENT_DATA_AS_OBJECTS |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
550 DECLARE_LISP_OBJECT (magic_eval_data, Lisp_Magic_Eval_Data); |
| 934 | 551 #define XMAGIC_EVAL_DATA(x) XRECORD (x, magic_eval_data, Lisp_Magic_Eval_Data) |
| 552 #define wrap_magic_eval_data(p) wrap_record(p, magic_eval_data) | |
| 553 #define MAGIC_EVAL_DATAP(x) RECORDP (x, magic_eval_data) | |
| 554 #define CHECK_MAGIC_EVAL_DATA(x) CHECK_RECORD (x, magic_eval_data) | |
| 555 #define CONCHECK_MAGIC_EVAL_DATA(x) CONCHECK_RECORD (x, magic_eval_data) | |
| 1204 | 556 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 557 |
| 1204 | 558 #define EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function) |
| 559 #define XEVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e)) | |
| 560 #define SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \ | |
| 561 SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function, val) | |
| 562 #define XSET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \ | |
| 563 SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e), val) | |
| 564 | |
| 565 #define EVENT_MAGIC_EVAL_OBJECT(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object) | |
| 566 #define XEVENT_MAGIC_EVAL_OBJECT(e) EVENT_MAGIC_EVAL_OBJECT (XEVENT (e)) | |
| 567 #define SET_EVENT_MAGIC_EVAL_OBJECT(e, val) \ | |
| 568 SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object, val) | |
| 569 #define XSET_EVENT_MAGIC_EVAL_OBJECT(e, val) \ | |
| 570 SET_EVENT_MAGIC_EVAL_OBJECT (XEVENT (e), val) | |
| 428 | 571 |
| 572 #if defined (HAVE_X_WINDOWS) && defined(emacs) | |
| 573 # include <X11/Xlib.h> | |
| 574 #endif | |
| 575 | |
| 462 | 576 #ifdef HAVE_GTK |
| 577 #include <gdk/gdk.h> | |
| 578 #endif | |
| 579 | |
| 934 | 580 |
| 581 struct Lisp_Magic_Data | |
| 582 { | |
| 1204 | 583 /* No user-serviceable parts within. This is for things like |
| 584 KeymapNotify and ExposeRegion events and so on that XEmacs itself | |
| 585 doesn't care about, but which it must do something with for proper | |
| 586 interaction with the window system. | |
| 587 | |
| 588 Magic_events are handled somewhat asynchronously, just like | |
| 589 subprocess filters. However, occasionally a magic_event needs to | |
| 590 be handled synchronously; in that case, the asynchronous handling | |
| 591 of the magic_event will push an eval_event back onto the queue, | |
| 592 which will be handled synchronously later. This is one of the | |
| 593 reasons why eval_events exist; I'm not entirely happy with this | |
| 594 aspect of this event model. | |
| 595 */ | |
| 596 | |
| 597 #ifdef EVENT_DATA_AS_OBJECTS | |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
598 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 1204 | 599 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 600 |
| 601 union { | |
| 602 #ifdef HAVE_GTK | |
| 603 GdkEvent gdk_event; | |
| 604 #endif | |
| 605 #ifdef HAVE_X_WINDOWS | |
| 606 XEvent x_event; | |
| 607 #endif | |
| 608 #ifdef HAVE_MS_WINDOWS | |
| 609 int mswindows_event; | |
| 610 #endif | |
| 611 } underlying; | |
| 612 }; | |
| 613 | |
| 614 typedef struct Lisp_Magic_Data Lisp_Magic_Data; | |
| 615 | |
| 1204 | 616 #ifdef EVENT_DATA_AS_OBJECTS |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
617 DECLARE_LISP_OBJECT (magic_data, Lisp_Magic_Data); |
| 934 | 618 #define XMAGIC_DATA(x) XRECORD (x, magic_data, Lisp_Magic_Data) |
| 619 #define wrap_magic_data(p) wrap_record(p, magic_data) | |
| 620 #define MAGIC_DATAP(x) RECORDP (x, magic_data) | |
| 621 #define CHECK_MAGIC_DATA(x) CHECK_RECORD (x, magic_data) | |
| 622 #define CONCHECK_MAGIC_DATA(x) CONCHECK_RECORD (x, magic_data) | |
| 1204 | 623 #endif /* EVENT_DATA_AS_OBJECTS */ |
| 934 | 624 |
| 1204 | 625 #define EVENT_MAGIC_UNDERLYING(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying) |
| 626 #define XEVENT_MAGIC_UNDERLYING(e) EVENT_MAGIC_UNDERLYING (XEVENT (e)) | |
| 627 #define SET_EVENT_MAGIC_UNDERLYING(e, val) \ | |
| 628 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying, val) | |
| 629 #define XSET_EVENT_MAGIC_UNDERLYING(e, val) \ | |
| 630 SET_EVENT_MAGIC_UNDERLYING (XEVENT (e), val) | |
| 934 | 631 |
| 632 #ifdef HAVE_GTK | |
| 1204 | 633 #define EVENT_MAGIC_GDK_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event) |
| 634 #define XEVENT_MAGIC_GDK_EVENT(e) EVENT_MAGIC_GDK_EVENT (XEVENT (e)) | |
| 635 #define SET_EVENT_MAGIC_GDK_EVENT(e, val) \ | |
| 636 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event, val) | |
| 637 #define XSET_EVENT_MAGIC_GDK_EVENT(e, val) \ | |
| 638 SET_EVENT_MAGIC_GDK_EVENT (XEVENT (e), val) | |
| 639 #endif | |
| 934 | 640 |
| 641 #ifdef HAVE_X_WINDOWS | |
| 1204 | 642 #define EVENT_MAGIC_X_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event) |
| 643 #define XEVENT_MAGIC_X_EVENT(e) EVENT_MAGIC_X_EVENT (XEVENT (e)) | |
| 644 #define SET_EVENT_MAGIC_X_EVENT(e, val) \ | |
| 645 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event, val) | |
| 646 #define XSET_EVENT_MAGIC_X_EVENT(e, val) \ | |
| 647 SET_EVENT_MAGIC_X_EVENT (XEVENT (e), val) | |
| 934 | 648 #endif |
| 649 | |
| 650 #ifdef HAVE_MS_WINDOWS | |
| 1204 | 651 #define EVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event) |
| 652 #define XEVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e)) | |
| 653 #define SET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \ | |
| 654 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event, val) | |
| 655 #define XSET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \ | |
| 656 SET_EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e), val) | |
| 934 | 657 #endif |
| 658 | |
| 428 | 659 struct Lisp_Timeout |
| 660 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
661 NORMAL_LISP_OBJECT_HEADER header; |
| 428 | 662 int id; /* Id we use to identify the timeout over its lifetime */ |
| 663 int interval_id; /* Id for this particular interval; this may | |
| 771 | 664 be different each time the timeout is |
| 665 signalled.*/ | |
| 428 | 666 Lisp_Object function, object; /* Function and object associated |
| 771 | 667 with timeout. */ |
| 428 | 668 EMACS_TIME next_signal_time; /* Absolute time when the timeout |
| 771 | 669 is next going to be signalled. */ |
| 428 | 670 unsigned int resignal_msecs; /* How far after the next timeout |
| 771 | 671 should the one after that |
| 672 occur? */ | |
| 428 | 673 }; |
| 440 | 674 typedef struct Lisp_Timeout Lisp_Timeout; |
| 428 | 675 |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
676 DECLARE_LISP_OBJECT (timeout, Lisp_Timeout); |
| 440 | 677 #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout) |
| 617 | 678 #define wrap_timeout(p) wrap_record (p, timeout) |
| 428 | 679 #define TIMEOUTP(x) RECORDP (x, timeout) |
| 680 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout) | |
| 681 #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout) | |
| 682 | |
| 683 struct Lisp_Event | |
| 684 { | |
| 685 /* header->next (aka XEVENT_NEXT ()) is used as follows: | |
| 686 - For dead events, this is the next dead one. | |
| 687 - For events on the command_event_queue, the next one on the queue. | |
| 688 - Likewise for events chained in the command builder. | |
| 689 - Otherwise it's Qnil. | |
| 690 */ | |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
691 FROB_BLOCK_LISP_OBJECT_HEADER lheader; |
| 771 | 692 Lisp_Object next; |
| 693 emacs_event_type event_type; | |
| 694 | |
| 695 /* Where this event occurred on. This will be a frame, device, | |
| 696 console, or nil, depending on the event type. It is important | |
| 697 that an object of a more specific type than is actually generated | |
| 698 is not substituted -- e.g. there should not be a frame inserted | |
| 699 when a key-press event occurs, because events on dead channels | |
| 700 are automatically ignored. | |
| 701 | |
| 702 Specifically: | |
| 703 | |
| 704 -- for button and mouse-motion events, channel will be a | |
| 705 frame. (The translation to a window occurs later.) | |
| 706 | |
| 707 -- for keyboard events, channel will be a console. Note that | |
| 708 fake keyboard events (generated by `character-to-event' or | |
| 709 something that calls this, such as macros) need to have the | |
| 710 selected console stored into them when the event is created. | |
| 711 This is so that the correct console-local variables (e.g. the | |
| 712 command builder) will get affected. | |
| 713 | |
| 714 -- for timer, process, magic-eval, and eval events, channel will | |
| 715 be nil. | |
| 716 | |
| 717 -- for misc-user events, channel will be a frame. | |
| 718 | |
| 719 -- for magic events, channel will be a frame (usually) or a | |
| 720 device. */ | |
| 721 Lisp_Object channel; | |
| 722 | |
| 723 /* When this event occurred -- if not known, this is made up. #### | |
| 724 All timestamps should be measured as milliseconds since XEmacs | |
| 725 started. Currently they are raw server timestamps. (The X | |
| 726 protocol doesn't provide any easy way of translating between | |
| 727 server time and real process time; yuck.) */ | |
| 934 | 728 unsigned int timestamp; |
| 771 | 729 |
| 1204 | 730 #ifdef EVENT_DATA_AS_OBJECTS |
| 934 | 731 Lisp_Object event_data; |
| 1204 | 732 #else /* not EVENT_DATA_AS_OBJECTS */ |
| 428 | 733 union |
| 734 { | |
| 1204 | 735 Lisp_Key_Data key; |
| 736 Lisp_Button_Data button; | |
| 737 Lisp_Motion_Data motion; | |
| 738 Lisp_Process_Data process; | |
| 739 Lisp_Timeout_Data timeout; | |
| 740 Lisp_Eval_Data eval; /* misc_user_event no longer uses this */ | |
| 741 Lisp_Misc_User_Data misc_user;/* because it needs position information */ | |
| 742 Lisp_Magic_Data magic; | |
| 743 Lisp_Magic_Eval_Data magic_eval; | |
| 428 | 744 } event; |
| 1204 | 745 #endif /* not EVENT_DATA_AS_OBJECTS */ |
| 428 | 746 }; |
| 747 | |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
748 DECLARE_LISP_OBJECT (event, Lisp_Event); |
| 440 | 749 #define XEVENT(x) XRECORD (x, event, Lisp_Event) |
| 617 | 750 #define wrap_event(p) wrap_record (p, event) |
| 428 | 751 #define EVENTP(x) RECORDP (x, event) |
| 752 #define CHECK_EVENT(x) CHECK_RECORD (x, event) | |
| 753 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event) | |
| 754 | |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
755 DECLARE_LISP_OBJECT (command_builder, struct command_builder); |
| 428 | 756 |
| 757 #define EVENT_CHANNEL(a) ((a)->channel) | |
| 1204 | 758 #define XEVENT_CHANNEL(ev) (XEVENT (ev)->channel) |
| 428 | 759 #define EVENT_TYPE(a) ((a)->event_type) |
| 760 #define XEVENT_TYPE(a) (XEVENT (a)->event_type) | |
| 761 #define EVENT_NEXT(a) ((a)->next) | |
| 762 #define XEVENT_NEXT(e) (XEVENT (e)->next) | |
| 1204 | 763 #define EVENT_TIMESTAMP(ev) ((ev)->timestamp) |
| 764 #define XEVENT_TIMESTAMP(ev) EVENT_TIMESTAMP (XEVENT (ev)) | |
| 934 | 765 |
| 1204 | 766 #ifdef EVENT_DATA_AS_OBJECTS |
| 934 | 767 #define XEVENT_DATA(ev) (XEVENT (ev)->event_data) |
| 768 #define EVENT_DATA(ev) ((ev)->event_data) | |
| 1204 | 769 #define SET_EVENT_DATA(ev, d) \ |
| 770 do { \ | |
| 771 Lisp_Event *mac_event = (ev); \ | |
| 772 mac_event->event_data = (d); \ | |
| 773 } while (0) | |
| 774 #define XSET_EVENT_DATA(ev, d) SET_EVENT_DATA (XEVENT (ev), d) | |
| 775 #endif /* EVENT_DATA_AS_OBJECTS */ | |
| 934 | 776 |
| 1204 | 777 #define SET_EVENT_TIMESTAMP_ZERO(ev) ((ev)->timestamp = 0) |
| 778 #define SET_EVENT_TIMESTAMP(ev, t) ((ev)->timestamp = (t)) | |
| 934 | 779 #define XSET_EVENT_TIMESTAMP(ev, t) SET_EVENT_TIMESTAMP (XEVENT (ev), t) |
| 780 | |
| 781 #define SET_EVENT_CHANNEL(ev, c) \ | |
| 782 do { \ | |
| 783 Lisp_Event *mac_event = (ev); \ | |
| 784 mac_event->channel = (c); \ | |
| 785 } while (0) | |
| 786 #define XSET_EVENT_CHANNEL(ev, c) SET_EVENT_CHANNEL (XEVENT (ev), c) | |
| 787 | |
| 1204 | 788 DECLARE_INLINE_HEADER ( |
| 789 void | |
| 790 set_event_type (struct Lisp_Event *event, emacs_event_type t) | |
| 791 ) | |
| 792 { | |
| 793 #ifdef EVENT_DATA_AS_OBJECTS | |
| 794 switch (EVENT_TYPE (event)) | |
| 795 { | |
| 796 case key_press_event: | |
| 797 free_key_data (event->event_data); | |
| 798 break; | |
| 799 case button_press_event: | |
| 800 case button_release_event: | |
| 801 free_button_data (event->event_data); | |
| 802 break; | |
| 803 case pointer_motion_event: | |
| 804 free_motion_data (event->event_data); | |
| 805 break; | |
| 806 case process_event: | |
| 807 free_process_data (event->event_data); | |
| 808 break; | |
| 809 case timeout_event: | |
| 810 free_timeout_data (event->event_data); | |
| 811 break; | |
| 812 case magic_event: | |
| 813 free_magic_data (event->event_data); | |
| 814 break; | |
| 815 case magic_eval_event: | |
| 816 free_magic_eval_data (event->event_data); | |
| 817 break; | |
| 818 case eval_event: | |
| 819 free_eval_data (event->event_data); | |
| 820 break; | |
| 821 case misc_user_event: | |
| 822 free_misc_user_data (event->event_data); | |
| 823 break; | |
| 824 default: | |
| 825 break; | |
| 826 } | |
| 827 #endif /* EVENT_DATA_AS_OBJECTS */ | |
| 934 | 828 |
| 829 event->event_type = t; | |
| 830 | |
| 1204 | 831 #ifdef EVENT_DATA_AS_OBJECTS |
| 832 switch (t) | |
| 833 { | |
| 834 case key_press_event: | |
| 835 event->event_data = make_key_data (); | |
| 836 break; | |
| 837 case button_press_event: | |
| 838 case button_release_event: | |
| 839 event->event_data = make_button_data (); | |
| 840 break; | |
| 841 case pointer_motion_event: | |
| 842 event->event_data = make_motion_data (); | |
| 843 break; | |
| 844 case process_event: | |
| 845 event->event_data = make_process_data (); | |
| 846 break; | |
| 847 case timeout_event: | |
| 848 event->event_data = make_timeout_data (); | |
| 849 break; | |
| 850 case magic_event: | |
| 851 event->event_data = make_magic_data (); | |
| 852 break; | |
| 853 case magic_eval_event: | |
| 854 event->event_data = make_magic_eval_data (); | |
| 855 break; | |
| 856 case eval_event: | |
| 857 event->event_data = make_eval_data (); | |
| 858 break; | |
| 859 case misc_user_event: | |
| 860 event->event_data = make_misc_user_data (); | |
| 861 break; | |
| 862 default: | |
| 863 event->event_data = Qnil; | |
| 864 break; | |
| 865 } | |
| 866 #endif /* EVENT_DATA_AS_OBJECTS */ | |
| 934 | 867 } |
| 1204 | 868 |
| 869 #define SET_EVENT_NEXT(ev, n) do { (ev)->next = (n); } while (0) | |
| 870 #define XSET_EVENT_NEXT(ev, n) SET_EVENT_NEXT (XEVENT (ev), n) | |
| 871 | |
| 934 | 872 #define XSET_EVENT_TYPE(ev, t) set_event_type (XEVENT (ev), t) |
| 873 #define SET_EVENT_TYPE(ev, t) set_event_type (ev, t) | |
| 874 | |
| 428 | 875 #define EVENT_CHAIN_LOOP(event, chain) \ |
| 876 for (event = chain; !NILP (event); event = XEVENT_NEXT (event)) | |
| 877 | |
| 878 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event) | |
| 879 | |
| 771 | 880 #define CHECK_LIVE_EVENT(x) do { \ |
| 881 CHECK_EVENT (x); \ | |
| 882 if (! EVENT_LIVE_P (XEVENT (x))) \ | |
| 883 dead_wrong_type_argument (Qevent_live_p, (x)); \ | |
| 428 | 884 } while (0) |
| 771 | 885 #define CONCHECK_LIVE_EVENT(x) do { \ |
| 886 CONCHECK_EVENT (x); \ | |
| 887 if (! EVENT_LIVE_P (XEVENT (x))) \ | |
| 888 x = wrong_type_argument (Qevent_live_p, (x)); \ | |
| 428 | 889 } while (0) |
| 890 | |
| 891 | |
| 892 EXFUN (Fcharacter_to_event, 4); | |
| 893 EXFUN (Fdeallocate_event, 1); | |
| 894 EXFUN (Fevent_glyph_extent, 1); | |
| 895 EXFUN (Fevent_modeline_position, 1); | |
| 896 EXFUN (Fevent_over_modeline_p, 1); | |
| 897 EXFUN (Fevent_over_toolbar_p, 1); | |
| 898 EXFUN (Fevent_over_vertical_divider_p, 1); | |
| 899 EXFUN (Fevent_point, 1); | |
| 900 EXFUN (Fevent_window, 1); | |
| 901 EXFUN (Fmake_event, 2); | |
| 1268 | 902 EXFUN (Fnext_command_event, 2); |
| 428 | 903 |
| 904 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn; | |
| 905 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property; | |
| 906 extern Lisp_Object Qcancel_mode_internal; | |
| 444 | 907 extern Lisp_Object Vmodifier_keys_sticky_time; |
| 428 | 908 |
| 502 | 909 /* The modifiers XEmacs knows about; these appear in key and button events. */ |
| 910 | |
|
4906
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
911 enum event_modifiers |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
912 { |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
913 XEMACS_MOD_CONTROL = (1<<0), |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
914 XEMACS_MOD_META = (1<<1), |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
915 XEMACS_MOD_SUPER = (1<<2), |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
916 XEMACS_MOD_HYPER = (1<<3), |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
917 XEMACS_MOD_ALT = (1<<4), |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
918 XEMACS_MOD_SHIFT = (1<<5) /* not used for dual-case characters */, |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
919 #define FROB(num) \ |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
920 XEMACS_MOD_BUTTON##num = (1<<(num+5)), |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
921 #include "keymap-buttons.h" |
|
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4780
diff
changeset
|
922 }; |
| 4272 | 923 |
| 502 | 924 /* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key |
| 925 if there are both Alt and Meta keys. If there are no Meta keys, | |
| 926 then Alt generates XEMACS_MOD_META instead. | |
| 428 | 927 */ |
| 928 | |
| 929 /* Maybe this should be trickier */ | |
| 930 #define KEYSYM(x) (intern (x)) | |
| 931 | |
|
4780
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
932 typedef enum character_to_event_meta_behavior |
|
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
933 { |
|
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
934 high_bit_is_meta, |
|
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
935 use_console_meta_flag, |
|
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
936 latin_1_maps_to_itself |
|
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
937 } character_to_event_meta_behavior; |
|
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
938 |
| 428 | 939 /* from events.c */ |
| 934 | 940 void format_event_object (Eistring *buf, Lisp_Object event, int brief); |
| 1229 | 941 /*void format_event_data_object (Eistring *buf, Lisp_Object data, int brief);*/ |
|
4780
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
942 void character_to_event (Ichar, Lisp_Event *, struct console *, |
|
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
943 character_to_event_meta_behavior meta_flag, |
| 771 | 944 int do_backspace_mapping); |
|
4780
2fd201d73a92
Call character_to_event on characters received from XIM, event-Xt.c
Aidan Kehoe <kehoea@parhasard.net>
parents:
4272
diff
changeset
|
945 |
| 440 | 946 void zero_event (Lisp_Event *e); |
| 1204 | 947 |
| 948 #define MECR_DEALLOCATE_EVENT 1 | |
| 949 | |
| 428 | 950 void deallocate_event_chain (Lisp_Object event); |
| 951 Lisp_Object event_chain_tail (Lisp_Object event); | |
| 952 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); | |
| 953 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); | |
| 954 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, | |
| 771 | 955 Lisp_Object *tail); |
| 1204 | 956 int map_event_chain_remove (int (*fn) (Lisp_Object ev, void *user_data), |
| 957 Lisp_Object *head, Lisp_Object *tail, | |
| 958 void *user_data, int flags); | |
| 428 | 959 int event_chain_count (Lisp_Object event_chain); |
| 960 Lisp_Object event_chain_find_previous (Lisp_Object event_chain, | |
| 771 | 961 Lisp_Object event); |
| 428 | 962 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); |
| 963 Lisp_Object copy_event_chain (Lisp_Object event_chain); | |
| 1204 | 964 Lisp_Object transfer_event_chain_pointer (Lisp_Object pointer, |
| 965 Lisp_Object old_chain, | |
| 966 Lisp_Object new_chain); | |
| 967 | |
| 968 | |
| 969 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event); | |
| 970 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq); | |
| 428 | 971 /* True if this is a non-internal event |
| 972 (keyboard press, menu, scrollbar, mouse button) */ | |
| 973 int command_event_p (Lisp_Object event); | |
| 440 | 974 void define_self_inserting_symbol (Lisp_Object, Lisp_Object); |
| 2828 | 975 Ichar event_to_character (Lisp_Object, int, int); |
| 428 | 976 struct console *event_console_or_selected (Lisp_Object event); |
| 1204 | 977 void upshift_event (Lisp_Object event); |
| 978 void downshift_event (Lisp_Object event); | |
| 979 int event_upshifted_p (Lisp_Object event); | |
| 428 | 980 |
| 981 /* from event-stream.c */ | |
| 1204 | 982 extern Lisp_Object dispatch_event_queue; |
| 771 | 983 Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf); |
| 1204 | 984 void enqueue_dispatch_event (Lisp_Object event); |
| 985 Lisp_Object dequeue_dispatch_event (void); | |
| 428 | 986 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); |
| 440 | 987 void event_stream_handle_magic_event (Lisp_Event *event); |
| 788 | 988 void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream); |
| 989 int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2); | |
| 990 Hashcode event_stream_hash_magic_event (Lisp_Event *e); | |
| 428 | 991 void event_stream_select_console (struct console *con); |
| 992 void event_stream_unselect_console (struct console *con); | |
| 853 | 993 void event_stream_select_process (Lisp_Process *proc, int doin, int doerr); |
| 994 void event_stream_unselect_process (Lisp_Process *proc, int doin, int doerr); | |
| 995 void event_stream_create_io_streams (void* inhandle, void* outhandle, | |
| 996 void *errhandle, Lisp_Object* instream, | |
| 997 Lisp_Object* outstream, | |
| 998 Lisp_Object* errstream, | |
| 999 USID* in_usid, | |
| 1000 USID* err_usid, | |
| 1001 int flags); | |
| 1002 void event_stream_delete_io_streams (Lisp_Object instream, | |
| 1003 Lisp_Object outstream, | |
| 1004 Lisp_Object errstream, | |
| 1005 USID* in_usid, | |
| 1006 USID* err_usid); | |
| 1268 | 1007 Lisp_Object event_stream_protect_modal_loop (const char *error_string, |
| 1008 Lisp_Object (*bfun) (void *barg), | |
| 1009 void *barg, int flags); | |
| 1010 void event_stream_drain_queue (void); | |
| 428 | 1011 void event_stream_quit_p (void); |
| 853 | 1012 void run_pre_idle_hook (void); |
| 428 | 1013 |
| 1014 struct low_level_timeout | |
| 1015 { | |
| 1016 int id; | |
| 1017 EMACS_TIME time; | |
| 1018 struct low_level_timeout *next; | |
| 1019 }; | |
| 1020 | |
| 1021 int add_low_level_timeout (struct low_level_timeout **timeout_list, | |
| 771 | 1022 EMACS_TIME thyme); |
| 428 | 1023 void remove_low_level_timeout (struct low_level_timeout **timeout_list, |
| 771 | 1024 int id); |
| 428 | 1025 int get_low_level_timeout_interval (struct low_level_timeout * |
| 771 | 1026 timeout_list, EMACS_TIME *interval); |
| 428 | 1027 int pop_low_level_timeout (struct low_level_timeout **timeout_list, |
| 771 | 1028 EMACS_TIME *time_out); |
| 428 | 1029 int event_stream_generate_wakeup (unsigned int milliseconds, |
| 771 | 1030 unsigned int vanilliseconds, |
| 1031 Lisp_Object function, | |
| 1032 Lisp_Object object, | |
| 1033 int async_p); | |
| 593 | 1034 int event_stream_resignal_wakeup (int interval_id, int async_p, |
| 771 | 1035 Lisp_Object *function, Lisp_Object *object); |
| 428 | 1036 void event_stream_disable_wakeup (int id, int async_p); |
| 1037 | |
| 593 | 1038 /* from signal.c */ |
| 1039 int signal_add_async_interval_timeout (EMACS_TIME thyme); | |
| 1040 void signal_remove_async_interval_timeout (int id); | |
| 428 | 1041 |
| 1042 /* from event-stream.c -- focus sanity */ | |
| 1043 extern int focus_follows_mouse; | |
| 1044 void investigate_frame_change (void); | |
| 1045 | |
| 1046 void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev); | |
| 1047 void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev); | |
| 1048 | |
| 1049 Lisp_Object extract_this_command_keys_nth_mouse_event (int n); | |
| 1050 Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n); | |
| 1051 | |
| 1052 void single_console_state (void); | |
| 1053 void any_console_state (void); | |
| 1054 int in_single_console_state (void); | |
| 1055 | |
| 1056 extern int emacs_is_blocking; | |
| 1268 | 1057 extern int in_modal_loop; |
| 428 | 1058 extern volatile int sigint_happened; |
| 1059 | |
| 1060 #ifdef HAVE_UNIXOID_EVENT_LOOP | |
| 1061 /* from event-unixoid.c */ | |
| 1062 | |
| 1063 /* Ceci n'est pas un pipe. */ | |
| 1064 extern int signal_event_pipe[]; | |
| 1065 | |
| 1066 void signal_fake_event (void); | |
| 1067 void drain_signal_event_pipe (void); | |
| 1204 | 1068 void drain_tty_devices (void); |
| 428 | 1069 |
| 1070 extern int fake_event_occurred; | |
| 1071 | |
| 1072 int event_stream_unixoid_select_console (struct console *con); | |
| 1073 int event_stream_unixoid_unselect_console (struct console *con); | |
| 853 | 1074 void event_stream_unixoid_select_process (Lisp_Process *proc, int doin, |
| 1075 int doerr, int *infd, int *errfd); | |
| 1076 void event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin, | |
| 1077 int doerr, int *infd, int *errfd); | |
| 1204 | 1078 struct console *find_tty_or_stream_console_from_fd (int fd); |
| 440 | 1079 int read_event_from_tty_or_stream_desc (Lisp_Event *event, |
| 771 | 1080 struct console *con); |
| 853 | 1081 void event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle, |
| 1082 void *errhandle, | |
| 1083 Lisp_Object* instream, | |
| 1084 Lisp_Object* outstream, | |
| 1085 Lisp_Object* errstream, | |
| 1086 USID* in_usid, | |
| 1087 USID* err_usid, | |
| 1088 int flags); | |
| 1089 void event_stream_unixoid_delete_io_streams (Lisp_Object instream, | |
| 1090 Lisp_Object outstream, | |
| 1091 Lisp_Object errstream, | |
| 1092 USID* in_usid, | |
| 1093 USID* err_usid); | |
| 428 | 1094 |
| 1204 | 1095 #endif /* HAVE_UNIXOID_EVENT_LOOP */ |
| 1096 | |
| 1097 /* The following is not inside of HAVE_UNIXOID_EVENT_LOOP because of the | |
| 1098 possibility of combiling XEmacs with no-MSW, no-X, no-TTY -- | |
| 1099 process-unix.c is still compiled. #### Should we still compile | |
| 1100 subprocesses with no event loops? */ | |
| 428 | 1101 /* Beware: this evil macro evaluates its arg many times */ |
| 1102 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd))) | |
| 1103 | |
| 1104 /* Define this if you want the tty event stream to be used when the | |
| 1105 first console is tty, even if HAVE_X_WINDOWS is defined */ | |
| 1106 /* #define DEBUG_TTY_EVENT_STREAM */ | |
| 1107 | |
| 1108 | |
| 442 | 1109 /* #### a hack, until accelerator shit is cleaned up */ |
| 1110 | |
| 1111 /* This structure is what we use to encapsulate the state of a command sequence | |
| 1112 being composed; key events are executed by adding themselves to the command | |
| 1113 builder; if the command builder is then complete (does not still represent | |
| 1114 a prefix key sequence) it executes the corresponding command. | |
| 1115 */ | |
| 1116 struct command_builder | |
| 1117 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1118 NORMAL_LISP_OBJECT_HEADER header; |
| 442 | 1119 Lisp_Object console; /* back pointer to the console this command |
| 771 | 1120 builder is for */ |
| 1121 #if 0 | |
| 1122 /* #### Not implemented: nil, or an event representing the first | |
| 1123 event read after the last command completed. Threaded. */ | |
| 442 | 1124 Lisp_Object prefix_events; |
| 771 | 1125 #endif /* 0 */ |
| 1126 /* nil, or an event chain representing the events in the current | |
| 1127 keymap-lookup sequence. NOTE: All events in the chain MUST be | |
| 1128 freshly allocated, with no pointers to them elsewhere. */ | |
| 442 | 1129 Lisp_Object current_events; |
| 771 | 1130 /* Last elt of current_events */ |
| 442 | 1131 Lisp_Object most_current_event; |
| 771 | 1132 /* Last elt before function map code took over. What this means is: |
| 442 | 1133 All prefixes up to (but not including) this event have non-nil |
| 1134 bindings, but the prefix including this event has a nil binding. | |
| 1135 Any events in the chain after this one were read solely because | |
| 1136 we're part of a possible function key. If we end up with | |
| 1137 something that's not part of a possible function key, we have to | |
| 1138 unread all of those events. */ | |
| 1139 Lisp_Object last_non_munged_event; | |
| 1204 | 1140 /* One value for function-key-map, one for key-translation-map: |
| 1141 First event that can begin a possible function key sequence | |
| 1142 (to be translated according to function-key-map). Normally | |
| 1143 this is the first event in the chain. However, once we've | |
| 1144 translated a sequence through function-key-map, this will point | |
| 1145 to the first event after the translated sequence: we don't ever | |
| 1146 want to translate any events twice through function-key-map, or | |
| 1147 things could get really screwed up (e.g. if the user created a | |
| 1148 translation loop). If this is nil, then the next-read event is | |
| 1149 the first that can begin a function key sequence. */ | |
| 1150 Lisp_Object first_mungeable_event[2]; | |
| 934 | 1151 Ibyte *echo_buf; |
| 442 | 1152 |
| 1153 Bytecount echo_buf_length; /* size of echo_buf */ | |
| 1154 Bytecount echo_buf_index; /* index into echo_buf | |
| 771 | 1155 * -1 before doing echoing for new cmd */ |
| 442 | 1156 /* Self-insert-command is magic in that it doesn't always push an undo- |
| 1157 boundary: up to 20 consecutive self-inserts can happen before an undo- | |
| 1158 boundary is pushed. This variable is that counter. | |
| 1159 */ | |
|
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5127
diff
changeset
|
1160 Elemcount self_insert_countdown; |
| 442 | 1161 }; |
| 1162 | |
| 440 | 1163 #endif /* INCLUDED_events_h_ */ |
