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