Mercurial > hg > xemacs-beta
view src/events.h @ 2367:ecf1ebac70d8
[xemacs-hg @ 2004-11-04 23:05:23 by ben]
commit mega-patch
configure.in: Turn off -Winline and -Wchar-subscripts.
Use the right set of cflags when compiling modules.
Rewrite ldap configuration to separate the inclusion of lber
(needed in recent Cygwin) from the basic checks for the
needed libraries.
add a function for MAKE_JUNK_C; initially code was added to
generate xemacs.def using this, but it will need to be rewritten.
add an rm -f for junk.c to avoid weird Cygwin bug with cp -f onto
an existing file.
Sort list of auto-detected functions and eliminate unused checks for
stpcpy, setlocale and getwd.
Add autodetection of Cygwin scanf problems
BETA: Rewrite section on configure to indicate what flags are important
and what not.
digest-doc.c, make-dump-id.c, profile.c, sorted-doc.c: Add proper decls for main().
make-msgfile.c: Document that this is old junk.
Move proposal to text.c.
make-msgfile.lex: Move proposal to text.c.
make-mswin-unicode.pl: Convert error-generating code so that the entire message will
be seen as a single unrecognized token.
mule/mule-ccl.el: Update docs.
lispref/mule.texi: Update CCL docs.
ldap/eldap.c: Mule-ize.
Use EXTERNAL_LIST_LOOP_2 instead of deleted EXTERNAL_LIST_LOOP.
* XEmacs 21.5.18 "chestnut" is released.
---------------------------------------------------------------
MULE-RELATED WORK:
---------------------------------------------------------------
---------------------------
byte-char conversion
---------------------------
buffer.c, buffer.h, insdel.c, text.c: Port FSF algorithm for byte-char conversion, replacing broken
previous version. Track the char position of the gap. Add
functions to do char-byte conversion downwards as well as upwards.
Move comments about algorithm workings to internals manual.
---------------------------
work on types
---------------------------
alloc.c, console-x-impl.h, dump-data.c, dump-data.h, dumper.c, dialog-msw.c, dired-msw.c, doc.c, editfns.c, esd.c, event-gtk.h, event-msw.c, events.c, file-coding.c, file-coding.h, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-x.c, glyphs.c, glyphs.h, gui.c, hpplay.c, imgproc.c, intl-win32.c, lrecord.h, lstream.c, keymap.c, lisp.h, libsst.c, linuxplay.c, miscplay.c, miscplay.h, mule-coding.c, nas.c, nt.c, ntheap.c, ntplay.c, objects-msw.c, objects-tty.c, objects-x.c, print.c, process-nt.c, process.c, redisplay.h, select-common.h, select-gtk.c, select-x.c, sgiplay.c, sound.c, sound.h, sunplay.c, sysfile.h, sysdep.c, syswindows.h, text.c, unexnt.c, win32.c, xgccache.c: Further work on types. This creates a full set of types for all
the basic semantics of `char' that I have so far identified, so that
its semantics can always be identified for the purposes of proper
Mule-safe code, and the raw use of `char' always avoided.
(1) More type renaming, for consistency of naming.
Char_ASCII -> Ascbyte
UChar_ASCII -> UAscbyte
Char_Binary -> CBinbyte
UChar_Binary -> Binbyte
SChar_Binary -> SBinbyte
(2) Introduce Rawbyte, CRawbyte, Boolbyte, Chbyte, UChbyte, and
Bitbyte and use them.
(3) New types Itext, Wexttext and Textcount for separating out
the concepts of bytes and textual units (different under UTF-16
and UTF-32, which are potential internal encodings).
(4) qxestr*_c -> qxestr*_ascii.
lisp.h: New; goes with other qxe() functions. #### Maybe goes in a
different section.
lisp.h: Group generic int-type defs together with EMACS_INT defs.
lisp.h: * lisp.h (WEXTTEXT_IS_WIDE)
New defns.
lisp.h: New type to replace places where int occurs as a boolean.
It's signed because occasionally people may want to use -1 as
an error value, and because unsigned ints are viral -- see comments
in the internals manual against using them.
dynarr.c: int -> Bytecount.
---------------------------
Mule-izing
---------------------------
device-x.c: Partially Mule-ize.
dumper.c, dumper.h: Mule-ize. Use Rawbyte. Use stderr_out not printf. Use wext_*().
sysdep.c, syswindows.h, text.c: New Wexttext API for manipulation of external text that may be
Unicode (e.g. startup code under Windows).
emacs.c: Mule-ize. Properly deal with argv in external encoding.
Use wext_*() and Wexttext. Use Rawbyte.
#if 0 some old junk on SCO that is unlikely to be correct.
Rewrite allocation code in run-temacs.
emacs.c, symsinit.h, win32.c: Rename win32 init function and call it even earlier, to
initialize mswindows_9x_p even earlier, for use in startup code
(XEUNICODE_P).
process.c: Use _wenviron not environ under Windows, to get Unicode environment
variables.
event-Xt.c: Mule-ize drag-n-drop related stuff.
dragdrop.c, dragdrop.h, frame-x.c: Mule-ize.
text.h: Add some more stand-in defines for particular kinds of conversion;
use in Mule-ization work in frame-x.c etc.
---------------------------
Freshening
---------------------------
intl-auto-encap-win32.c, intl-auto-encap-win32.h: Regenerate.
---------------------------
Unicode-work
---------------------------
intl-win32.c, syswindows.h: Factor out common options to MultiByteToWideChar and
WideCharToMultiByte. Add convert_unicode_to_multibyte_malloc()
and convert_unicode_to_multibyte_dynarr() and use. Add stuff for
alloca() conversion of multibyte/unicode.
alloc.c: Use dfc_external_data_len() in case of unicode coding system.
alloc.c, mule-charset.c: Don't zero out and reinit charset Unicode tables. This fucks up
dump-time loading. Anyway, either we load them at dump time or
run time, never both.
unicode.c: Dump the blank tables as well.
---------------------------------------------------------------
DOCUMENTATION, MOSTLY MULE-RELATED:
---------------------------------------------------------------
EmacsFrame.c, emodules.c, event-Xt.c, fileio.c, input-method-xlib.c, mule-wnnfns.c, redisplay-gtk.c, redisplay-tty.c, redisplay-x.c, regex.c, sysdep.c: Add comment about Mule work needed.
text.h: Add more documentation describing why DFC routines were not written
to return their value. Add some other DFC documentation.
console-msw.c, console-msw.h: Add pointer to docs in win32.c.
emacs.c: Add comments on sources of doc info.
text.c, charset.h, unicode.c, intl-win32.c, intl-encap-win32.c, text.h, file-coding.c, mule-coding.c: Collect background comments and related to text matters and
internationalization, and proposals for work to be done, in text.c
or Internals manual, stuff related to specific textual API's in
text.h, and stuff related to internal implementation of Unicode
conversion in unicode.c. Put lots of pointers to the comments to
make them easier to find.
s/mingw32.h, s/win32-common.h, s/win32-native.h, s/windowsnt.h, win32.c: Add bunches of new documentation on the different kinds of
builds and environments under Windows and how they work.
Collect this info in win32.c. Add pointers to these docs in
the relevant s/* files.
emacs.c: Document places with long comments.
Remove comment about exiting, move to internals manual, put
in pointer.
event-stream.c: Move docs about event queues and focus to internals manual, put
in pointer.
events.h: Move docs about event stream callbacks to internals manual, put
in pointer.
profile.c, redisplay.c, signal.c: Move documentation to the Internals manual.
process-nt.c: Add pointer to comment in win32-native.el.
lisp.h: Add comments about some comment conventions.
lisp.h: Add comment about the second argument.
device-msw.c, redisplay-msw.c: @@#### comments are out-of-date.
---------------------------------------------------------------
PDUMP WORK (MOTIVATED BY UNICODE CHANGES)
---------------------------------------------------------------
alloc.c, buffer.c, bytecode.c, console-impl.h, console.c, device.c, dumper.c, lrecord.h, elhash.c, emodules.h, events.c, extents.c, frame.c, glyphs.c, glyphs.h, mule-charset.c, mule-coding.c, objects.c, profile.c, rangetab.c, redisplay.c, specifier.c, specifier.h, window.c, lstream.c, file-coding.h, file-coding.c: PDUMP:
Properly implement dump_add_root_block(), which never worked before,
and is necessary for dumping Unicode tables.
Pdump name changes for accuracy:
XD_STRUCT_PTR -> XD_BLOCK_PTR.
XD_STRUCT_ARRAY -> XD_BLOCK_ARRAY.
XD_C_STRING -> XD_ASCII_STRING.
*_structure_* -> *_block_*.
lrecord.h: some comments added about
dump_add_root_block() vs dump_add_root_block_ptr().
extents.c: remove incorrect comment about pdump problems with gap array.
---------------------------------------------------------------
ALLOCATION
---------------------------------------------------------------
abbrev.c, alloc.c, bytecode.c, casefiddle.c, device-msw.c, device-x.c, dired-msw.c, doc.c, doprnt.c, dragdrop.c, editfns.c, emodules.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-msw.c, gui-x.c, imgproc.c, intl-win32.c, lread.c, menubar-gtk.c, menubar.c, nt.c, objects-msw.c, objects-x.c, print.c, process-nt.c, process-unix.c, process.c, realpath.c, redisplay.c, search.c, select-common.c, symbols.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: New macros {alloca,xnew}_{itext,{i,ext,raw,bin,asc}bytes} for
more convenient allocation of these commonly requested items.
Modify functions to use alloca_ibytes, alloca_array, alloca_extbytes,
xnew_ibytes, etc. also XREALLOC_ARRAY, xnew.
alloc.c: Rewrite the allocation functions to factor out repeated code.
Add assertions for freeing dumped data.
lisp.h: Moved down and consolidated with other allocation stuff.
lisp.h, dynarr.c: New functions for allocation that's very efficient when mostly in
LIFO order.
lisp.h, text.c, text.h: Factor out some stuff for general use by alloca()-conversion funs.
text.h, lisp.h: Fill out convenience routines for allocating various kinds of
bytes and put them in lisp.h. Use them in place of xmalloc(),
ALLOCA().
text.h: Fill out the convenience functions so the _MALLOC() kinds match
the alloca() kinds.
---------------------------------------------------------------
ERROR-CHECKING
---------------------------------------------------------------
text.h: Create ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN()
from similar Eistring checkers and change the Eistring checkers to
use them instead.
---------------------------------------------------------------
MACROS IN LISP.H
---------------------------------------------------------------
lisp.h: Redo GCPRO declarations. Create a "base" set of functions that can
be used to generate any kind of gcpro sets -- regular, ngcpro,
nngcpro, private ones used in GC_EXTERNAL_LIST_LOOP_2.
buffer.c, callint.c, chartab.c, console-msw.c, device-x.c, dialog-msw.c, dired.c, extents.c, ui-gtk.c, rangetab.c, nt.c, mule-coding.c, minibuf.c, menubar-msw.c, menubar.c, menubar-gtk.c, lread.c, lisp.h, gutter.c, glyphs.c, glyphs-widget.c, fns.c, fileio.c, file-coding.c, specifier.c: Eliminate EXTERNAL_LIST_LOOP, which does not check for circularities.
Use EXTERNAL_LIST_LOOP_2 instead or EXTERNAL_LIST_LOOP_3
or EXTERNAL_PROPERTY_LIST_LOOP_3 or GC_EXTERNAL_LIST_LOOP_2
(new macro). Removed/redid comments on EXTERNAL_LIST_LOOP.
---------------------------------------------------------------
SPACING FIXES
---------------------------------------------------------------
callint.c, hftctl.c, number-gmp.c, process-unix.c: Spacing fixes.
---------------------------------------------------------------
FIX FOR GEOMETRY PROBLEM IN FIRST FRAME
---------------------------------------------------------------
unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by
release 1.5.12 of Cygwin].
toolbar.c: bug fix for problem of initial frame being 77 chars wide on Windows.
will be overridden by my other ws.
---------------------------------------------------------------
FIX FOR LEAKING PROCESS HANDLES:
---------------------------------------------------------------
process-nt.c: Fixes for leaking handles. Inspired by work done by Adrian Aichner
<adrian@xemacs.org>.
---------------------------------------------------------------
FIX FOR CYGWIN BUG (Unicode-related):
---------------------------------------------------------------
unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by
release 1.5.12 of Cygwin].
---------------------------------------------------------------
WARNING FIXES:
---------------------------------------------------------------
console-stream.c: `reinit' is unused.
compiler.h, event-msw.c, frame-msw.c, intl-encap-win32.c, text.h: Add stuff to deal with ANSI-aliasing warnings I got.
regex.c: Gather includes together to avoid warning.
---------------------------------------------------------------
CHANGES TO INITIALIZATION ROUTINES:
---------------------------------------------------------------
buffer.c, emacs.c, console.c, debug.c, device-x.c, device.c, dragdrop.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, font-lock.c, frame-msw.c, glyphs-widget.c, glyphs.c, gui-x.c, insdel.c, lread.c, lstream.c, menubar-gtk.c, menubar-x.c, minibuf.c, mule-wnnfns.c, objects-msw.c, objects.c, print.c, scrollbar-x.c, search.c, select-x.c, text.c, undo.c, unicode.c, window.c, symsinit.h: Call reinit_*() functions directly from emacs.c, for clarity.
Factor out some redundant init code. Move disallowed stuff
that had crept into vars_of_glyphs() into complex_vars_of_glyphs().
Call init_eval_semi_early() from eval.c not in the middle of
vars_of_() in emacs.c since there should be no order dependency
in the latter calls.
---------------------------------------------------------------
ARMAGEDDON:
---------------------------------------------------------------
alloc.c, emacs.c, lisp.h, print.c: Rename inhibit_non_essential_printing_operations to
inhibit_non_essential_conversion_operations.
text.c: Assert on !inhibit_non_essential_conversion_operations.
console-msw.c, print.c: Don't do conversion in SetConsoleTitle or FindWindow to avoid
problems during armageddon. Put #errors for NON_ASCII_INTERNAL_FORMAT
in places where problems would arise.
---------------------------------------------------------------
CHANGES TO THE BUILD PROCEDURE:
---------------------------------------------------------------
config.h.in, s/cxux.h, s/usg5-4-2.h, m/powerpc.h: Add comment about correct ordering of this file.
Rearrange everything to follow this -- put all #undefs together
and before the s&m files. Add undefs for HAVE_ALLOCA, C_ALLOCA,
BROKEN_ALLOCA_IN_FUNCTION_CALLS, STACK_DIRECTION. Remove unused
HAVE_STPCPY, HAVE_GETWD, HAVE_SETLOCALE.
m/gec63.h: Deleted; totally broken, not used at all, not in FSF.
m/7300.h, m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/apollo.h, m/att3b.h, m/aviion.h, m/celerity.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp300bsd.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/isi-ov.h, m/luna88k.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/news.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/orion105.h, m/pfa50.h, m/plexus.h, m/pmax.h, m/powerpc.h, m/pyrmips.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/symmetry.h, m/tad68k.h, m/tahoe.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/vax.h, m/wicat.h, m/xps100.h: Delete C_ALLOCA, HAVE_ALLOCA, STACK_DIRECTION,
BROKEN_ALLOCA_IN_FUNCTION_CALLS. All of this is auto-detected.
When in doubt, I followed recent FSF sources, which also have
these things deleted.
author | ben |
---|---|
date | Thu, 04 Nov 2004 23:08:28 +0000 |
parents | fffe735e63ee |
children | 6fa9919a9a0b |
line wrap: on
line source
/* Definitions for the new event model; created 16-jul-91 by Jamie Zawinski Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 2002 Ben Wing. This file is part of XEmacs. XEmacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XEmacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Synched up with: Not in FSF. */ #ifndef INCLUDED_events_h_ #define INCLUDED_events_h_ #include "systime.h" /* See also (Info-goto-node "(internals)Event Stream Callback Routines") (Info-goto-node "(internals)Stream Pairs") */ /* typedef unsigned int USID; in lisp.h */ #define USID_ERROR ((USID)-1) #define USID_DONTHASH ((USID)0) struct event_stream { int (*event_pending_p) (int); void (*next_event_cb) (Lisp_Event *); void (*handle_magic_event_cb) (Lisp_Event *); void (*format_magic_event_cb) (Lisp_Event *, Lisp_Object pstream); int (*compare_magic_event_cb) (Lisp_Event *, Lisp_Event *); Hashcode (*hash_magic_event_cb)(Lisp_Event *); int (*add_timeout_cb) (EMACS_TIME); void (*remove_timeout_cb) (int); void (*select_console_cb) (struct console *); void (*unselect_console_cb) (struct console *); void (*select_process_cb) (Lisp_Process *, int doin, int doerr); void (*unselect_process_cb) (Lisp_Process *, int doin, int doerr); void (*drain_queue_cb) (void); void (*force_event_pending_cb)(struct frame* f); void (*create_io_streams_cb) (void* /* inhandle*/, void* /*outhandle*/ , void * /* errhandle*/, Lisp_Object* /* instream */, Lisp_Object* /* outstream */, Lisp_Object* /* errstream */, USID * /* in_usid */, USID * /* err_usid */, int /* flags */); void (*delete_io_streams_cb) (Lisp_Object /* instream */, Lisp_Object /* outstream */, Lisp_Object /* errstream */, USID * /* in_usid */, USID * /* err_usid */); int (*current_event_timestamp_cb) (struct console *); }; /* Flags for create_io_streams_cb() FLAGS parameter */ #define STREAM_PTY_FLUSHING 0x0001 #define STREAM_NETWORK_CONNECTION 0x0002 extern struct event_stream *event_stream; #ifdef EVENT_DATA_AS_OBJECTS #define EVENT_FOO_BAR_1(extractor, field) ((extractor)->field) #define EVENT_FOO_BAR(e, uptype, downtype, field) EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field) #define SET_EVENT_FOO_BAR_1(extractor, field, val) \ do { (extractor)->field = (val); } while (0) #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) SET_EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field, val) #else #define EVENT_FOO_BAR(e, uptype, downtype, field) ((e)->event.downtype.field) #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) \ do { (e)->event.downtype.field = (val); } while (0) #endif typedef enum emacs_event_type { empty_event, key_press_event, button_press_event, button_release_event, pointer_motion_event, process_event, timeout_event, magic_event, magic_eval_event, eval_event, misc_user_event, dead_event } emacs_event_type; #define first_event_type empty_event #define last_event_type dead_event #ifdef MULE enum alternative_key_chars { KEYCHAR_CURRENT_LANGENV, KEYCHAR_DEFAULT_USER, KEYCHAR_DEFAULT_SYSTEM, KEYCHAR_UNDERLYING_VIRTUAL_KEY_CURRENT_LANGENV, KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_USER, KEYCHAR_UNDERLYING_VIRTUAL_KEY_DEFAULT_SYSTEM, KEYCHAR_QWERTY, KEYCHAR_LAST }; #endif /* MULE */ struct Lisp_Key_Data { #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ /* What keysym this is; a character or a symbol. */ Lisp_Object keysym; /* Modifiers held down when key was pressed: control, meta, etc. Also includes buttons. For many keys, Shift is not a bit; that is implicit in the keyboard layout. */ int modifiers; #ifdef MULE /* Alternate character interpretations for this key in different keyboard layouts. This deals with the problem of pressing C-x in the Russian layout (the so-called "Russian C-x problem"), for example: `x' gets mapped to a Cyrillic character, so what do we do? For that matter, what about `C-x b'? What we do is look the key up in the default locales (current language environment, user default, system default), then check to see if the underlying virtual key is alphabetic in the same three defaults, then finally check US ASCII. We ignore the underlying virtual key for the current layout to avoid the problem of a French speaker (AZERTY layout) who temporarily switches to Russian: The virtual keys underlying Russian are US-ASCII, so what the French speaker things of as C-a (the key just to the right of TAB) appears as C-q. (#### We should probably ignore the current char and look *ONLY* in alt_keychars for all control keys. What about the English speaker who temporarily switches to the French layout and finds C-q mapped to C-a?) */ Ichar alt_keychars[KEYCHAR_LAST]; #endif /* MULE */ }; typedef struct Lisp_Key_Data Lisp_Key_Data; #define KEY_DATA_KEYSYM(d) ((d)->keysym) #define KEY_DATA_MODIFIERS(d) ((d)->modifiers) #define SET_KEY_DATA_KEYSYM(d, k) ((d)->keysym = k) #define SET_KEY_DATA_MODIFIERS(d, m) ((d)->modifiers = m) #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (key_data, Lisp_Key_Data); #define XKEY_DATA(x) XRECORD (x, key_data, Lisp_Key_Data) #define wrap_key_data(p) wrap_record (p, key_data) #define KEY_DATAP(x) RECORDP (x, key_data) #define CHECK_KEY_DATA(x) CHECK_RECORD (x, key_data) #define CONCHECK_KEY_DATA(x) CONCHECK_RECORD (x, key_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_KEY_KEYSYM(e) EVENT_FOO_BAR (e, KEY, key, keysym) #define XEVENT_KEY_KEYSYM(e) EVENT_KEY_KEYSYM (XEVENT (e)) #define SET_EVENT_KEY_KEYSYM(e, val) \ SET_EVENT_FOO_BAR (e, KEY, key, keysym, val) #define XSET_EVENT_KEY_KEYSYM(e, val) \ SET_EVENT_KEY_KEYSYM (XEVENT (e), val) #define EVENT_KEY_MODIFIERS(e) EVENT_FOO_BAR (e, KEY, key, modifiers) #define XEVENT_KEY_MODIFIERS(e) EVENT_KEY_MODIFIERS (XEVENT (e)) #define SET_EVENT_KEY_MODIFIERS(e, val) \ SET_EVENT_FOO_BAR (e, KEY, key, modifiers, val) #define XSET_EVENT_KEY_MODIFIERS(e, val) \ SET_EVENT_KEY_MODIFIERS (XEVENT (e), val) #define EVENT_KEY_ALT_KEYCHARS(e, n) \ EVENT_FOO_BAR (e, KEY, key, alt_keychars[n]) #define XEVENT_KEY_ALT_KEYCHARS(e, n) EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n) #define SET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \ SET_EVENT_FOO_BAR (e, KEY, key, alt_keychars[n], val) #define XSET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \ SET_EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n, val) struct Lisp_Button_Data { #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ /* What button went down or up. */ int button; /* Bucky-bits on that button: shift, control, meta, etc. Also includes other buttons (not the one pressed). */ int modifiers; /* Where it was at the button-state-change (in pixels). */ int x, y; }; typedef struct Lisp_Button_Data Lisp_Button_Data; #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (button_data, Lisp_Button_Data); #define XBUTTON_DATA(x) XRECORD (x, button_data, Lisp_Button_Data) #define wrap_button_data(p) wrap_record (p, button_data) #define BUTTON_DATAP(x) RECORDP (x, button_data) #define CHECK_BUTTON_DATA(x) CHECK_RECORD (x, button_data) #define CONCHECK_BUTTON_DATA(x) CONCHECK_RECORD (x, button_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_BUTTON_BUTTON(e) EVENT_FOO_BAR (e, BUTTON, button, button) #define XEVENT_BUTTON_BUTTON(e) EVENT_BUTTON_BUTTON (XEVENT (e)) #define SET_EVENT_BUTTON_BUTTON(e, val) \ SET_EVENT_FOO_BAR (e, BUTTON, button, button, val) #define XSET_EVENT_BUTTON_BUTTON(e, val) \ SET_EVENT_BUTTON_BUTTON (XEVENT (e), val) #define EVENT_BUTTON_MODIFIERS(e) EVENT_FOO_BAR (e, BUTTON, button, modifiers) #define XEVENT_BUTTON_MODIFIERS(e) EVENT_BUTTON_MODIFIERS (XEVENT (e)) #define SET_EVENT_BUTTON_MODIFIERS(e, val) \ SET_EVENT_FOO_BAR (e, BUTTON, button, modifiers, val) #define XSET_EVENT_BUTTON_MODIFIERS(e, val) \ SET_EVENT_BUTTON_MODIFIERS (XEVENT (e), val) #define EVENT_BUTTON_X(e) EVENT_FOO_BAR (e, BUTTON, button, x) #define XEVENT_BUTTON_X(e) EVENT_BUTTON_X (XEVENT (e)) #define SET_EVENT_BUTTON_X(e, val) \ SET_EVENT_FOO_BAR (e, BUTTON, button, x, val) #define XSET_EVENT_BUTTON_X(e, val) \ SET_EVENT_BUTTON_X (XEVENT (e), val) #define EVENT_BUTTON_Y(e) EVENT_FOO_BAR (e, BUTTON, button, y) #define XEVENT_BUTTON_Y(e) EVENT_BUTTON_Y (XEVENT (e)) #define SET_EVENT_BUTTON_Y(e, val) \ SET_EVENT_FOO_BAR (e, BUTTON, button, y, val) #define XSET_EVENT_BUTTON_Y(e, val) \ SET_EVENT_BUTTON_Y (XEVENT (e), val) struct Lisp_Motion_Data { #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ /* Where it was after it moved (in pixels). */ int x, y; /* Bucky-bits down when the motion was detected. */ int modifiers; }; typedef struct Lisp_Motion_Data Lisp_Motion_Data; #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (motion_data, Lisp_Motion_Data); #define XMOTION_DATA(x) XRECORD (x, motion_data, Lisp_Motion_Data) #define wrap_motion_data(p) wrap_record (p, motion_data) #define MOTION_DATAP(x) RECORDP (x, motion_data) #define CHECK_MOTION_DATA(x) CHECK_RECORD (x, motion_data) #define CONCHECK_MOTION_DATA(x) CONCHECK_RECORD (x, motion_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_MOTION_X(e) EVENT_FOO_BAR (e, MOTION, motion, x) #define XEVENT_MOTION_X(e) EVENT_MOTION_X (XEVENT (e)) #define SET_EVENT_MOTION_X(e, val) \ SET_EVENT_FOO_BAR (e, MOTION, motion, x, val) #define XSET_EVENT_MOTION_X(e, val) \ SET_EVENT_MOTION_X (XEVENT (e), val) #define EVENT_MOTION_Y(e) EVENT_FOO_BAR (e, MOTION, motion, y) #define XEVENT_MOTION_Y(e) EVENT_MOTION_Y (XEVENT (e)) #define SET_EVENT_MOTION_Y(e, val) \ SET_EVENT_FOO_BAR (e, MOTION, motion, y, val) #define XSET_EVENT_MOTION_Y(e, val) \ SET_EVENT_MOTION_Y (XEVENT (e), val) #define EVENT_MOTION_MODIFIERS(e) EVENT_FOO_BAR (e, MOTION, motion, modifiers) #define XEVENT_MOTION_MODIFIERS(e) EVENT_MOTION_MODIFIERS (XEVENT (e)) #define SET_EVENT_MOTION_MODIFIERS(e, val) \ SET_EVENT_FOO_BAR (e, MOTION, motion, modifiers, val) #define XSET_EVENT_MOTION_MODIFIERS(e, val) \ SET_EVENT_MOTION_MODIFIERS (XEVENT (e), val) struct Lisp_Process_Data { #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ /* the XEmacs "process" object in question */ Lisp_Object process; }; typedef struct Lisp_Process_Data Lisp_Process_Data; #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (process_data, Lisp_Process_Data); #define XPROCESS_DATA(x) XRECORD (x, process_data, Lisp_Process_Data) #define wrap_process_data(p) wrap_record (p, process_data) #define PROCESS_DATAP(x) RECORDP (x, process_data) #define CHECK_PROCESS_DATA(x) CHECK_RECORD (x, process_data) #define CONCHECK_PROCESS_DATA(x) CONCHECK_RECORD (x, process_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_PROCESS_PROCESS(e) EVENT_FOO_BAR (e, PROCESS, process, process) #define XEVENT_PROCESS_PROCESS(e) EVENT_PROCESS_PROCESS (XEVENT (e)) #define SET_EVENT_PROCESS_PROCESS(e, val) \ SET_EVENT_FOO_BAR (e, PROCESS, process, process, val) #define XSET_EVENT_PROCESS_PROCESS(e, val) \ SET_EVENT_PROCESS_PROCESS (XEVENT (e), val) struct Lisp_Timeout_Data { /* interval_id The ID returned when the associated call to add_timeout_cb() was made ------ the rest of the fields are filled in by XEmacs ----- id_number The XEmacs timeout ID for this timeout (more than one timeout event can have the same value here, since XEmacs timeouts, as opposed to add_timeout_cb() timeouts, can resignal themselves) function An elisp function to call when this timeout is processed. object The object passed to that function. */ #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ int interval_id; int id_number; Lisp_Object function; Lisp_Object object; }; typedef struct Lisp_Timeout_Data Lisp_Timeout_Data; #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (timeout_data, Lisp_Timeout_Data); #define XTIMEOUT_DATA(x) XRECORD (x, timeout_data, Lisp_Timeout_Data) #define wrap_timeout_data(p) wrap_record(p, timeout_data) #define TIMEOUT_DATAP(x) RECORDP (x, timeout_data) #define CHECK_TIMEOUT_DATA(x) CHECK_RECORD (x, timeout_data) #define CONCHECK_TIMEOUT_DATA(x) CONCHECK_RECORD (x, timeout_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_TIMEOUT_INTERVAL_ID(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id) #define XEVENT_TIMEOUT_INTERVAL_ID(e) EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e)) #define SET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \ SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id, val) #define XSET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \ SET_EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e), val) #define EVENT_TIMEOUT_ID_NUMBER(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number) #define XEVENT_TIMEOUT_ID_NUMBER(e) EVENT_TIMEOUT_ID_NUMBER (XEVENT (e)) #define SET_EVENT_TIMEOUT_ID_NUMBER(e, val) \ SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number, val) #define XSET_EVENT_TIMEOUT_ID_NUMBER(e, val) \ SET_EVENT_TIMEOUT_ID_NUMBER (XEVENT (e), val) #define EVENT_TIMEOUT_FUNCTION(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, function) #define XEVENT_TIMEOUT_FUNCTION(e) EVENT_TIMEOUT_FUNCTION (XEVENT (e)) #define SET_EVENT_TIMEOUT_FUNCTION(e, val) \ SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, function, val) #define XSET_EVENT_TIMEOUT_FUNCTION(e, val) \ SET_EVENT_TIMEOUT_FUNCTION (XEVENT (e), val) #define EVENT_TIMEOUT_OBJECT(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, object) #define XEVENT_TIMEOUT_OBJECT(e) EVENT_TIMEOUT_OBJECT (XEVENT (e)) #define SET_EVENT_TIMEOUT_OBJECT(e, val) \ SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, object, val) #define XSET_EVENT_TIMEOUT_OBJECT(e, val) \ SET_EVENT_TIMEOUT_OBJECT (XEVENT (e), val) struct Lisp_Eval_Data { /* This kind of event is used internally; sometimes the window system interface would like to inform XEmacs of some user action (such as focusing on another frame) but needs that to happen synchronously with the other user input, like keypresses. This is useful when events are reported through callbacks rather than in the standard event stream. function An elisp function to call with this event object. object Argument of function. */ #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ Lisp_Object function; Lisp_Object object; }; typedef struct Lisp_Eval_Data Lisp_Eval_Data; #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (eval_data, Lisp_Eval_Data); #define XEVAL_DATA(x) XRECORD (x, eval_data, Lisp_Eval_Data) #define wrap_eval_data(p) wrap_record(p, eval_data) #define EVAL_DATAP(x) RECORDP (x, eval_data) #define CHECK_EVAL_DATA(x) CHECK_RECORD (x, eval_data) #define CONCHECK_EVAL_DATA(x) CONCHECK_RECORD (x, eval_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_EVAL_FUNCTION(e) EVENT_FOO_BAR (e, EVAL, eval, function) #define XEVENT_EVAL_FUNCTION(e) EVENT_EVAL_FUNCTION (XEVENT (e)) #define SET_EVENT_EVAL_FUNCTION(e, val) \ SET_EVENT_FOO_BAR (e, EVAL, eval, function, val) #define XSET_EVENT_EVAL_FUNCTION(e, val) \ SET_EVENT_EVAL_FUNCTION (XEVENT (e), val) #define EVENT_EVAL_OBJECT(e) EVENT_FOO_BAR (e, EVAL, eval, object) #define XEVENT_EVAL_OBJECT(e) EVENT_EVAL_OBJECT (XEVENT (e)) #define SET_EVENT_EVAL_OBJECT(e, val) \ SET_EVENT_FOO_BAR (e, EVAL, eval, object, val) #define XSET_EVENT_EVAL_OBJECT(e, val) \ SET_EVENT_EVAL_OBJECT (XEVENT (e), val) struct Lisp_Misc_User_Data { /* #### The misc-user type is serious junk. It should be separated out into different events. There's no reason to create sub-subtypes of events. function An elisp function to call with this event object. object Argument of function. button What button went down or up. modifiers Bucky-bits on that button: shift, control, meta, etc. x, y Where it was at the button-state-change (in pixels). This is similar to an eval_event, except that it is generated by user actions: selections in the menubar, scrollbar actions, or drag and drop actions. It is a "command" event, like key and mouse presses (and unlike mouse motion, process output, and enter and leave window hooks). In many ways, eval_events are not the same as keypresses or misc_user_events. The button, modifiers, x, and y parts are only used by the XEmacs Drag'n'Drop system. Don't depend on their values for other types of misc_user_events. */ #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ Lisp_Object function; Lisp_Object object; int button; int modifiers; int x, y; }; typedef struct Lisp_Misc_User_Data Lisp_Misc_User_Data; #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (misc_user_data, Lisp_Misc_User_Data); #define XMISC_USER_DATA(x) XRECORD (x, misc_user_data, Lisp_Misc_User_Data) #define wrap_misc_user_data(p) wrap_record(p, misc_user_data) #define MISC_USER_DATAP(x) RECORDP (x, misc_user_data) #define CHECK_MISC_USER_DATA(x) CHECK_RECORD (x, misc_user_data) #define CONCHECK_MISC_USER_DATA(x) CONCHECK_RECORD (x, misc_user_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_MISC_USER_FUNCTION(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, function) #define XEVENT_MISC_USER_FUNCTION(e) EVENT_MISC_USER_FUNCTION (XEVENT (e)) #define SET_EVENT_MISC_USER_FUNCTION(e, val) \ SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, function, val) #define XSET_EVENT_MISC_USER_FUNCTION(e, val) \ SET_EVENT_MISC_USER_FUNCTION (XEVENT (e), val) #define EVENT_MISC_USER_OBJECT(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, object) #define XEVENT_MISC_USER_OBJECT(e) EVENT_MISC_USER_OBJECT (XEVENT (e)) #define SET_EVENT_MISC_USER_OBJECT(e, val) \ SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, object, val) #define XSET_EVENT_MISC_USER_OBJECT(e, val) \ SET_EVENT_MISC_USER_OBJECT (XEVENT (e), val) #define EVENT_MISC_USER_BUTTON(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, button) #define XEVENT_MISC_USER_BUTTON(e) EVENT_MISC_USER_BUTTON (XEVENT (e)) #define SET_EVENT_MISC_USER_BUTTON(e, val) \ SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, button, val) #define XSET_EVENT_MISC_USER_BUTTON(e, val) \ SET_EVENT_MISC_USER_BUTTON (XEVENT (e), val) #define EVENT_MISC_USER_MODIFIERS(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers) #define XEVENT_MISC_USER_MODIFIERS(e) EVENT_MISC_USER_MODIFIERS (XEVENT (e)) #define SET_EVENT_MISC_USER_MODIFIERS(e, val) \ SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers, val) #define XSET_EVENT_MISC_USER_MODIFIERS(e, val) \ SET_EVENT_MISC_USER_MODIFIERS (XEVENT (e), val) #define EVENT_MISC_USER_X(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, x) #define XEVENT_MISC_USER_X(e) EVENT_MISC_USER_X (XEVENT (e)) #define SET_EVENT_MISC_USER_X(e, val) \ SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, x, val) #define XSET_EVENT_MISC_USER_X(e, val) \ SET_EVENT_MISC_USER_X (XEVENT (e), val) #define EVENT_MISC_USER_Y(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, y) #define XEVENT_MISC_USER_Y(e) EVENT_MISC_USER_Y (XEVENT (e)) #define SET_EVENT_MISC_USER_Y(e, val) \ SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, y, val) #define XSET_EVENT_MISC_USER_Y(e, val) \ SET_EVENT_MISC_USER_Y (XEVENT (e), val) struct Lisp_Magic_Eval_Data { /* This is like an eval event but its contents are not Lisp-accessible. This allows for "internal eval events" that call non-Lisp-accessible functions. Externally, a magic_eval_event just appears as a magic_event; the Lisp programmer need not know anything more. internal_function An unexported function to call with this event object. This allows eval events to call internal functions. For a normal eval event, this field will always be 0. object Argument of function. */ #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ void (*internal_function) (Lisp_Object); Lisp_Object object; }; typedef struct Lisp_Magic_Eval_Data Lisp_Magic_Eval_Data; #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (magic_eval_data, Lisp_Magic_Eval_Data); #define XMAGIC_EVAL_DATA(x) XRECORD (x, magic_eval_data, Lisp_Magic_Eval_Data) #define wrap_magic_eval_data(p) wrap_record(p, magic_eval_data) #define MAGIC_EVAL_DATAP(x) RECORDP (x, magic_eval_data) #define CHECK_MAGIC_EVAL_DATA(x) CHECK_RECORD (x, magic_eval_data) #define CONCHECK_MAGIC_EVAL_DATA(x) CONCHECK_RECORD (x, magic_eval_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function) #define XEVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e)) #define SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \ SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function, val) #define XSET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \ SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e), val) #define EVENT_MAGIC_EVAL_OBJECT(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object) #define XEVENT_MAGIC_EVAL_OBJECT(e) EVENT_MAGIC_EVAL_OBJECT (XEVENT (e)) #define SET_EVENT_MAGIC_EVAL_OBJECT(e, val) \ SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object, val) #define XSET_EVENT_MAGIC_EVAL_OBJECT(e, val) \ SET_EVENT_MAGIC_EVAL_OBJECT (XEVENT (e), val) #if defined (HAVE_X_WINDOWS) && defined(emacs) # include <X11/Xlib.h> #endif #ifdef HAVE_GTK #include <gdk/gdk.h> #endif struct Lisp_Magic_Data { /* No user-serviceable parts within. This is for things like KeymapNotify and ExposeRegion events and so on that XEmacs itself doesn't care about, but which it must do something with for proper interaction with the window system. Magic_events are handled somewhat asynchronously, just like subprocess filters. However, occasionally a magic_event needs to be handled synchronously; in that case, the asynchronous handling of the magic_event will push an eval_event back onto the queue, which will be handled synchronously later. This is one of the reasons why eval_events exist; I'm not entirely happy with this aspect of this event model. */ #ifdef EVENT_DATA_AS_OBJECTS struct lrecord_header lheader; #endif /* EVENT_DATA_AS_OBJECTS */ union { #ifdef HAVE_GTK GdkEvent gdk_event; #endif #ifdef HAVE_X_WINDOWS XEvent x_event; #endif #ifdef HAVE_MS_WINDOWS int mswindows_event; #endif } underlying; }; typedef struct Lisp_Magic_Data Lisp_Magic_Data; #ifdef EVENT_DATA_AS_OBJECTS DECLARE_LRECORD (magic_data, Lisp_Magic_Data); #define XMAGIC_DATA(x) XRECORD (x, magic_data, Lisp_Magic_Data) #define wrap_magic_data(p) wrap_record(p, magic_data) #define MAGIC_DATAP(x) RECORDP (x, magic_data) #define CHECK_MAGIC_DATA(x) CHECK_RECORD (x, magic_data) #define CONCHECK_MAGIC_DATA(x) CONCHECK_RECORD (x, magic_data) #endif /* EVENT_DATA_AS_OBJECTS */ #define EVENT_MAGIC_UNDERLYING(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying) #define XEVENT_MAGIC_UNDERLYING(e) EVENT_MAGIC_UNDERLYING (XEVENT (e)) #define SET_EVENT_MAGIC_UNDERLYING(e, val) \ SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying, val) #define XSET_EVENT_MAGIC_UNDERLYING(e, val) \ SET_EVENT_MAGIC_UNDERLYING (XEVENT (e), val) #ifdef HAVE_GTK #define EVENT_MAGIC_GDK_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event) #define XEVENT_MAGIC_GDK_EVENT(e) EVENT_MAGIC_GDK_EVENT (XEVENT (e)) #define SET_EVENT_MAGIC_GDK_EVENT(e, val) \ SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event, val) #define XSET_EVENT_MAGIC_GDK_EVENT(e, val) \ SET_EVENT_MAGIC_GDK_EVENT (XEVENT (e), val) #endif #ifdef HAVE_X_WINDOWS #define EVENT_MAGIC_X_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event) #define XEVENT_MAGIC_X_EVENT(e) EVENT_MAGIC_X_EVENT (XEVENT (e)) #define SET_EVENT_MAGIC_X_EVENT(e, val) \ SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event, val) #define XSET_EVENT_MAGIC_X_EVENT(e, val) \ SET_EVENT_MAGIC_X_EVENT (XEVENT (e), val) #endif #ifdef HAVE_MS_WINDOWS #define EVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event) #define XEVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e)) #define SET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \ SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event, val) #define XSET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \ SET_EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e), val) #endif struct Lisp_Timeout { struct lcrecord_header header; int id; /* Id we use to identify the timeout over its lifetime */ int interval_id; /* Id for this particular interval; this may be different each time the timeout is signalled.*/ Lisp_Object function, object; /* Function and object associated with timeout. */ EMACS_TIME next_signal_time; /* Absolute time when the timeout is next going to be signalled. */ unsigned int resignal_msecs; /* How far after the next timeout should the one after that occur? */ }; typedef struct Lisp_Timeout Lisp_Timeout; DECLARE_LRECORD (timeout, Lisp_Timeout); #define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout) #define wrap_timeout(p) wrap_record (p, timeout) #define TIMEOUTP(x) RECORDP (x, timeout) #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout) #define CONCHECK_TIMEOUT(x) CONCHECK_RECORD (x, timeout) struct Lisp_Event { /* header->next (aka XEVENT_NEXT ()) is used as follows: - For dead events, this is the next dead one. - For events on the command_event_queue, the next one on the queue. - Likewise for events chained in the command builder. - Otherwise it's Qnil. */ struct lrecord_header lheader; Lisp_Object next; emacs_event_type event_type; /* Where this event occurred on. This will be a frame, device, console, or nil, depending on the event type. It is important that an object of a more specific type than is actually generated is not substituted -- e.g. there should not be a frame inserted when a key-press event occurs, because events on dead channels are automatically ignored. Specifically: -- for button and mouse-motion events, channel will be a frame. (The translation to a window occurs later.) -- for keyboard events, channel will be a console. Note that fake keyboard events (generated by `character-to-event' or something that calls this, such as macros) need to have the selected console stored into them when the event is created. This is so that the correct console-local variables (e.g. the command builder) will get affected. -- for timer, process, magic-eval, and eval events, channel will be nil. -- for misc-user events, channel will be a frame. -- for magic events, channel will be a frame (usually) or a device. */ Lisp_Object channel; /* When this event occurred -- if not known, this is made up. #### All timestamps should be measured as milliseconds since XEmacs started. Currently they are raw server timestamps. (The X protocol doesn't provide any easy way of translating between server time and real process time; yuck.) */ unsigned int timestamp; #ifdef EVENT_DATA_AS_OBJECTS Lisp_Object event_data; #else /* not EVENT_DATA_AS_OBJECTS */ union { Lisp_Key_Data key; Lisp_Button_Data button; Lisp_Motion_Data motion; Lisp_Process_Data process; Lisp_Timeout_Data timeout; Lisp_Eval_Data eval; /* misc_user_event no longer uses this */ Lisp_Misc_User_Data misc_user;/* because it needs position information */ Lisp_Magic_Data magic; Lisp_Magic_Eval_Data magic_eval; } event; #endif /* not EVENT_DATA_AS_OBJECTS */ }; DECLARE_LRECORD (event, Lisp_Event); #define XEVENT(x) XRECORD (x, event, Lisp_Event) #define wrap_event(p) wrap_record (p, event) #define EVENTP(x) RECORDP (x, event) #define CHECK_EVENT(x) CHECK_RECORD (x, event) #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event) DECLARE_LRECORD (command_builder, struct command_builder); #define EVENT_CHANNEL(a) ((a)->channel) #define XEVENT_CHANNEL(ev) (XEVENT (ev)->channel) #define EVENT_TYPE(a) ((a)->event_type) #define XEVENT_TYPE(a) (XEVENT (a)->event_type) #define EVENT_NEXT(a) ((a)->next) #define XEVENT_NEXT(e) (XEVENT (e)->next) #define EVENT_TIMESTAMP(ev) ((ev)->timestamp) #define XEVENT_TIMESTAMP(ev) EVENT_TIMESTAMP (XEVENT (ev)) #ifdef EVENT_DATA_AS_OBJECTS #define XEVENT_DATA(ev) (XEVENT (ev)->event_data) #define EVENT_DATA(ev) ((ev)->event_data) #define SET_EVENT_DATA(ev, d) \ do { \ Lisp_Event *mac_event = (ev); \ mac_event->event_data = (d); \ } while (0) #define XSET_EVENT_DATA(ev, d) SET_EVENT_DATA (XEVENT (ev), d) #endif /* EVENT_DATA_AS_OBJECTS */ #define SET_EVENT_TIMESTAMP_ZERO(ev) ((ev)->timestamp = 0) #define SET_EVENT_TIMESTAMP(ev, t) ((ev)->timestamp = (t)) #define XSET_EVENT_TIMESTAMP(ev, t) SET_EVENT_TIMESTAMP (XEVENT (ev), t) #define SET_EVENT_CHANNEL(ev, c) \ do { \ Lisp_Event *mac_event = (ev); \ mac_event->channel = (c); \ } while (0) #define XSET_EVENT_CHANNEL(ev, c) SET_EVENT_CHANNEL (XEVENT (ev), c) DECLARE_INLINE_HEADER ( void set_event_type (struct Lisp_Event *event, emacs_event_type t) ) { #ifdef EVENT_DATA_AS_OBJECTS switch (EVENT_TYPE (event)) { case key_press_event: free_key_data (event->event_data); break; case button_press_event: case button_release_event: free_button_data (event->event_data); break; case pointer_motion_event: free_motion_data (event->event_data); break; case process_event: free_process_data (event->event_data); break; case timeout_event: free_timeout_data (event->event_data); break; case magic_event: free_magic_data (event->event_data); break; case magic_eval_event: free_magic_eval_data (event->event_data); break; case eval_event: free_eval_data (event->event_data); break; case misc_user_event: free_misc_user_data (event->event_data); break; default: break; } #endif /* EVENT_DATA_AS_OBJECTS */ event->event_type = t; #ifdef EVENT_DATA_AS_OBJECTS switch (t) { case key_press_event: event->event_data = make_key_data (); break; case button_press_event: case button_release_event: event->event_data = make_button_data (); break; case pointer_motion_event: event->event_data = make_motion_data (); break; case process_event: event->event_data = make_process_data (); break; case timeout_event: event->event_data = make_timeout_data (); break; case magic_event: event->event_data = make_magic_data (); break; case magic_eval_event: event->event_data = make_magic_eval_data (); break; case eval_event: event->event_data = make_eval_data (); break; case misc_user_event: event->event_data = make_misc_user_data (); break; default: event->event_data = Qnil; break; } #endif /* EVENT_DATA_AS_OBJECTS */ } #define SET_EVENT_NEXT(ev, n) do { (ev)->next = (n); } while (0) #define XSET_EVENT_NEXT(ev, n) SET_EVENT_NEXT (XEVENT (ev), n) #define XSET_EVENT_TYPE(ev, t) set_event_type (XEVENT (ev), t) #define SET_EVENT_TYPE(ev, t) set_event_type (ev, t) #define EVENT_CHAIN_LOOP(event, chain) \ for (event = chain; !NILP (event); event = XEVENT_NEXT (event)) #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event) #define CHECK_LIVE_EVENT(x) do { \ CHECK_EVENT (x); \ if (! EVENT_LIVE_P (XEVENT (x))) \ dead_wrong_type_argument (Qevent_live_p, (x)); \ } while (0) #define CONCHECK_LIVE_EVENT(x) do { \ CONCHECK_EVENT (x); \ if (! EVENT_LIVE_P (XEVENT (x))) \ x = wrong_type_argument (Qevent_live_p, (x)); \ } while (0) EXFUN (Fcharacter_to_event, 4); EXFUN (Fdeallocate_event, 1); EXFUN (Fevent_glyph_extent, 1); EXFUN (Fevent_modeline_position, 1); EXFUN (Fevent_over_modeline_p, 1); EXFUN (Fevent_over_toolbar_p, 1); EXFUN (Fevent_over_vertical_divider_p, 1); EXFUN (Fevent_point, 1); EXFUN (Fevent_window, 1); EXFUN (Fmake_event, 2); EXFUN (Fnext_command_event, 2); extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn; extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property; extern Lisp_Object Qcancel_mode_internal; extern Lisp_Object Vmodifier_keys_sticky_time; /* The modifiers XEmacs knows about; these appear in key and button events. */ #define XEMACS_MOD_CONTROL (1<<0) #define XEMACS_MOD_META (1<<1) #define XEMACS_MOD_SUPER (1<<2) #define XEMACS_MOD_HYPER (1<<3) #define XEMACS_MOD_ALT (1<<4) #define XEMACS_MOD_SHIFT (1<<5) /* not used for dual-case characters */ #define XEMACS_MOD_BUTTON1 (1<<6) #define XEMACS_MOD_BUTTON2 (1<<7) #define XEMACS_MOD_BUTTON3 (1<<8) #define XEMACS_MOD_BUTTON4 (1<<9) #define XEMACS_MOD_BUTTON5 (1<<10) /* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key if there are both Alt and Meta keys. If there are no Meta keys, then Alt generates XEMACS_MOD_META instead. */ /* Maybe this should be trickier */ #define KEYSYM(x) (intern (x)) /* from events.c */ void format_event_object (Eistring *buf, Lisp_Object event, int brief); /*void format_event_data_object (Eistring *buf, Lisp_Object data, int brief);*/ void character_to_event (Ichar c, Lisp_Event *event, struct console *con, int use_console_meta_flag, int do_backspace_mapping); void zero_event (Lisp_Event *e); #define MECR_DEALLOCATE_EVENT 1 void deallocate_event_chain (Lisp_Object event); Lisp_Object event_chain_tail (Lisp_Object event); void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, Lisp_Object *tail); int map_event_chain_remove (int (*fn) (Lisp_Object ev, void *user_data), Lisp_Object *head, Lisp_Object *tail, void *user_data, int flags); int event_chain_count (Lisp_Object event_chain); Lisp_Object event_chain_find_previous (Lisp_Object event_chain, Lisp_Object event); Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); Lisp_Object copy_event_chain (Lisp_Object event_chain); Lisp_Object transfer_event_chain_pointer (Lisp_Object pointer, Lisp_Object old_chain, Lisp_Object new_chain); void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event); Lisp_Object key_sequence_to_event_chain (Lisp_Object seq); /* True if this is a non-internal event (keyboard press, menu, scrollbar, mouse button) */ int command_event_p (Lisp_Object event); void define_self_inserting_symbol (Lisp_Object, Lisp_Object); Ichar event_to_character (Lisp_Object, int, int, int); struct console *event_console_or_selected (Lisp_Object event); void upshift_event (Lisp_Object event); void downshift_event (Lisp_Object event); int event_upshifted_p (Lisp_Object event); /* from event-stream.c */ extern Lisp_Object dispatch_event_queue; Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf); void enqueue_dispatch_event (Lisp_Object event); Lisp_Object dequeue_dispatch_event (void); void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); void event_stream_handle_magic_event (Lisp_Event *event); void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream); int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2); Hashcode event_stream_hash_magic_event (Lisp_Event *e); void event_stream_select_console (struct console *con); void event_stream_unselect_console (struct console *con); void event_stream_select_process (Lisp_Process *proc, int doin, int doerr); void event_stream_unselect_process (Lisp_Process *proc, int doin, int doerr); void event_stream_create_io_streams (void* inhandle, void* outhandle, void *errhandle, Lisp_Object* instream, Lisp_Object* outstream, Lisp_Object* errstream, USID* in_usid, USID* err_usid, int flags); void event_stream_delete_io_streams (Lisp_Object instream, Lisp_Object outstream, Lisp_Object errstream, USID* in_usid, USID* err_usid); Lisp_Object event_stream_protect_modal_loop (const char *error_string, Lisp_Object (*bfun) (void *barg), void *barg, int flags); void event_stream_drain_queue (void); void event_stream_quit_p (void); void run_pre_idle_hook (void); struct low_level_timeout { int id; EMACS_TIME time; struct low_level_timeout *next; }; int add_low_level_timeout (struct low_level_timeout **timeout_list, EMACS_TIME thyme); void remove_low_level_timeout (struct low_level_timeout **timeout_list, int id); int get_low_level_timeout_interval (struct low_level_timeout * timeout_list, EMACS_TIME *interval); int pop_low_level_timeout (struct low_level_timeout **timeout_list, EMACS_TIME *time_out); int event_stream_generate_wakeup (unsigned int milliseconds, unsigned int vanilliseconds, Lisp_Object function, Lisp_Object object, int async_p); int event_stream_resignal_wakeup (int interval_id, int async_p, Lisp_Object *function, Lisp_Object *object); void event_stream_disable_wakeup (int id, int async_p); /* from signal.c */ int signal_add_async_interval_timeout (EMACS_TIME thyme); void signal_remove_async_interval_timeout (int id); /* from event-stream.c -- focus sanity */ extern int focus_follows_mouse; void investigate_frame_change (void); void emacs_handle_focus_change_preliminary (Lisp_Object frame_inp_and_dev); void emacs_handle_focus_change_final (Lisp_Object frame_inp_and_dev); Lisp_Object extract_this_command_keys_nth_mouse_event (int n); Lisp_Object extract_vector_nth_mouse_event (Lisp_Object vector, int n); void single_console_state (void); void any_console_state (void); int in_single_console_state (void); extern int emacs_is_blocking; extern int in_modal_loop; extern volatile int sigint_happened; #ifdef HAVE_UNIXOID_EVENT_LOOP /* from event-unixoid.c */ /* Ceci n'est pas un pipe. */ extern int signal_event_pipe[]; void signal_fake_event (void); void drain_signal_event_pipe (void); void drain_tty_devices (void); extern int fake_event_occurred; int event_stream_unixoid_select_console (struct console *con); int event_stream_unixoid_unselect_console (struct console *con); void event_stream_unixoid_select_process (Lisp_Process *proc, int doin, int doerr, int *infd, int *errfd); void event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin, int doerr, int *infd, int *errfd); struct console *find_tty_or_stream_console_from_fd (int fd); int read_event_from_tty_or_stream_desc (Lisp_Event *event, struct console *con); void event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle, void *errhandle, Lisp_Object* instream, Lisp_Object* outstream, Lisp_Object* errstream, USID* in_usid, USID* err_usid, int flags); void event_stream_unixoid_delete_io_streams (Lisp_Object instream, Lisp_Object outstream, Lisp_Object errstream, USID* in_usid, USID* err_usid); #endif /* HAVE_UNIXOID_EVENT_LOOP */ /* The following is not inside of HAVE_UNIXOID_EVENT_LOOP because of the possibility of combiling XEmacs with no-MSW, no-X, no-TTY -- process-unix.c is still compiled. #### Should we still compile subprocesses with no event loops? */ /* Beware: this evil macro evaluates its arg many times */ #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd))) /* Define this if you want the tty event stream to be used when the first console is tty, even if HAVE_X_WINDOWS is defined */ /* #define DEBUG_TTY_EVENT_STREAM */ /* #### a hack, until accelerator shit is cleaned up */ /* This structure is what we use to encapsulate the state of a command sequence being composed; key events are executed by adding themselves to the command builder; if the command builder is then complete (does not still represent a prefix key sequence) it executes the corresponding command. */ struct command_builder { struct lcrecord_header header; Lisp_Object console; /* back pointer to the console this command builder is for */ #if 0 /* #### Not implemented: nil, or an event representing the first event read after the last command completed. Threaded. */ Lisp_Object prefix_events; #endif /* 0 */ /* nil, or an event chain representing the events in the current keymap-lookup sequence. NOTE: All events in the chain MUST be freshly allocated, with no pointers to them elsewhere. */ Lisp_Object current_events; /* Last elt of current_events */ Lisp_Object most_current_event; /* Last elt before function map code took over. What this means is: All prefixes up to (but not including) this event have non-nil bindings, but the prefix including this event has a nil binding. Any events in the chain after this one were read solely because we're part of a possible function key. If we end up with something that's not part of a possible function key, we have to unread all of those events. */ Lisp_Object last_non_munged_event; /* One value for function-key-map, one for key-translation-map: First event that can begin a possible function key sequence (to be translated according to function-key-map). Normally this is the first event in the chain. However, once we've translated a sequence through function-key-map, this will point to the first event after the translated sequence: we don't ever want to translate any events twice through function-key-map, or things could get really screwed up (e.g. if the user created a translation loop). If this is nil, then the next-read event is the first that can begin a function key sequence. */ Lisp_Object first_mungeable_event[2]; Ibyte *echo_buf; Bytecount echo_buf_length; /* size of echo_buf */ Bytecount echo_buf_index; /* index into echo_buf * -1 before doing echoing for new cmd */ /* Self-insert-command is magic in that it doesn't always push an undo- boundary: up to 20 consecutive self-inserts can happen before an undo- boundary is pushed. This variable is that counter. */ int self_insert_countdown; }; #endif /* INCLUDED_events_h_ */