Mercurial > hg > xemacs-beta
diff src/events.c @ 1204:e22b0213b713
[xemacs-hg @ 2003-01-12 11:07:58 by michaels]
modules/ChangeLog:
2002-12-16 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c:
remove ifdef USE_KKCC.
src/ChangeLog:
2003-01-08 Mike Sperber <mike@xemacs.org>
* console.h (CDFW_CONSOLE): Don't lead to a crash if we're dealing
with a dead window/frame/device/console.
2002-12-20 Mike Sperber <mike@xemacs.org>
* ui-gtk.c: Fix typo from Ben's patch: emacs_ffi_data is a
typedef, not a struct. emacs_gtk_object_data is a typedef, not a
struct.
* gtk-glue.c (gdk_event_to_emacs_event): Fix typos from Ben's
patch: le -> emacs_event + rearrange the code.
* event-gtk.c (gtk_event_to_emacs_event): Fix typos from Ben's
patch: ..._UNDERLYING_GDK_EVENT -> ..._GDK_EVENT, ev -> key_event.
* device-gtk.c: Fix typo from Ben's patch: x_keysym_map_hash_table
-> x_keysym_map_hashtable.
2002-12-19 Mike Sperber <mike@xemacs.org>
* menubar-x.c (set_frame_menubar): Initialize protect_me field of
popup_data.
2002-12-16 Ben Wing <ben@xemacs.org>
Major cleanup of KKCC, etc.
KKCC, pdump-related:
-- descriptions are written for all objects. this required some
changes in the format of some objects, e.g. extents, popup-data,
coding system, lstream, lcrecord-list.
-- KKCC now handles weakness in markers, hash tables, elsewhere
correctly (formerly, you'd eventually get a stack overflow due
to endlessly expanding markers).
-- textual changes: lrecord_description -> memory_description,
struct_description -> sized_memory_description.
-- extensive comment describing descriptions and pdump.
-- redo XD_UNION so it works inline and change its format to provide
sufficient info for pdump. implement XD_UNION in pdump. also add
XD_UNION_DYNAMIC_SIZE, which works like XD_UNION except for when
auto-computing structure sizes.
-- add support for XD_INDIRECT in description offsets (used by
extents).
-- add support for "description maps", allowing for indirect
descriptions that are retrieved from an object at run-time. this
generalizes XD_CODING_SYSTEM_END, XD_SPECIFIER_END, etc., which
have now been eliminated.
-- add a fifth field "flags" to memory_description, to support flags
that can be specified for this particular line. Currently defined
flags are XD_FLAG_NO_KKCC (KKCC should ignore this entry; useful
for the weakness above in markers, etc.), XD_FLAG_NO_PDUMP (pdump
should ignore this entry), XD_FLAG_UNION_DEFAULT_ENTRY (in
union maps, this specifies a "default" entry for all remaining
values), and XD_FLAG_FREE_LISP_OBJECT (for use with lcrecord-lists).
-- clean up the kkcc-itis in events, so that the differences
between event data as separate objects and as a union are now
minimized to a small number of places. with the new XD_UNION, we
no longer need event data as separate objects, so this code is no
longer ifdef USE_KKCC, but instead ifdef EVENT_DATA_AS_OBJECTS,
not used by default. make sure that we explicitly free the
separate event data objects when no longer in use, to maintain the
invariant the event processing causes no consing.
-- also remove other USE_KKCC ifdefs when not necessary.
-- allow for KKCC compilation under MS Windows.
-- fix README.kkcc.
-- dump_add_root_object -> dump_add_root_lisp_object.
-- implement dump_add_root_block and use this to handle
dump_add_opaque.
-- factor out some code duplicated in kkcc and pdump.
Other allocation/object-related:
-- change various *slots.h so MARKED_SLOT() call no longer
includes semicolon.
-- free_marker() takes a Lisp_Object not a direct pointer.
-- make bit vectors lcrecords, like vectors, and eliminate code
that essentially duplicated the lcrecord handling.
-- additional asserts in FREE_FIXED_TYPE, formerly duplicated in
the various callers of this.
-- all lcrecord allocation functions now zero out the returned
lcrecords. unnecessary calls to zero_lcrecord removed. add long
comment describing these functions.
-- extract out process and coding system slots, like for buffers,
frames, etc.
-- lcrecords now set the type of items sitting on the free list to
lcrecord_type_free.
-- changes to the way that gap arrays are allocated, for kkcc's
benefit -- now, one single memory block with a stretchy array on
the end, instead of a separate block holding the array.
Error-checking-related:
-- now can compile with C++ under MS Windows. clean up compile errors
discovered that way. (a few were real problems)
-- add C++ error-checking code to verify problems with mismatched
GCPRO/UNGCPRO. (there were a few in the kkcc code.) add long
comment about how to catch insufficient GCPRO (yes, it's possible
using C++).
-- add debug_p4(), a simple object printer, when debug_print()
doesn't work.
-- add dp() and db() as short synonyms of debug_print(),
debug_backtrace().
-- `print' tries EXTREMELY hard to avoid core dumping when printing
when crashing or from debug_print(), and tries as hard as it
reasonably can in other situations.
-- Correct the message output upon crashing to be more up-to-date.
Event-related:
-- document event-matches-key-specifier-p better.
-- generalize the dispatch queues formerly duplicated in the
various event implementations. add event methods to drain pending
events. generalize and clean up QUIT handling, removing
event-specific quit processing. allow arbitrary keystrokes, not
just ASCII, to be the QUIT char. among other things, this should
fix some longstanding bugs in X quit handling. long comment
describing the various event queues.
-- implement delaying of XFlush() if there are pending expose events.
SOMEONE PLEASE TRY THIS OUT.
-- Fix `xemacs -batch -l dunnet' under Cygwin. Try to fix under
MS Windows but not quite there yet.
Other:
-- class -> class_ and no more C++ games with this item.
new -> new_ in the lwlib code, so far not elsewhere.
-- use `struct htentry' not `struct hentry' in elhash.c to avoid
debugger confusion with hash.c.
-- new macros ALIST_LOOP_3, ALIST_LOOP_4.
* README.kkcc:
* alloc.c:
* alloc.c (deadbeef_memory):
* alloc.c (allocate_lisp_storage):
* alloc.c (copy_lisp_object):
* alloc.c (ALLOCATE_FIXED_TYPE_1):
* alloc.c (FREE_FIXED_TYPE):
* alloc.c (make_vector_internal):
* alloc.c (make_bit_vector_internal):
* 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 (struct string_chars_block):
* alloc.c (mark_lcrecord_list):
* alloc.c (make_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (alloc_automanaged_lcrecord):
* alloc.c (staticpro_1):
* alloc.c (staticpro):
* alloc.c (lispdesc_indirect_count_1):
* alloc.c (lispdesc_indirect_description_1):
* alloc.c (lispdesc_one_description_line_size):
* alloc.c (lispdesc_structure_size):
* alloc.c (mark_object_maybe_checking_free):
* alloc.c (mark_with_description):
* alloc.c (mark_struct_contents):
* alloc.c (mark_object):
* alloc.c (tick_lcrecord_stats):
* alloc.c (free_cons):
* alloc.c (free_key_data):
* alloc.c (free_button_data):
* alloc.c (free_motion_data):
* alloc.c (free_process_data):
* alloc.c (free_timeout_data):
* alloc.c (free_magic_data):
* alloc.c (free_magic_eval_data):
* alloc.c (free_eval_data):
* alloc.c (free_misc_user_data):
* alloc.c (free_marker):
* alloc.c (compact_string_chars):
* alloc.c (gc_sweep):
* alloc.c (garbage_collect_1):
* alloc.c (Fgarbage_collect):
* alloc.c (common_init_alloc_early):
* alloc.c (init_alloc_early):
* alloc.c (init_alloc_once_early):
* buffer.c:
* buffer.c (mark_buffer):
* buffer.c (MARKED_SLOT):
* buffer.c (cleanup_buffer_undo_lists):
* buffer.c (Fget_file_buffer):
* buffer.h (MARKED_SLOT):
* bufslots.h:
* bytecode.c:
* callint.c:
* casetab.c:
* chartab.c:
* chartab.c (symbol_to_char_table_type):
* cmdloop.c:
* cmdloop.c (Fcommand_loop_1):
* config.h.in (new):
* conslots.h:
* console-gtk-impl.h (struct gtk_frame):
* console-impl.h:
* console-impl.h (struct console):
* console-impl.h (MARKED_SLOT):
* console-impl.h (CONSOLE_QUIT_EVENT):
* console-msw-impl.h (XM_BUMPQUEUE):
* console-msw.c (write_string_to_mswindows_debugging_output):
* console-msw.h:
* console-stream-impl.h:
* console-stream-impl.h (struct stream_console):
* console-stream.c:
* console-stream.c (stream_init_console):
* console-stream.h:
* console-tty.c:
* console-tty.h:
* console-x.h:
* console.c:
* console.c (mark_console):
* console.c (MARKED_SLOT):
* console.c (allocate_console):
* console.c (get_console_variant):
* console.c (create_console):
* console.c (delete_console_internal):
* console.c (Fset_input_mode):
* console.c (Fcurrent_input_mode):
* console.c (common_init_complex_vars_of_console):
* console.h:
* console.h (console_variant):
* console.h (device_metrics):
* data.c:
* data.c (Faref):
* data.c (Faset):
* data.c (decode_weak_list_type):
* database.c:
* debug.c (xemacs_debug_loop):
* debug.c (FROB):
* debug.c (Fadd_debug_class_to_check):
* debug.c (Fdelete_debug_class_to_check):
* debug.c (Fset_debug_classes_to_check):
* debug.c (Fset_debug_class_types_to_check):
* debug.c (Fdebug_types_being_checked):
* debug.h (DASSERT):
* device-gtk.c:
* device-impl.h (struct device):
* device-impl.h (MARKED_SLOT):
* device-msw.c:
* device-x.c:
* device-x.c (x_init_device_class):
* device-x.c (x_comp_visual_info):
* device-x.c (x_try_best_visual_class):
* device-x.c (x_init_device):
* device-x.c (construct_name_list):
* device-x.c (x_get_resource_prefix):
* device-x.c (Fx_get_resource):
* device-x.c (Fx_display_visual_class):
* device.c:
* device.c (MARKED_SLOT):
* device.c (allocate_device):
* device.c (Fmake_device):
* device.c (delete_device_internal):
* device.c (Fset_device_class):
* device.h:
* devslots.h:
* devslots.h (MARKED_SLOT):
* dialog-msw.c:
* dired-msw.c (mswindows_ls_sort_fcn):
* dired-msw.c (mswindows_get_files):
* dired-msw.c (mswindows_format_file):
* doprnt.c (parse_doprnt_spec):
* dumper.c:
* dumper.c (struct):
* dumper.c (dump_add_root_block):
* dumper.c (dump_add_root_struct_ptr):
* dumper.c (dump_add_root_lisp_object):
* dumper.c (pdump_struct_list_elt):
* dumper.c (pdump_get_entry_list):
* dumper.c (pdump_backtrace):
* dumper.c (pdump_bump_depth):
* dumper.c (pdump_register_sub):
* dumper.c (pdump_register_object):
* dumper.c (pdump_register_struct_contents):
* dumper.c (pdump_register_struct):
* dumper.c (pdump_store_new_pointer_offsets):
* dumper.c (pdump_dump_data):
* dumper.c (pdump_reloc_one):
* dumper.c (pdump_allocate_offset):
* dumper.c (pdump_scan_by_alignment):
* dumper.c (pdump_dump_root_blocks):
* dumper.c (pdump_dump_rtables):
* dumper.c (pdump_dump_root_lisp_objects):
* dumper.c (pdump):
* dumper.c (pdump_load_finish):
* dumper.c (pdump_file_get):
* dumper.c (pdump_resource_get):
* dumper.c (pdump_load):
* editfns.c (save_excursion_restore):
* editfns.c (user_login_name):
* editfns.c (save_restriction_restore):
* elhash.c:
* elhash.c (htentry):
* elhash.c (struct Lisp_Hash_Table):
* elhash.c (HTENTRY_CLEAR_P):
* elhash.c (LINEAR_PROBING_LOOP):
* elhash.c (check_hash_table_invariants):
* elhash.c (mark_hash_table):
* elhash.c (hash_table_equal):
* elhash.c (print_hash_table_data):
* elhash.c (free_hentries):
* elhash.c (make_general_lisp_hash_table):
* elhash.c (decode_hash_table_weakness):
* elhash.c (decode_hash_table_test):
* elhash.c (Fcopy_hash_table):
* elhash.c (resize_hash_table):
* elhash.c (pdump_reorganize_hash_table):
* elhash.c (find_htentry):
* elhash.c (Fgethash):
* elhash.c (Fputhash):
* elhash.c (remhash_1):
* elhash.c (Fremhash):
* elhash.c (Fclrhash):
* elhash.c (copy_compress_hentries):
* elhash.c (elisp_maphash_unsafe):
* elhash.c (finish_marking_weak_hash_tables):
* elhash.c (prune_weak_hash_tables):
* elhash.h:
* emacs.c:
* emacs.c (main_1):
* emacs.c (main):
* emacs.c (shut_down_emacs):
* emodules.h (dump_add_root_lisp_object):
* eval.c:
* eval.c (unwind_to_catch):
* eval.c (maybe_signal_error_1):
* eval.c (maybe_signal_continuable_error_1):
* eval.c (maybe_signal_error):
* eval.c (maybe_signal_continuable_error):
* eval.c (maybe_signal_error_2):
* eval.c (maybe_signal_continuable_error_2):
* eval.c (maybe_signal_ferror):
* eval.c (maybe_signal_continuable_ferror):
* eval.c (maybe_signal_ferror_with_frob):
* eval.c (maybe_signal_continuable_ferror_with_frob):
* eval.c (maybe_syntax_error):
* eval.c (maybe_sferror):
* eval.c (maybe_invalid_argument):
* eval.c (maybe_invalid_constant):
* eval.c (maybe_invalid_operation):
* eval.c (maybe_invalid_change):
* eval.c (maybe_invalid_state):
* eval.c (Feval):
* eval.c (call_trapping_problems):
* eval.c (call_with_suspended_errors):
* eval.c (warn_when_safe_lispobj):
* eval.c (warn_when_safe):
* eval.c (vars_of_eval):
* event-Xt.c:
* event-Xt.c (maybe_define_x_key_as_self_inserting_character):
* event-Xt.c (x_to_emacs_keysym):
* event-Xt.c (x_event_to_emacs_event):
* event-Xt.c (emacs_Xt_enqueue_focus_event):
* event-Xt.c (emacs_Xt_format_magic_event):
* event-Xt.c (emacs_Xt_compare_magic_event):
* event-Xt.c (emacs_Xt_hash_magic_event):
* event-Xt.c (emacs_Xt_handle_magic_event):
* event-Xt.c (Xt_timeout_to_emacs_event):
* event-Xt.c (Xt_process_to_emacs_event):
* event-Xt.c (signal_special_Xt_user_event):
* event-Xt.c (emacs_Xt_next_event):
* event-Xt.c (emacs_Xt_event_handler):
* event-Xt.c (emacs_Xt_drain_queue):
* event-Xt.c (emacs_Xt_event_pending_p):
* event-Xt.c (check_if_pending_expose_event):
* event-Xt.c (reinit_vars_of_event_Xt):
* event-Xt.c (vars_of_event_Xt):
* event-gtk.c:
* event-gtk.c (IS_MODIFIER_KEY):
* event-gtk.c (emacs_gtk_format_magic_event):
* event-gtk.c (emacs_gtk_compare_magic_event):
* event-gtk.c (emacs_gtk_hash_magic_event):
* event-gtk.c (emacs_gtk_handle_magic_event):
* event-gtk.c (gtk_to_emacs_keysym):
* event-gtk.c (gtk_timeout_to_emacs_event):
* event-gtk.c (gtk_process_to_emacs_event):
* event-gtk.c (dragndrop_data_received):
* event-gtk.c (signal_special_gtk_user_event):
* event-gtk.c (emacs_gtk_next_event):
* event-gtk.c (gtk_event_to_emacs_event):
* event-gtk.c (generic_event_handler):
* event-gtk.c (emacs_shell_event_handler):
* event-gtk.c (emacs_gtk_drain_queue):
* event-gtk.c (emacs_gtk_event_pending_p):
* event-gtk.c (reinit_vars_of_event_gtk):
* event-gtk.c (vars_of_event_gtk):
* event-msw.c:
* event-msw.c (struct winsock_stream):
* event-msw.c (winsock_reader):
* event-msw.c (winsock_writer):
* event-msw.c (mswindows_enqueue_dispatch_event):
* event-msw.c (mswindows_enqueue_misc_user_event):
* event-msw.c (mswindows_enqueue_magic_event):
* event-msw.c (mswindows_enqueue_process_event):
* event-msw.c (mswindows_enqueue_mouse_button_event):
* event-msw.c (mswindows_enqueue_keypress_event):
* event-msw.c (mswindows_dequeue_dispatch_event):
* event-msw.c (emacs_mswindows_drain_queue):
* event-msw.c (mswindows_need_event_in_modal_loop):
* event-msw.c (mswindows_need_event):
* event-msw.c (mswindows_wm_timer_callback):
* event-msw.c (dde_eval_string):
* event-msw.c (Fdde_alloc_advise_item):
* event-msw.c (mswindows_dde_callback):
* event-msw.c (mswindows_wnd_proc):
* event-msw.c (remove_timeout_mapper):
* event-msw.c (emacs_mswindows_remove_timeout):
* event-msw.c (emacs_mswindows_event_pending_p):
* event-msw.c (emacs_mswindows_format_magic_event):
* event-msw.c (emacs_mswindows_compare_magic_event):
* event-msw.c (emacs_mswindows_hash_magic_event):
* event-msw.c (emacs_mswindows_handle_magic_event):
* event-msw.c (emacs_mswindows_select_console):
* event-msw.c (emacs_mswindows_unselect_console):
* event-msw.c (reinit_vars_of_event_mswindows):
* event-msw.c (vars_of_event_mswindows):
* event-stream.c:
* event-stream.c (mark_command_builder):
* event-stream.c (reset_command_builder_event_chain):
* event-stream.c (allocate_command_builder):
* event-stream.c (copy_command_builder):
* event-stream.c (command_builder_append_event):
* event-stream.c (event_stream_event_pending_p):
* event-stream.c (event_stream_force_event_pending):
* event-stream.c (maybe_read_quit_event):
* event-stream.c (event_stream_drain_queue):
* event-stream.c (remove_quit_p_event):
* event-stream.c (event_stream_quit_p):
* event-stream.c (echo_key_event):
* event-stream.c (maybe_kbd_translate):
* event-stream.c (execute_help_form):
* event-stream.c (event_stream_generate_wakeup):
* event-stream.c (enqueue_dispatch_event):
* event-stream.c (enqueue_magic_eval_event):
* event-stream.c (Fenqueue_eval_event):
* event-stream.c (enqueue_misc_user_event):
* event-stream.c (enqueue_misc_user_event_pos):
* event-stream.c (next_event_internal):
* event-stream.c (Fnext_event):
* event-stream.c (Faccept_process_output):
* event-stream.c (execute_internal_event):
* event-stream.c (munge_keymap_translate):
* event-stream.c (command_builder_find_leaf_no_mule_processing):
* event-stream.c (command_builder_find_leaf):
* event-stream.c (lookup_command_event):
* event-stream.c (is_scrollbar_event):
* event-stream.c (execute_command_event):
* event-stream.c (Fdispatch_event):
* event-stream.c (Fread_key_sequence):
* event-stream.c (dribble_out_event):
* event-stream.c (vars_of_event_stream):
* event-tty.c (tty_timeout_to_emacs_event):
* event-tty.c (emacs_tty_next_event):
* event-tty.c (emacs_tty_drain_queue):
* event-tty.c (reinit_vars_of_event_tty):
* event-unixoid.c:
* event-unixoid.c (find_tty_or_stream_console_from_fd):
* event-unixoid.c (read_event_from_tty_or_stream_desc):
* event-unixoid.c (drain_tty_devices):
* event-unixoid.c (poll_fds_for_input):
* events.c:
* events.c (deinitialize_event):
* events.c (zero_event):
* events.c (mark_event):
* events.c (print_event_1):
* events.c (print_event):
* events.c (event_equal):
* events.c (event_hash):
* events.c (Fmake_event):
* events.c (Fdeallocate_event):
* events.c (Fcopy_event):
* events.c (map_event_chain_remove):
* events.c (character_to_event):
* events.c (event_to_character):
* events.c (Fevent_to_character):
* events.c (format_event_object):
* events.c (upshift_event):
* events.c (downshift_event):
* events.c (event_upshifted_p):
* events.c (Fevent_live_p):
* events.c (Fevent_type):
* events.c (Fevent_timestamp):
* events.c (CHECK_EVENT_TYPE):
* events.c (CHECK_EVENT_TYPE2):
* events.c (CHECK_EVENT_TYPE3):
* events.c (Fevent_key):
* events.c (Fevent_button):
* events.c (Fevent_modifier_bits):
* events.c (event_x_y_pixel_internal):
* events.c (event_pixel_translation):
* events.c (Fevent_process):
* events.c (Fevent_function):
* events.c (Fevent_object):
* events.c (Fevent_properties):
* events.c (syms_of_events):
* events.c (vars_of_events):
* events.h:
* events.h (struct event_stream):
* events.h (struct Lisp_Key_Data):
* events.h (KEY_DATA_KEYSYM):
* events.h (EVENT_KEY_KEYSYM):
* events.h (struct Lisp_Button_Data):
* events.h (EVENT_BUTTON_BUTTON):
* events.h (struct Lisp_Motion_Data):
* events.h (EVENT_MOTION_X):
* events.h (struct Lisp_Process_Data):
* events.h (EVENT_PROCESS_PROCESS):
* events.h (struct Lisp_Timeout_Data):
* events.h (EVENT_TIMEOUT_INTERVAL_ID):
* events.h (struct Lisp_Eval_Data):
* events.h (EVENT_EVAL_FUNCTION):
* events.h (struct Lisp_Misc_User_Data):
* events.h (EVENT_MISC_USER_FUNCTION):
* events.h (struct Lisp_Magic_Eval_Data):
* events.h (EVENT_MAGIC_EVAL_INTERNAL_FUNCTION):
* events.h (struct Lisp_Magic_Data):
* events.h (EVENT_MAGIC_UNDERLYING):
* events.h (EVENT_MAGIC_GDK_EVENT):
* events.h (struct Lisp_Event):
* events.h (XEVENT_CHANNEL):
* events.h (SET_EVENT_TIMESTAMP_ZERO):
* events.h (SET_EVENT_CHANNEL):
* events.h (SET_EVENT_NEXT):
* events.h (XSET_EVENT_TYPE):
* events.h (struct command_builder):
* extents.c:
* extents.c (gap_array_adjust_markers):
* extents.c (gap_array_recompute_derived_values):
* extents.c (gap_array_move_gap):
* extents.c (gap_array_make_gap):
* extents.c (gap_array_insert_els):
* extents.c (gap_array_delete_els):
* extents.c (gap_array_make_marker):
* extents.c (gap_array_delete_marker):
* extents.c (gap_array_move_marker):
* extents.c (make_gap_array):
* extents.c (free_gap_array):
* extents.c (extent_list_num_els):
* extents.c (extent_list_insert):
* extents.c (mark_extent_auxiliary):
* extents.c (allocate_extent_auxiliary):
* extents.c (decode_extent_at_flag):
* extents.c (verify_extent_mapper):
* extents.c (symbol_to_glyph_layout):
* extents.c (syms_of_extents):
* faces.c:
* file-coding.c:
* file-coding.c (struct_detector_category_description =):
* file-coding.c (detector_category_dynarr_description_1):
* file-coding.c (struct_detector_description =):
* file-coding.c (detector_dynarr_description_1):
* file-coding.c (MARKED_SLOT):
* file-coding.c (mark_coding_system):
* file-coding.c (coding_system_extra_description_map):
* file-coding.c (coding_system_description):
* file-coding.c (allocate_coding_system):
* file-coding.c (symbol_to_eol_type):
* file-coding.c (Fcoding_system_aliasee):
* file-coding.c (set_coding_stream_coding_system):
* file-coding.c (struct convert_eol_coding_system):
* file-coding.c (struct undecided_coding_system):
* file-coding.c (undecided_mark_coding_stream):
* file-coding.c (coding_category_symbol_to_id):
* file-coding.c (struct gzip_coding_system):
* file-coding.c (coding_system_type_create):
* file-coding.h:
* file-coding.h (struct Lisp_Coding_System):
* file-coding.h (CODING_SYSTEM_SLOT_DECLARATION):
* file-coding.h (coding_system_variant):
* file-coding.h (struct coding_system_methods):
* file-coding.h (DEFINE_CODING_SYSTEM_TYPE_WITH_DATA):
* file-coding.h (INITIALIZE_CODING_SYSTEM_TYPE_WITH_DATA):
* file-coding.h (struct coding_stream):
* fileio.c (Fsubstitute_in_file_name):
* floatfns.c:
* fns.c:
* fns.c (base64_encode_1):
* frame-gtk.c:
* frame-gtk.c (Fgtk_start_drag_internal):
* frame-impl.h (struct frame):
* frame-impl.h (MARKED_SLOT):
* frame-msw.c:
* frame-x.c:
* frame-x.c (Fcde_start_drag_internal):
* frame-x.c (Foffix_start_drag_internal):
* frame.c:
* frame.c (MARKED_SLOT):
* frame.c (allocate_frame_core):
* frame.c (delete_frame_internal):
* frame.c (Fmouse_position_as_motion_event):
* frameslots.h:
* frameslots.h (MARKED_SLOT_ARRAY):
* free-hook.c:
* glyphs-msw.c (mswindows_widget_instantiate):
* glyphs-x.c:
* glyphs-x.c (convert_EImage_to_XImage):
* glyphs.c:
* glyphs.c (process_image_string_instantiator):
* glyphs.c (mark_image_instance):
* glyphs.c (allocate_image_instance):
* glyphs.c (unmap_subwindow):
* glyphs.c (map_subwindow):
* glyphs.c (syms_of_glyphs):
* glyphs.c (specifier_type_create_image):
* glyphs.h:
* glyphs.h (struct text_image_instance):
* glyphs.h (struct Lisp_Image_Instance):
* gmalloc.c:
* gmalloc.c ("C"):
* gpmevent.c (Freceive_gpm_event):
* gpmevent.c (gpm_next_event_cb):
* gpmevent.c (vars_of_gpmevent):
* gtk-glue.c (gdk_event_to_emacs_event):
* gtk-xemacs.c (gtk_xemacs_class_init):
* gui-msw.c:
* gui-msw.c (mswindows_handle_gui_wm_command):
* gui-msw.c (mswindows_translate_menu_or_dialog_item):
* gui-x.c:
* gui-x.c (mark_popup_data):
* gui-x.c (snarf_widget_value_mapper):
* gui-x.c (gcpro_popup_callbacks):
* gui-x.c (ungcpro_popup_callbacks):
* gui-x.c (free_popup_widget_value_tree):
* gui-x.c (popup_selection_callback):
* gui-x.h:
* gui-x.h (struct popup_data):
* gui.c:
* gui.c (allocate_gui_item):
* gutter.c (decode_gutter_position):
* hash.c (NULL_ENTRY):
* indent.c (vmotion_1):
* indent.c (vmotion_pixels):
* input-method-motif.c (res):
* input-method-xlib.c (IMInstantiateCallback):
* input-method-xlib.c (XIM_init_device):
* input-method-xlib.c (res):
* intl-encap-win32.c:
* intl-encap-win32.c (qxeSHGetDataFromIDList):
* intl-win32.c:
* intl-win32.c (mswindows_multibyte_cp_type):
* intl-win32.c (struct mswindows_multibyte_coding_system):
* keymap.c:
* keymap.c (make_key_description):
* keymap.c (keymap_store):
* keymap.c (get_keyelt):
* keymap.c (keymap_lookup_1):
* keymap.c (define_key_parser):
* keymap.c (key_desc_list_to_event):
* keymap.c (event_matches_key_specifier_p):
* keymap.c (meta_prefix_char_p):
* keymap.c (ensure_meta_prefix_char_keymapp):
* keymap.c (Fdefine_key):
* keymap.c (struct raw_lookup_key_mapper_closure):
* keymap.c (raw_lookup_key):
* keymap.c (raw_lookup_key_mapper):
* keymap.c (lookup_keys):
* keymap.c (lookup_events):
* keymap.c (Flookup_key):
* keymap.c (struct map_keymap_unsorted_closure):
* keymap.c (map_keymap_unsorted_mapper):
* keymap.c (map_keymap_sorted):
* keymap.c (map_keymap_mapper):
* keymap.c (map_keymap):
* keymap.c (accessible_keymaps_mapper_1):
* keymap.c (Faccessible_keymaps):
* keymap.c (Fsingle_key_description):
* keymap.c (raw_keys_to_keys):
* keymap.c (format_raw_keys):
* keymap.c (where_is_recursive_mapper):
* keymap.c (where_is_internal):
* keymap.c (describe_map_mapper_shadow_search):
* keymap.c (keymap_lookup_inherited_mapper):
* keymap.c (describe_map_mapper):
* keymap.h (event_matches_key_specifier_p):
* lisp.h:
* lisp.h (this):
* lisp.h (RETURN_NOT_REACHED):
* lisp.h (struct Lisp_Vector):
* lisp.h (struct Lisp_Bit_Vector):
* lisp.h (UNGCPRO_1):
* lisp.h (NUNGCPRO):
* lisp.h (NNUNGCPRO):
* lisp.h (DECLARE_INLINE_HEADER):
* lrecord.h:
* lrecord.h (struct lrecord_header):
* lrecord.h (struct lcrecord_header):
* lrecord.h (lrecord_type):
* lrecord.h (struct lrecord_implementation):
* lrecord.h (RECORD_DUMPABLE):
* lrecord.h (memory_description_type):
* lrecord.h (data_description_entry_flags):
* lrecord.h (struct memory_description):
* lrecord.h (struct sized_memory_description):
* lrecord.h (XD_INDIRECT):
* lrecord.h (XD_IS_INDIRECT):
* lrecord.h (XD_DYNARR_DESC):
* lrecord.h (DEFINE_BASIC_LRECORD_IMPLEMENTATION):
* lrecord.h (MAKE_LRECORD_IMPLEMENTATION):
* lrecord.h (MAKE_EXTERNAL_LRECORD_IMPLEMENTATION):
* lrecord.h (alloc_lcrecord_type):
* lstream.c:
* lstream.c (Lstream_new):
* lstream.c (lisp_buffer_marker):
* lstream.h:
* lstream.h (lstream_implementation):
* lstream.h (DEFINE_LSTREAM_IMPLEMENTATION):
* lstream.h (DEFINE_LSTREAM_IMPLEMENTATION_WITH_DATA):
* marker.c:
* marker.c (copy_marker_1):
* mem-limits.h:
* menubar-gtk.c:
* menubar-gtk.c (gtk_popup_menu):
* menubar-msw.c:
* menubar-msw.c (mswindows_popup_menu):
* menubar-x.c (make_dummy_xbutton_event):
* menubar-x.c (command_builder_operate_menu_accelerator):
* menubar-x.c (menu_accelerator_safe_compare):
* menubar-x.c (menu_accelerator_safe_mod_compare):
* mule-charset.c:
* mule-charset.c (make_charset):
* mule-charset.c (Fcharset_property):
* mule-coding.c:
* mule-coding.c (ccs_description_1):
* mule-coding.c (ccs_description =):
* mule-coding.c (ccsd_description_1):
* mule-coding.c (ccsd_description =):
* nt.c (getpwnam):
* nt.c (init_mswindows_environment):
* nt.c (get_cached_volume_information):
* nt.c (mswindows_is_executable):
* nt.c (read_unc_volume):
* nt.c (mswindows_access):
* nt.c (mswindows_link):
* nt.c (mswindows_fstat):
* nt.c (mswindows_stat):
* nt.c (mswindows_executable_type):
* nt.c (Fmswindows_short_file_name):
* nt.c (Fmswindows_long_file_name):
* objects-impl.h (struct Lisp_Color_Instance):
* objects-impl.h (struct Lisp_Font_Instance):
* objects-tty.c:
* objects-x.c (allocate_nearest_color):
* objects.c:
* objects.c (Fmake_color_instance):
* objects.c (Fmake_font_instance):
* objects.c (font_instantiate):
* opaque.c:
* opaque.c (make_opaque):
* opaque.c (make_opaque_ptr):
* opaque.c (reinit_opaque_early):
* opaque.c (init_opaque_once_early):
* print.c:
* print.c (printing_badness):
* print.c (printing_major_badness):
* print.c (print_internal):
* print.c (debug_p4):
* print.c (dp):
* print.c (debug_backtrace):
* process-nt.c (nt_create_process):
* process-nt.c (get_internet_address):
* process-unix.c:
* process-unix.c (struct unix_process_data):
* process-unix.c (get_internet_address):
* process-unix.c (unix_alloc_process_data):
* process-unix.c (unix_create_process):
* process-unix.c (try_to_initialize_subtty):
* process-unix.c (unix_kill_child_process):
* process-unix.c (process_type_create_unix):
* process.c:
* process.c (mark_process):
* process.c (MARKED_SLOT):
* process.c (make_process_internal):
* process.c (Fprocess_tty_name):
* process.c (decode_signal):
* process.h:
* procimpl.h:
* procimpl.h (struct process_methods):
* procimpl.h (struct Lisp_Process):
* rangetab.c:
* realpath.c (readlink_and_correct_case):
* redisplay-x.c (x_window_output_end):
* redisplay-x.c (x_redraw_exposed_area):
* redisplay-x.c (x_clear_frame):
* redisplay.c:
* redisplay.h:
* redisplay.h (struct rune_dglyph):
* redisplay.h (struct rune):
* scrollbar.c:
* scrollbar.c (create_scrollbar_instance):
* specifier.c:
* specifier.c (specifier_empty_extra_description_1):
* specifier.c (make_specifier_internal):
* specifier.c (decode_locale_type):
* specifier.c (decode_how_to_add_specification):
* specifier.h:
* specifier.h (struct specifier_methods):
* specifier.h (DEFINE_SPECIFIER_TYPE_WITH_DATA):
* specifier.h (INITIALIZE_SPECIFIER_TYPE_WITH_DATA):
* symbols.c:
* symbols.c (Fsetplist):
* symbols.c (default_value):
* symbols.c (decode_magic_handler_type):
* symbols.c (handler_type_from_function_symbol):
* symbols.c (Fdefvaralias):
* symbols.c (init_symbols_once_early):
* symbols.c (reinit_symbols_early):
* symsinit.h:
* sysdep.c (sys_subshell):
* sysdep.c (tty_init_sys_modes_on_device):
* syswindows.h:
* text.c (dfc_convert_to_external_format):
* text.c (dfc_convert_to_internal_format):
* text.c (reinit_eistring_early):
* text.c (init_eistring_once_early):
* text.c (reinit_vars_of_text):
* text.h:
* text.h (INC_IBYTEPTR_FMT):
* text.h (DEC_IBYTEPTR_FMT):
* toolbar.c:
* toolbar.c (decode_toolbar_position):
* tooltalk.c:
* ui-gtk.c:
* unexnt.c:
* unexnt.c (_start):
* unexnt.c (unexec):
* unexnt.c (get_section_info):
* unicode.c:
* unicode.c (vars_of_unicode):
* window.c:
* window.c (allocate_window):
* window.c (new_window_mirror):
* window.c (update_mirror_internal):
* winslots.h:
author | michaels |
---|---|
date | Sun, 12 Jan 2003 11:08:22 +0000 |
parents | bbc2941a94d7 |
children | fd0cbe945410 |
line wrap: on
line diff
--- a/src/events.c Sun Jan 12 11:04:30 2003 +0000 +++ b/src/events.c Sun Jan 12 11:08:22 2003 +0000 @@ -41,10 +41,6 @@ #include "console-tty-impl.h" /* for stuff in character_to_event */ -#ifdef USE_KKCC -#include "console-x.h" -#endif /* USE_KKCC */ - /* Where old events go when they are explicitly deallocated. The event chain here is cut loose before GC, so these will be freed eventually. @@ -73,653 +69,18 @@ Vevent_resource = Qnil; } -#ifdef USE_KKCC /* Make sure we lose quickly if we try to use this event */ static void deinitialize_event (Lisp_Object ev) { Lisp_Event *event = XEVENT (ev); + int i; + for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++) + ((int *) event) [i] = 0xdeadbeef; /* -559038737 base 10 */ + set_lheader_implementation (&event->lheader, &lrecord_event); set_event_type (event, dead_event); SET_EVENT_CHANNEL (event, Qnil); - set_lheader_implementation (&event->lheader, &lrecord_event); - XSET_EVENT_NEXT (ev, Qnil); - XSET_EVENT_DATA (ev, Qnil); -} - -/* Set everything to zero or nil so that it's predictable. */ -void -zero_event (Lisp_Event *e) -{ - SET_EVENT_DATA (e, Qnil); - set_event_type (e, empty_event); - SET_EVENT_NEXT (e, Qnil); - SET_EVENT_CHANNEL (e, Qnil); - SET_EVENT_TIMESTAMP_ZERO (e); -} - -static const struct lrecord_description event_description [] = { - { XD_LISP_OBJECT, offsetof (struct Lisp_Event, next) }, - { XD_LISP_OBJECT, offsetof (struct Lisp_Event, channel) }, - { XD_LISP_OBJECT, offsetof (struct Lisp_Event, event_data) }, - { XD_END } -}; - -static Lisp_Object -mark_event (Lisp_Object obj) -{ - mark_object (XEVENT_DATA(obj)); - mark_object (XEVENT_CHANNEL(obj)); - return (XEVENT_NEXT(obj)); -} - - -static const struct lrecord_description key_data_description [] = { - { XD_LISP_OBJECT, offsetof (struct Lisp_Key_Data, keysym) }, - { XD_END } -}; - -static Lisp_Object -mark_key_data (Lisp_Object obj) -{ - return (XKEY_DATA_KEYSYM(obj)); -} - - -static const struct lrecord_description button_data_description [] = { - { XD_END } -}; - -static Lisp_Object -mark_button_data (Lisp_Object obj) -{ - return Qnil; -} - - -static const struct lrecord_description motion_data_description [] = { - { XD_END } -}; - -static Lisp_Object -mark_motion_data (Lisp_Object obj) -{ - return Qnil; -} - - -static const struct lrecord_description process_data_description [] = { - { XD_LISP_OBJECT, offsetof (struct Lisp_Process_Data, process) }, - { XD_END } -}; - -static Lisp_Object -mark_process_data (Lisp_Object obj) -{ - return (XPROCESS_DATA_PROCESS(obj)); -} - - -static const struct lrecord_description timeout_data_description [] = { - { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, function) }, - { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, object) }, - { XD_END } -}; - -static Lisp_Object -mark_timeout_data (Lisp_Object obj) -{ - mark_object (XTIMEOUT_DATA_FUNCTION(obj)); - return (XTIMEOUT_DATA_OBJECT(obj)); -} - - -static const struct lrecord_description eval_data_description [] = { - { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, function) }, - { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, object) }, - { XD_END } -}; - -static Lisp_Object -mark_eval_data (Lisp_Object obj) -{ - mark_object (XEVAL_DATA_FUNCTION(obj)); - return (XEVAL_DATA_OBJECT(obj)); -} - - -static const struct lrecord_description misc_user_data_description [] = { - { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, function) }, - { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, object) }, - { XD_END } -}; - -static Lisp_Object -mark_misc_user_data (Lisp_Object obj) -{ - mark_object (XMISC_USER_DATA_FUNCTION(obj)); - return (XMISC_USER_DATA_OBJECT(obj)); -} - - -static const struct lrecord_description magic_eval_data_description [] = { - { XD_LISP_OBJECT, offsetof (struct Lisp_Magic_Eval_Data, object) }, - { XD_END } -}; - -static Lisp_Object -mark_magic_eval_data (Lisp_Object obj) -{ - return (XMAGIC_EVAL_DATA_OBJECT(obj)); -} - - -static const struct lrecord_description magic_data_description [] = { - { XD_END } -}; - -static Lisp_Object -mark_magic_data (Lisp_Object obj) -{ - return Qnil; -} - - - -static void -print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - if (print_readably) - printing_unreadable_object ("#<event>"); - - switch (XEVENT_TYPE (obj)) - { - case key_press_event: - write_c_string (printcharfun, "#<keypress-event "); - break; - case button_press_event: - write_c_string (printcharfun, "#<buttondown-event "); - break; - case button_release_event: - write_c_string (printcharfun, "#<buttonup-event "); - break; - case magic_eval_event: - write_c_string (printcharfun, "#<magic-eval-event "); - break; - case magic_event: - write_c_string (printcharfun, "#<magic-event "); - break; - case pointer_motion_event: - write_c_string (printcharfun, "#<motion-event "); - break; - case process_event: - write_c_string (printcharfun, "#<process-event "); - break; - case timeout_event: - write_c_string (printcharfun, "#<timeout-event "); - break; - case misc_user_event: - write_c_string (printcharfun, "#<misc-user-event "); - break; - case eval_event: - write_c_string (printcharfun, "#<eval-event "); - break; - case empty_event: - write_c_string (printcharfun, "#<empty-event>"); - return; - case dead_event: - write_c_string (printcharfun, "#<DEALLOCATED-EVENT>"); - return; - default: - write_c_string (printcharfun, "#<UNKNOWN-EVENT-TYPE>"); - return; - } - - print_internal (XEVENT_DATA (obj), printcharfun, 1); - write_c_string (printcharfun, ">"); -} - - -static void -print_key_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - char buf[128]; - if (print_readably) - printing_unreadable_object ("#<key_data>"); - - sprintf (buf, "#<key_data "); - /* format_event_data_object (buf + 11, obj, 0); - sprintf (buf + strlen (buf), ">"); - write_c_string (printcharfun, buf);*/ -} - -static void -print_button_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - char buf[128]; - if (print_readably) - printing_unreadable_object ("#<button_data>"); - - sprintf (buf, "#<button_data "); - /* format_event_data_object (buf + 14, obj, 0); - sprintf (buf + strlen (buf), ">"); - write_c_string (printcharfun, buf);*/ -} - - -static void -print_motion_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - char buf[64]; - - if (print_readably) - printing_unreadable_object ("#<motion_data>"); - - sprintf (buf, "#<motion-data %ld, %ld>", - (long) XMOTION_DATA_X (obj), - (long) XMOTION_DATA_Y (obj)); - write_c_string (printcharfun, buf); -} - - -static void -print_process_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - if (print_readably) - printing_unreadable_object ("#<process_data>"); - - write_c_string (printcharfun, "#<process-data "); - print_internal (XPROCESS_DATA_PROCESS (obj), printcharfun, 1); - write_c_string (printcharfun, ">"); -} - - -static void -print_timeout_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - if (print_readably) - printing_unreadable_object ("#<timeout_data>"); - - write_c_string (printcharfun, "#<timeout-data "); - print_internal (XTIMEOUT_DATA_OBJECT (obj), printcharfun, 1); - write_c_string (printcharfun, ">"); -} - - -static void -print_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - if (print_readably) - printing_unreadable_object ("#<eval_data>"); - - write_c_string (printcharfun, "#<eval-data "); - print_internal (XEVAL_DATA_FUNCTION (obj), printcharfun, 1); - write_c_string (printcharfun, " "); - print_internal (XEVAL_DATA_OBJECT (obj), printcharfun, 1); - write_c_string (printcharfun, ">"); -} - - -static void -print_misc_user_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - if (print_readably) - printing_unreadable_object ("#<misc_user_data>"); - - write_c_string (printcharfun, "#<misc-user-data "); - print_internal (XMISC_USER_DATA_FUNCTION (obj), printcharfun, 1); - write_c_string (printcharfun, " "); - print_internal (XMISC_USER_DATA_OBJECT (obj), printcharfun, 1); - write_c_string (printcharfun, ">"); -} - - -static void -print_magic_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - // char buf[128]; - - if (print_readably) - printing_unreadable_object ("#<magic_eval_data>"); - - /* format_event_data_object (buf + 18, obj, 0);*/ -} - - -static void -print_magic_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) -{ - char buf[128]; - - if (print_readably) - printing_unreadable_object ("#<magic_data>"); - - sprintf (buf, "#<magic-data "); - /* format_event_data_object (buf + 13, obj, 0); - sprintf (buf + strlen (buf), ">"); - write_c_string (print_readably, buf);*/ -} - - -static int -event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - Lisp_Event *e1 = XEVENT (obj1); - Lisp_Event *e2 = XEVENT (obj2); - - if (EVENT_TYPE (e1) != EVENT_TYPE (e2)) return 0; - if (!EQ (EVENT_CHANNEL (e1), EVENT_CHANNEL (e2))) return 0; -/* if (EVENT_TIMESTAMP (e1) != EVENT_TIMESTAMP (e2)) return 0; */ - switch (EVENT_TYPE (e1)) - { - default: abort (); - - case process_event: - case timeout_event: - case pointer_motion_event: - case key_press_event: - case button_press_event: - case button_release_event: - case misc_user_event: - case eval_event: - case magic_eval_event: - return internal_equal (EVENT_DATA (e1), EVENT_DATA (e2), 0); - - case magic_event: - { - struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1))); - -#ifdef HAVE_X_WINDOWS - if (CONSOLE_X_P (con)) - return (XMAGIC_DATA_X_EVENT (EVENT_DATA (e1)).xany.serial == - XMAGIC_DATA_X_EVENT (EVENT_DATA (e2)).xany.serial); -#endif -#ifdef HAVE_GTK - if (CONSOLE_GTK_P (con)) - return (XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e1)) == - XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e2))); -#endif -#ifdef HAVE_MS_WINDOWS - if (CONSOLE_MSWINDOWS_P (con)) - return (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e1)) == - XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e2))); -#endif - abort (); - return 1; /* not reached */ - } - - case empty_event: /* Empty and deallocated events are equal. */ - case dead_event: - return 1; - } -} - -static int -key_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - return (EQ (XKEY_DATA_KEYSYM (obj1), XKEY_DATA_KEYSYM (obj2)) && - (XKEY_DATA_MODIFIERS (obj1) == XKEY_DATA_MODIFIERS (obj2))); -} - -static int -button_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - return (XBUTTON_DATA_BUTTON (obj1) == XBUTTON_DATA_BUTTON (obj2) && - XBUTTON_DATA_MODIFIERS (obj1) == XBUTTON_DATA_MODIFIERS (obj2)); -} - -static int -motion_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - return (XMOTION_DATA_X (obj1) == XMOTION_DATA_X (obj2) && - XMOTION_DATA_Y (obj1) == XMOTION_DATA_Y (obj2)); -} - -static int -process_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - return EQ (XPROCESS_DATA_PROCESS (obj1), XPROCESS_DATA_PROCESS (obj2)); -} - -static int -timeout_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - return (internal_equal (XTIMEOUT_DATA_FUNCTION (obj1), - XTIMEOUT_DATA_FUNCTION (obj2), 0) && - internal_equal (XTIMEOUT_DATA_OBJECT (obj1), - XTIMEOUT_DATA_OBJECT (obj2), 0)); -} - -static int -eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - return (internal_equal (XEVAL_DATA_FUNCTION (obj1), - XEVAL_DATA_FUNCTION (obj2), 0) && - internal_equal (XEVAL_DATA_OBJECT (obj1), - XEVAL_DATA_OBJECT (obj2), 0)); -} - -static int -misc_user_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - return (internal_equal (XMISC_USER_DATA_FUNCTION (obj1), - XMISC_USER_DATA_FUNCTION (obj2), 0) && - internal_equal (XMISC_USER_DATA_OBJECT (obj1), - XMISC_USER_DATA_OBJECT (obj2), 0) && - /* is this really needed for equality - or is x and y also important? */ - XMISC_USER_DATA_BUTTON (obj1) == XMISC_USER_DATA_BUTTON (obj2) && - XMISC_USER_DATA_MODIFIERS (obj1) == - XMISC_USER_DATA_MODIFIERS (obj2)); -} - -static int -magic_eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{ - return (XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj1) == - XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj2) && - internal_equal (XMAGIC_EVAL_DATA_OBJECT (obj1), - XMAGIC_EVAL_DATA_OBJECT (obj2), 0)); -} - -static int -magic_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) -{assert (0); return 0;} - -static unsigned long -event_hash (Lisp_Object obj, int depth) -{ - Lisp_Event *e = XEVENT (obj); - unsigned long hash; - - hash = HASH2 (EVENT_TYPE (e), LISP_HASH (EVENT_CHANNEL (e))); - switch (EVENT_TYPE (e)) - { - case process_event: - case timeout_event: - case key_press_event: - case button_press_event: - case button_release_event: - case pointer_motion_event: - case misc_user_event: - case eval_event: - case magic_eval_event: - return HASH2 (hash, internal_hash (EVENT_DATA (e), depth + 1)); - - case magic_event: - { - struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e))); -#ifdef HAVE_X_WINDOWS - if (CONSOLE_X_P (con)) - return HASH2 (hash, XMAGIC_DATA_X_EVENT (EVENT_DATA (e)).xany.serial); -#endif -#ifdef HAVE_GTK - if (CONSOLE_GTK_P (con)) - return HASH2 (hash, XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e))); -#endif -#ifdef HAVE_MS_WINDOWS - if (CONSOLE_MSWINDOWS_P (con)) - return HASH2 (hash, XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e))); -#endif - abort (); - return 0; - } - - case empty_event: - case dead_event: - return hash; - - default: - abort (); - } - - return 0; /* unreached */ -} - -static unsigned long -key_data_hash (Lisp_Object obj, int depth) -{ - return HASH2 (LISP_HASH (XKEY_DATA_KEYSYM (obj)), - XKEY_DATA_MODIFIERS (obj)); -} - -static unsigned long -button_data_hash (Lisp_Object obj, int depth) -{ - return HASH2 (XBUTTON_DATA_BUTTON (obj), XBUTTON_DATA_MODIFIERS (obj)); -} - -static unsigned long -motion_data_hash (Lisp_Object obj, int depth) -{ - return HASH2 (XMOTION_DATA_X (obj), XMOTION_DATA_Y (obj)); -} - -static unsigned long -process_data_hash (Lisp_Object obj, int depth) -{ - return LISP_HASH (XPROCESS_DATA_PROCESS (obj)); -} - -static unsigned long -timeout_data_hash (Lisp_Object obj, int depth) -{ - return HASH2 (internal_hash (XTIMEOUT_DATA_FUNCTION (obj), depth + 1), - internal_hash (XTIMEOUT_DATA_OBJECT (obj), depth + 1)); -} - -static unsigned long -eval_data_hash (Lisp_Object obj, int depth) -{ - return HASH2 (internal_hash (XEVAL_DATA_FUNCTION (obj), depth + 1), - internal_hash (XEVAL_DATA_OBJECT (obj), depth + 1)); -} - -static unsigned long -misc_user_data_hash (Lisp_Object obj, int depth) -{ - return HASH4 (internal_hash (XMISC_USER_DATA_FUNCTION (obj), depth + 1), - internal_hash (XMISC_USER_DATA_OBJECT (obj), depth + 1), - XMISC_USER_DATA_BUTTON (obj), XMISC_USER_DATA_MODIFIERS (obj)); -} - -static unsigned long -magic_eval_data_hash (Lisp_Object obj, int depth) -{ - return HASH2 ((unsigned long) XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj), - internal_hash (XMAGIC_EVAL_DATA_OBJECT (obj), depth + 1)); -} - -static unsigned long -magic_data_hash (Lisp_Object obj, int depth) -{assert(0); return 1;} - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("key-data", key_data, - 0, /*dumpable-flag*/ - mark_key_data, - print_key_data, 0, - key_data_equal, key_data_hash, - key_data_description, - Lisp_Key_Data); - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("button-data", button_data, - 0, /*dumpable-flag*/ - mark_button_data, print_button_data, 0, - button_data_equal, button_data_hash, - button_data_description, - Lisp_Button_Data); - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("motion-data", motion_data, - 0, /*dumpable-flag*/ - mark_motion_data, print_motion_data, 0, - motion_data_equal, motion_data_hash, - motion_data_description, - Lisp_Motion_Data); - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("process-data", process_data, - 0, /*dumpable-flag*/ - mark_process_data, - print_process_data, 0, - process_data_equal, process_data_hash, - process_data_description, - Lisp_Process_Data); - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("timeout-data", timeout_data, - 0, /*dumpable-flag*/ - mark_timeout_data, - print_timeout_data, 0, - timeout_data_equal, timeout_data_hash, - timeout_data_description, - Lisp_Timeout_Data); - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("eval-data", eval_data, - 0, /*dumpable-flag*/ - mark_eval_data, - print_eval_data, 0, - eval_data_equal, eval_data_hash, - eval_data_description, - Lisp_Eval_Data); - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("misc-user-data", misc_user_data, - 0, /*dumpable-flag*/ - mark_misc_user_data, - print_misc_user_data, - 0, misc_user_data_equal, - misc_user_data_hash, - misc_user_data_description, - Lisp_Misc_User_Data); - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("magic-eval-data", magic_eval_data, - 0, /*dumpable-flag*/ - mark_magic_eval_data, - print_magic_eval_data, 0, - magic_eval_data_equal, - magic_eval_data_hash, - magic_eval_data_description, - Lisp_Magic_Eval_Data); - -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("magic-data", magic_data, - 0, /*dumpable-flag*/ - mark_magic_data, print_magic_data, 0, - magic_data_equal, magic_data_hash, - magic_data_description, - Lisp_Magic_Data); - - - -#else /* not USE_KKCC */ -/* Make sure we lose quickly if we try to use this event */ -static void -deinitialize_event (Lisp_Object ev) -{ - int i; - Lisp_Event *event = XEVENT (ev); - - for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++) - ((int *) event) [i] = 0xdeadbeef; - event->event_type = dead_event; - event->channel = Qnil; - set_lheader_implementation (&event->lheader, &lrecord_event); XSET_EVENT_NEXT (ev, Qnil); } @@ -729,11 +90,177 @@ { xzero (*e); set_lheader_implementation (&e->lheader, &lrecord_event); - e->event_type = empty_event; - e->next = Qnil; - e->channel = Qnil; + set_event_type (e, empty_event); + SET_EVENT_CHANNEL (e, Qnil); + SET_EVENT_NEXT (e, Qnil); } +static const struct memory_description key_data_description_1 [] = { + { XD_LISP_OBJECT, offsetof (struct Lisp_Key_Data, keysym) }, + { XD_END } +}; + +static const struct sized_memory_description key_data_description = { + sizeof (Lisp_Key_Data), key_data_description_1 +}; + +static const struct memory_description button_data_description_1 [] = { + { XD_END } +}; + +static const struct sized_memory_description button_data_description = { + sizeof (Lisp_Button_Data), button_data_description_1 +}; + +static const struct memory_description motion_data_description_1 [] = { + { XD_END } +}; + +static const struct sized_memory_description motion_data_description = { + sizeof (Lisp_Motion_Data), motion_data_description_1 +}; + +static const struct memory_description process_data_description_1 [] = { + { XD_LISP_OBJECT, offsetof (struct Lisp_Process_Data, process) }, + { XD_END } +}; + +static const struct sized_memory_description process_data_description = { + sizeof (Lisp_Process_Data), process_data_description_1 +}; + +static const struct memory_description timeout_data_description_1 [] = { + { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, function) }, + { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, object) }, + { XD_END } +}; + +static const struct sized_memory_description timeout_data_description = { + sizeof (Lisp_Timeout_Data), timeout_data_description_1 +}; + +static const struct memory_description eval_data_description_1 [] = { + { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, function) }, + { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, object) }, + { XD_END } +}; + +static const struct sized_memory_description eval_data_description = { + sizeof (Lisp_Eval_Data), eval_data_description_1 +}; + +static const struct memory_description misc_user_data_description_1 [] = { + { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, function) }, + { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, object) }, + { XD_END } +}; + +static const struct sized_memory_description misc_user_data_description = { + sizeof (Lisp_Misc_User_Data), misc_user_data_description_1 +}; + +static const struct memory_description magic_eval_data_description_1 [] = { + { XD_LISP_OBJECT, offsetof (struct Lisp_Magic_Eval_Data, object) }, + { XD_END } +}; + +static const struct sized_memory_description magic_eval_data_description = { + sizeof (Lisp_Magic_Eval_Data), magic_eval_data_description_1 +}; + +static const struct memory_description magic_data_description_1 [] = { + { XD_END } +}; + +static const struct sized_memory_description magic_data_description = { + sizeof (Lisp_Magic_Data), magic_data_description_1 +}; + +static const struct memory_description event_data_description_1 [] = { + { XD_STRUCT_ARRAY, key_press_event, 1, &key_data_description }, + { XD_STRUCT_ARRAY, button_press_event, 1, &button_data_description }, + { XD_STRUCT_ARRAY, button_release_event, 1, &button_data_description }, + { XD_STRUCT_ARRAY, pointer_motion_event, 1, &motion_data_description }, + { XD_STRUCT_ARRAY, process_event, 1, &process_data_description }, + { XD_STRUCT_ARRAY, timeout_event, 1, &timeout_data_description }, + { XD_STRUCT_ARRAY, magic_event, 1, &magic_data_description }, + { XD_STRUCT_ARRAY, magic_eval_event, 1, &magic_eval_data_description }, + { XD_STRUCT_ARRAY, eval_event, 1, &eval_data_description }, + { XD_STRUCT_ARRAY, misc_user_event, 1, &misc_user_data_description }, + { XD_END } +}; + +static const struct sized_memory_description event_data_description = { + 0, event_data_description_1 +}; + +static const struct memory_description event_description [] = { + { XD_INT, offsetof (struct Lisp_Event, event_type) }, + { XD_LISP_OBJECT, offsetof (struct Lisp_Event, next) }, + { XD_LISP_OBJECT, offsetof (struct Lisp_Event, channel) }, + { XD_UNION, offsetof (struct Lisp_Event, event), + XD_INDIRECT (0, 0), &event_data_description }, + { XD_END } +}; + +#ifdef EVENT_DATA_AS_OBJECTS + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("key-data", key_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + key_data_description, + Lisp_Key_Data); + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("button-data", button_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + button_data_description, + Lisp_Button_Data); + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("motion-data", motion_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + motion_data_description, + Lisp_Motion_Data); + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("process-data", process_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + process_data_description, + Lisp_Process_Data); + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("timeout-data", timeout_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + timeout_data_description, + Lisp_Timeout_Data); + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("eval-data", eval_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + eval_data_description, + Lisp_Eval_Data); + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("misc-user-data", misc_user_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + misc_user_data_description, + Lisp_Misc_User_Data); + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("magic-eval-data", magic_eval_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + magic_eval_data_description, + Lisp_Magic_Eval_Data); + +DEFINE_BASIC_LRECORD_IMPLEMENTATION ("magic-data", magic_data, + 0, /*dumpable-flag*/ + 0, 0, 0, 0, 0, + magic_data_description, + Lisp_Magic_Data); + +#endif /* EVENT_DATA_AS_OBJECTS */ + static Lisp_Object mark_event (Lisp_Object obj) { @@ -742,22 +269,22 @@ switch (event->event_type) { case key_press_event: - mark_object (event->event.key.keysym); + mark_object (EVENT_KEY_KEYSYM (event)); break; case process_event: - mark_object (event->event.process.process); + mark_object (EVENT_PROCESS_PROCESS (event)); break; case timeout_event: - mark_object (event->event.timeout.function); - mark_object (event->event.timeout.object); + mark_object (EVENT_TIMEOUT_FUNCTION (event)); + mark_object (EVENT_TIMEOUT_OBJECT (event)); break; case eval_event: case misc_user_event: - mark_object (event->event.eval.function); - mark_object (event->event.eval.object); + mark_object (EVENT_EVAL_FUNCTION (event)); + mark_object (EVENT_EVAL_OBJECT (event)); break; case magic_eval_event: - mark_object (event->event.magic_eval.object); + mark_object (EVENT_MAGIC_EVAL_OBJECT (event)); break; case button_press_event: case button_release_event: @@ -778,7 +305,7 @@ { DECLARE_EISTRING_MALLOC (ei); write_c_string (printcharfun, str); - format_event_object (ei, XEVENT (obj), 0); + format_event_object (ei, obj, 0); write_eistring (printcharfun, ei); eifree (ei); } @@ -816,21 +343,27 @@ break; } case process_event: - write_fmt_string_lisp (printcharfun, "#<process-event %S", 1, XEVENT (obj)->event.process.process); + write_fmt_string_lisp (printcharfun, "#<process-event %S", 1, + XEVENT_PROCESS_PROCESS (obj)); break; case timeout_event: - write_fmt_string_lisp (printcharfun, "#<timeout-event %S", 1, XEVENT (obj)->event.timeout.object); + write_fmt_string_lisp (printcharfun, "#<timeout-event %S", 1, + XEVENT_TIMEOUT_OBJECT (obj)); break; case empty_event: write_c_string (printcharfun, "#<empty-event"); break; case misc_user_event: - write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S", 1, XEVENT (obj)->event.misc.function); - write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.misc.object); + write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S", 1, + XEVENT_MISC_USER_FUNCTION (obj)); + write_fmt_string_lisp (printcharfun, " %S)", 1, + XEVENT_MISC_USER_OBJECT (obj)); break; case eval_event: - write_fmt_string_lisp (printcharfun, "#<eval-event (%S", 1, XEVENT (obj)->event.eval.function); - write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.eval.object); + write_fmt_string_lisp (printcharfun, "#<eval-event (%S", 1, + XEVENT_EVAL_FUNCTION (obj)); + write_fmt_string_lisp (printcharfun, " %S)", 1, + XEVENT_EVAL_OBJECT (obj)); break; case dead_event: write_c_string (printcharfun, "#<DEALLOCATED-EVENT"); @@ -856,48 +389,48 @@ default: abort (); case process_event: - return EQ (e1->event.process.process, e2->event.process.process); + return EQ (EVENT_PROCESS_PROCESS (e1), EVENT_PROCESS_PROCESS (e2)); case timeout_event: - return (internal_equal (e1->event.timeout.function, - e2->event.timeout.function, 0) && - internal_equal (e1->event.timeout.object, - e2->event.timeout.object, 0)); + return (internal_equal (EVENT_TIMEOUT_FUNCTION (e1), + EVENT_TIMEOUT_FUNCTION (e2), 0) && + internal_equal (EVENT_TIMEOUT_OBJECT (e1), + EVENT_TIMEOUT_OBJECT (e2), 0)); case key_press_event: - return (EQ (e1->event.key.keysym, e2->event.key.keysym) && - (e1->event.key.modifiers == e2->event.key.modifiers)); + return (EQ (EVENT_KEY_KEYSYM (e1), EVENT_KEY_KEYSYM (e2)) && + (EVENT_KEY_MODIFIERS (e1) == EVENT_KEY_MODIFIERS (e2))); case button_press_event: case button_release_event: - return (e1->event.button.button == e2->event.button.button && - e1->event.button.modifiers == e2->event.button.modifiers); + return (EVENT_BUTTON_BUTTON (e1) == EVENT_BUTTON_BUTTON (e2) && + EVENT_BUTTON_MODIFIERS (e1) == EVENT_BUTTON_MODIFIERS (e2)); case pointer_motion_event: - return (e1->event.motion.x == e2->event.motion.x && - e1->event.motion.y == e2->event.motion.y); + return (EVENT_MOTION_X (e1) == EVENT_MOTION_X (e2) && + EVENT_MOTION_Y (e1) == EVENT_MOTION_Y (e2)); case misc_user_event: - return (internal_equal (e1->event.eval.function, - e2->event.eval.function, 0) && - internal_equal (e1->event.eval.object, - e2->event.eval.object, 0) && - /* is this really needed for equality + return (internal_equal (EVENT_EVAL_FUNCTION (e1), + EVENT_EVAL_FUNCTION (e2), 0) && + internal_equal (EVENT_EVAL_OBJECT (e1), + EVENT_EVAL_OBJECT (e2), 0) && + /* #### is this really needed for equality or is x and y also important? */ - e1->event.misc.button == e2->event.misc.button && - e1->event.misc.modifiers == e2->event.misc.modifiers); + EVENT_MISC_USER_BUTTON (e1) == EVENT_MISC_USER_BUTTON (e2) && + EVENT_MISC_USER_MODIFIERS (e1) == EVENT_MISC_USER_MODIFIERS (e2)); case eval_event: - return (internal_equal (e1->event.eval.function, - e2->event.eval.function, 0) && - internal_equal (e1->event.eval.object, - e2->event.eval.object, 0)); + return (internal_equal (EVENT_EVAL_FUNCTION (e1), + EVENT_EVAL_FUNCTION (e2), 0) && + internal_equal (EVENT_EVAL_OBJECT (e1), + EVENT_EVAL_OBJECT (e2), 0)); case magic_eval_event: - return (e1->event.magic_eval.internal_function == - e2->event.magic_eval.internal_function && - internal_equal (e1->event.magic_eval.object, - e2->event.magic_eval.object, 0)); + return (EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (e1) == + EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (e2) && + internal_equal (EVENT_MAGIC_EVAL_OBJECT (e1), + EVENT_MAGIC_EVAL_OBJECT (e2), 0)); case magic_event: return event_stream_compare_magic_event (e1, e2); @@ -918,36 +451,38 @@ switch (e->event_type) { case process_event: - return HASH2 (hash, LISP_HASH (e->event.process.process)); + return HASH2 (hash, LISP_HASH (EVENT_PROCESS_PROCESS (e))); case timeout_event: - return HASH3 (hash, internal_hash (e->event.timeout.function, depth + 1), - internal_hash (e->event.timeout.object, depth + 1)); + return HASH3 (hash, + internal_hash (EVENT_TIMEOUT_FUNCTION (e), depth + 1), + internal_hash (EVENT_TIMEOUT_OBJECT (e), depth + 1)); case key_press_event: - return HASH3 (hash, LISP_HASH (e->event.key.keysym), - e->event.key.modifiers); + return HASH3 (hash, LISP_HASH (EVENT_KEY_KEYSYM (e)), + EVENT_KEY_MODIFIERS (e)); case button_press_event: case button_release_event: - return HASH3 (hash, e->event.button.button, e->event.button.modifiers); + return HASH3 (hash, EVENT_BUTTON_BUTTON (e), EVENT_BUTTON_MODIFIERS (e)); case pointer_motion_event: - return HASH3 (hash, e->event.motion.x, e->event.motion.y); + return HASH3 (hash, EVENT_MOTION_X (e), EVENT_MOTION_Y (e)); case misc_user_event: - return HASH5 (hash, internal_hash (e->event.misc.function, depth + 1), - internal_hash (e->event.misc.object, depth + 1), - e->event.misc.button, e->event.misc.modifiers); + return HASH5 (hash, + internal_hash (EVENT_MISC_USER_FUNCTION (e), depth + 1), + internal_hash (EVENT_MISC_USER_OBJECT (e), depth + 1), + EVENT_MISC_USER_BUTTON (e), EVENT_MISC_USER_MODIFIERS (e)); case eval_event: - return HASH3 (hash, internal_hash (e->event.eval.function, depth + 1), - internal_hash (e->event.eval.object, depth + 1)); + return HASH3 (hash, internal_hash (EVENT_EVAL_FUNCTION (e), depth + 1), + internal_hash (EVENT_EVAL_OBJECT (e), depth + 1)); case magic_eval_event: return HASH3 (hash, - (Hashcode) e->event.magic_eval.internal_function, - internal_hash (e->event.magic_eval.object, depth + 1)); + (Hashcode) EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (e), + internal_hash (EVENT_MAGIC_EVAL_OBJECT (e), depth + 1)); case magic_event: return HASH2 (hash, event_stream_hash_magic_event (e)); @@ -962,19 +497,12 @@ return 0; /* unreached */ } -#endif /* not USE_KKCC */ - -#ifdef USE_KKCC DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event, 0, /*dumpable-flag*/ mark_event, print_event, 0, event_equal, - event_hash, 0/*event_description*/, Lisp_Event); -#else /* not USE_KKCC */ -DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event, - mark_event, print_event, 0, event_equal, - event_hash, 0, Lisp_Event); -#endif /* not USE_KKCC */ + event_hash, event_description, + Lisp_Event); DEFUN ("make-event", Fmake_event, 0, 2, 0, /* Return a new event of type TYPE, with properties described by PLIST. @@ -1052,11 +580,7 @@ PLIST. In fact, processing PLIST would be wrong, because the sanitizing process would fill in the properties (e.g. CHANNEL), which we don't want in empty events. */ -#ifdef USE_KKCC set_event_type (e, empty_event); -#else /* not USE_KKCC */ - e->event_type = empty_event; -#endif /* not USE_KKCC */ if (!NILP (plist)) invalid_operation ("Cannot set properties of empty event", plist); UNGCPRO; @@ -1064,42 +588,20 @@ } else if (EQ (type, Qkey_press)) { -#ifdef USE_KKCC set_event_type (e, key_press_event); - XSET_KEY_DATA_KEYSYM (EVENT_DATA (e), Qunbound); -#else /* not USE_KKCC */ - e->event_type = key_press_event; - e->event.key.keysym = Qunbound; -#endif /* not USE_KKCC */ + SET_EVENT_KEY_KEYSYM (e, Qunbound); } else if (EQ (type, Qbutton_press)) -#ifdef USE_KKCC set_event_type (e, button_press_event); -#else /* not USE_KKCC */ - e->event_type = button_press_event; -#endif /* not USE_KKCC */ else if (EQ (type, Qbutton_release)) -#ifdef USE_KKCC set_event_type (e, button_release_event); -#else /* not USE_KKCC */ - e->event_type = button_release_event; -#endif /* not USE_KKCC */ else if (EQ (type, Qmotion)) -#ifdef USE_KKCC set_event_type (e, pointer_motion_event); -#else /* not USE_KKCC */ - e->event_type = pointer_motion_event; -#endif /* not USE_KKCC */ else if (EQ (type, Qmisc_user)) { -#ifdef USE_KKCC set_event_type (e, misc_user_event); - XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), Qnil); - XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), Qnil); -#else /* not USE_KKCC */ - e->event_type = misc_user_event; - e->event.eval.function = e->event.eval.object = Qnil; -#endif /* not USE_KKCC */ + SET_EVENT_MISC_USER_FUNCTION (e, Qnil); + SET_EVENT_MISC_USER_OBJECT (e, Qnil); } else { @@ -1120,11 +622,7 @@ { if (EQ (keyword, Qchannel)) { -#ifdef USE_KKCC - if (EVENT_TYPE(e) == key_press_event) -#else /* not USE_KKCC */ - if (e->event_type == key_press_event) -#endif /* not USE_KKCC */ + if (EVENT_TYPE (e) == key_press_event) { if (!CONSOLEP (value)) value = wrong_type_argument (Qconsolep, value); @@ -1138,20 +636,12 @@ } else if (EQ (keyword, Qkey)) { -#ifdef USE_KKCC - switch (EVENT_TYPE(e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ + switch (EVENT_TYPE (e)) { case key_press_event: if (!SYMBOLP (value) && !CHARP (value)) invalid_argument ("Invalid event key", value); -#ifdef USE_KKCC - XSET_KEY_DATA_KEYSYM (EVENT_DATA(e), value); -#else /* not USE_KKCC */ - e->event.key.keysym = value; -#endif /* not USE_KKCC */ + SET_EVENT_KEY_KEYSYM (e, value); break; default: WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); @@ -1163,26 +653,14 @@ CHECK_NATNUM (value); check_int_range (XINT (value), 0, 7); -#ifdef USE_KKCC - switch (EVENT_TYPE(e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ + switch (EVENT_TYPE (e)) { case button_press_event: case button_release_event: -#ifdef USE_KKCC - XSET_BUTTON_DATA_BUTTON (EVENT_DATA (e), XINT (value)); -#else /* not USE_KKCC */ - e->event.button.button = XINT (value); -#endif /* not USE_KKCC */ + SET_EVENT_BUTTON_BUTTON (e, XINT (value)); break; case misc_user_event: -#ifdef USE_KKCC - XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (e), XINT (value)); -#else /* not USE_KKCC */ - e->event.misc.button = XINT (value); -#endif /* not USE_KKCC */ + SET_EVENT_MISC_USER_BUTTON (e, XINT (value)); break; default: WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); @@ -1211,40 +689,20 @@ invalid_constant ("Invalid key modifier", sym); } -#ifdef USE_KKCC - switch (EVENT_TYPE(e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ + switch (EVENT_TYPE (e)) { case key_press_event: -#ifdef USE_KKCC - XSET_KEY_DATA_MODIFIERS (EVENT_DATA (e), modifiers); -#else /* not USE_KKCC */ - e->event.key.modifiers = modifiers; -#endif /* not USE_KKCC */ + SET_EVENT_KEY_MODIFIERS (e, modifiers); break; case button_press_event: case button_release_event: -#ifdef USE_KKCC - XSET_BUTTON_DATA_MODIFIERS (EVENT_DATA (e), modifiers); -#else /* not USE_KKCC */ - e->event.button.modifiers = modifiers; -#endif /* not USE_KKCC */ + SET_EVENT_BUTTON_MODIFIERS (e, modifiers); break; case pointer_motion_event: -#ifdef USE_KKCC - XSET_MOTION_DATA_MODIFIERS (EVENT_DATA (e), modifiers); -#else /* not USE_KKCC */ - e->event.motion.modifiers = modifiers; -#endif /* not USE_KKCC */ + SET_EVENT_MOTION_MODIFIERS (e, modifiers); break; case misc_user_event: -#ifdef USE_KKCC - XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (e), modifiers); -#else /* not USE_KKCC */ - e->event.misc.modifiers = modifiers; -#endif /* not USE_KKCC */ + SET_EVENT_MISC_USER_MODIFIERS (e, modifiers); break; default: WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); @@ -1253,11 +711,7 @@ } else if (EQ (keyword, Qx)) { -#ifdef USE_KKCC - switch (EVENT_TYPE(e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ + switch (EVENT_TYPE (e)) { case pointer_motion_event: case button_press_event: @@ -1275,11 +729,7 @@ } else if (EQ (keyword, Qy)) { -#ifdef USE_KKCC - switch (EVENT_TYPE(e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ + switch (EVENT_TYPE (e)) { case pointer_motion_event: case button_press_event: @@ -1297,26 +747,14 @@ else if (EQ (keyword, Qtimestamp)) { CHECK_NATNUM (value); -#ifdef USE_KKCC SET_EVENT_TIMESTAMP (e, XINT (value)); -#else /* not USE_KKCC */ - e->timestamp = XINT (value); -#endif /* not USE_KKCC */ } else if (EQ (keyword, Qfunction)) { -#ifdef USE_KKCC - switch (EVENT_TYPE(e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ + switch (EVENT_TYPE (e)) { case misc_user_event: -#ifdef USE_KKCC - XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), value); -#else /* not USE_KKCC */ - e->event.eval.function = value; -#endif /* not USE_KKCC */ + SET_EVENT_MISC_USER_FUNCTION (e, value); break; default: WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); @@ -1325,18 +763,10 @@ } else if (EQ (keyword, Qobject)) { -#ifdef USE_KKCC - switch (EVENT_TYPE(e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ + switch (EVENT_TYPE (e)) { case misc_user_event: -#ifdef USE_KKCC - XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), value); -#else /* not USE_KKCC */ - e->event.eval.object = value; -#endif /* not USE_KKCC */ + SET_EVENT_MISC_USER_OBJECT (e, value); break; default: WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); @@ -1351,11 +781,7 @@ /* Insert the channel, if missing. */ if (NILP (EVENT_CHANNEL (e))) { -#ifdef USE_KKCC if (EVENT_TYPE (e) == key_press_event) -#else /* not USE_KKCC */ - if (e->event_type == key_press_event) -#endif /* not USE_KKCC */ EVENT_CHANNEL (e) = Vselected_console; else EVENT_CHANNEL (e) = Fselected_frame (Qnil); @@ -1371,80 +797,45 @@ switch (e->event_type) { case pointer_motion_event: -#ifdef USE_KKCC - XSET_MOTION_DATA_X (EVENT_DATA (e), coord_x); - XSET_MOTION_DATA_Y (EVENT_DATA (e), coord_y); -#else /* not USE_KKCC */ - e->event.motion.x = coord_x; - e->event.motion.y = coord_y; -#endif /* not USE_KKCC */ + SET_EVENT_MOTION_X (e, coord_x); + SET_EVENT_MOTION_Y (e, coord_y); break; case button_press_event: case button_release_event: -#ifdef USE_KKCC - XSET_BUTTON_DATA_X (EVENT_DATA (e), coord_x); - XSET_BUTTON_DATA_Y (EVENT_DATA (e), coord_y); -#else /* not USE_KKCC */ - e->event.button.x = coord_x; - e->event.button.y = coord_y; -#endif /* not USE_KKCC */ + SET_EVENT_BUTTON_X (e, coord_x); + SET_EVENT_BUTTON_Y (e, coord_y); break; case misc_user_event: -#ifdef USE_KKCC - XSET_MISC_USER_DATA_X (EVENT_DATA (e), coord_x); - XSET_MISC_USER_DATA_Y (EVENT_DATA (e), coord_y); -#else /* not USE_KKCC */ - e->event.misc.x = coord_x; - e->event.misc.y = coord_y; -#endif /* not USE_KKCC */ + SET_EVENT_MISC_USER_X (e, coord_x); + SET_EVENT_MISC_USER_Y (e, coord_y); break; default: - abort(); + abort (); } } /* Finally, do some more validation. */ -#ifdef USE_KKCC - switch (EVENT_TYPE(e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ + switch (EVENT_TYPE (e)) { case key_press_event: -#ifdef USE_KKCC - if (UNBOUNDP (XKEY_DATA_KEYSYM (EVENT_DATA (e)))) -#else /* not USE_KKCC */ - if (UNBOUNDP (e->event.key.keysym)) -#endif /* not USE_KKCC */ + if (UNBOUNDP (EVENT_KEY_KEYSYM (e))) sferror ("A key must be specified to make a keypress event", plist); break; case button_press_event: -#ifdef USE_KKCC - if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e))) -#else /* not USE_KKCC */ - if (!e->event.button.button) -#endif /* not USE_KKCC */ + if (!EVENT_BUTTON_BUTTON (e)) sferror ("A button must be specified to make a button-press event", plist); break; case button_release_event: -#ifdef USE_KKCC - if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e))) -#else /* not USE_KKCC */ - if (!e->event.button.button) -#endif /* not USE_KKCC */ + if (!EVENT_BUTTON_BUTTON (e)) sferror ("A button must be specified to make a button-release event", plist); break; case misc_user_event: -#ifdef USE_KKCC - if (NILP (XMISC_USER_DATA_FUNCTION (EVENT_DATA (e)))) -#else /* not USE_KKCC */ - if (NILP (e->event.misc.function)) -#endif /* not USE_KKCC */ + if (NILP (EVENT_MISC_USER_FUNCTION (e))) sferror ("A function must be specified to make a misc-user event", plist); break; @@ -1456,114 +847,6 @@ return event; } - -#ifdef USE_KKCC - -Lisp_Object -make_key_data (void) -{ - Lisp_Object data = allocate_key_data (); - - XSET_KEY_DATA_KEYSYM (data, Qnil); - XSET_KEY_DATA_MODIFIERS (data, 0); - - return data; -} - -Lisp_Object -make_button_data (void) -{ - Lisp_Object data = allocate_button_data (); - - XSET_BUTTON_DATA_BUTTON (data, 0); - XSET_BUTTON_DATA_MODIFIERS (data, 0); - XSET_BUTTON_DATA_X (data, 0); - XSET_BUTTON_DATA_Y (data, 0); - - return data; -} - -Lisp_Object -make_motion_data (void) -{ - Lisp_Object data = allocate_motion_data (); - - XSET_MOTION_DATA_X (data, 0); - XSET_MOTION_DATA_Y (data, 0); - XSET_MOTION_DATA_MODIFIERS (data, 0); - - return data; -} - -Lisp_Object -make_process_data (void) -{ - Lisp_Object data = allocate_process_data (); - - XSET_PROCESS_DATA_PROCESS (data, Qnil); - - return data; -} - -Lisp_Object -make_timeout_data (void) -{ - Lisp_Object data = allocate_timeout_data (); - - XSET_TIMEOUT_DATA_INTERVAL_ID (data, 0); - XSET_TIMEOUT_DATA_ID_NUMBER(data, 0); - XSET_TIMEOUT_DATA_FUNCTION(data, Qnil); - XSET_TIMEOUT_DATA_OBJECT (data, Qnil); - - return data; -} - -Lisp_Object -make_magic_eval_data (void) -{ - Lisp_Object data = allocate_magic_eval_data (); - - XSET_MAGIC_EVAL_DATA_OBJECT (data, Qnil); - XSET_MAGIC_EVAL_DATA_INTERNAL_FUNOBJ (data, 0); - - return data; -} - -Lisp_Object -make_eval_data (void) -{ - Lisp_Object data = allocate_eval_data (); - - XSET_EVAL_DATA_FUNCTION (data, Qnil); - XSET_EVAL_DATA_OBJECT (data, Qnil); - - return data; -} - -Lisp_Object -make_magic_data (void) -{ - return allocate_magic_data (); -} - -Lisp_Object -make_misc_user_data (void) -{ - Lisp_Object data = allocate_misc_user_data (); - - XSET_MISC_USER_DATA_FUNCTION (data, Qnil); - XSET_MISC_USER_DATA_OBJECT (data, Qnil); - XSET_MISC_USER_DATA_BUTTON (data, 0); - XSET_MISC_USER_DATA_MODIFIERS (data, 0); - XSET_MISC_USER_DATA_X (data, 0); - XSET_MISC_USER_DATA_Y (data, 0); - - return data; -} -#endif /* USE_KKCC */ - - - DEFUN ("deallocate-event", Fdeallocate_event, 1, 1, 0, /* Allow the given event structure to be reused. You MUST NOT use this event object after calling this function with it. @@ -1613,60 +896,6 @@ return Qnil; } -#ifdef USE_KKCC -void -copy_event_data (Lisp_Object dest, Lisp_Object src) -{ - switch (XRECORD_LHEADER (dest)->type) { - case lrecord_type_key_data: - XSET_KEY_DATA_KEYSYM (dest, XKEY_DATA_KEYSYM (src)); - XSET_KEY_DATA_MODIFIERS (dest, XKEY_DATA_MODIFIERS (src)); - break; - case lrecord_type_button_data: - XSET_BUTTON_DATA_BUTTON (dest, XBUTTON_DATA_BUTTON (src)); - XSET_BUTTON_DATA_MODIFIERS (dest, XBUTTON_DATA_MODIFIERS (src)); - XSET_BUTTON_DATA_X (dest, XBUTTON_DATA_X (src)); - XSET_BUTTON_DATA_Y (dest, XBUTTON_DATA_Y (src)); - break; - case lrecord_type_motion_data: - XSET_MOTION_DATA_X (dest, XMOTION_DATA_X (src)); - XSET_MOTION_DATA_Y (dest, XMOTION_DATA_Y (src)); - XSET_MOTION_DATA_MODIFIERS (dest, XMOTION_DATA_MODIFIERS (src)); - break; - case lrecord_type_process_data: - XSET_PROCESS_DATA_PROCESS (dest, XPROCESS_DATA_PROCESS (src)); - break; - case lrecord_type_timeout_data: - XSET_TIMEOUT_DATA_INTERVAL_ID (dest, XTIMEOUT_DATA_INTERVAL_ID (src)); - XSET_TIMEOUT_DATA_ID_NUMBER (dest, XTIMEOUT_DATA_ID_NUMBER (src)); - XSET_TIMEOUT_DATA_FUNCTION (dest, XTIMEOUT_DATA_FUNCTION (src)); - XSET_TIMEOUT_DATA_OBJECT (dest, XTIMEOUT_DATA_OBJECT (src)); - break; - case lrecord_type_eval_data: - XSET_EVAL_DATA_FUNCTION (dest, XEVAL_DATA_FUNCTION (src)); - XSET_EVAL_DATA_OBJECT (dest, XEVAL_DATA_OBJECT (src)); - break; - case lrecord_type_misc_user_data: - XSET_MISC_USER_DATA_FUNCTION (dest, XMISC_USER_DATA_FUNCTION (src)); - XSET_MISC_USER_DATA_OBJECT (dest, XMISC_USER_DATA_OBJECT (src)); - XSET_MISC_USER_DATA_BUTTON (dest, XMISC_USER_DATA_BUTTON (src)); - XSET_MISC_USER_DATA_MODIFIERS (dest, XMISC_USER_DATA_MODIFIERS (src)); - XSET_MISC_USER_DATA_X (dest, XMISC_USER_DATA_X (src)); - XSET_MISC_USER_DATA_Y (dest, XMISC_USER_DATA_Y (src)); - break; - case lrecord_type_magic_eval_data: - XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION (dest, XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (src)); - XSET_MAGIC_EVAL_DATA_OBJECT (dest, XMAGIC_EVAL_DATA_OBJECT (src)); - break; - case lrecord_type_magic_data: - XSET_MAGIC_DATA_UNDERLYING (dest, XMAGIC_DATA_UNDERLYING (src)); - break; - default: - break; - } -} -#endif /* USE_KKCC */ - DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /* Make a copy of the event object EVENT1. If a second event argument EVENT2 is given, EVENT1 is copied into @@ -1691,26 +920,16 @@ assert (XEVENT_TYPE (event1) <= last_event_type); assert (XEVENT_TYPE (event2) <= last_event_type); -#ifdef USE_KKCC XSET_EVENT_TYPE (event2, XEVENT_TYPE (event1)); XSET_EVENT_CHANNEL (event2, XEVENT_CHANNEL (event1)); XSET_EVENT_TIMESTAMP (event2, XEVENT_TIMESTAMP (event1)); - copy_event_data (XEVENT_DATA (event2), XEVENT_DATA (event1)); - + +#ifdef EVENT_DATA_AS_OBJECTS + copy_lisp_object (XEVENT_DATA (event2), XEVENT_DATA (event1)); +#else + XEVENT (event2)->event = XEVENT (event1)->event; +#endif return event2; -#else /* not USE_KKCC */ - { - Lisp_Event *ev2 = XEVENT (event2); - Lisp_Event *ev1 = XEVENT (event1); - - ev2->event_type = ev1->event_type; - ev2->channel = ev1->channel; - ev2->timestamp = ev1->timestamp; - ev2->event = ev1->event; - - return event2; - } -#endif /* not USE_KKCC */ } @@ -1806,6 +1025,48 @@ } } +/* Map a function over each event in the chain. If the function returns + non-zero, remove the event just processed. Return the total number of + items removed. + + NOTE: + + If you want a simple mapping over an event chain, with no intention to + add or remove items, just use EVENT_CHAIN_LOOP(). +*/ + +int +map_event_chain_remove (int (*fn) (Lisp_Object ev, void *user_data), + Lisp_Object *head, Lisp_Object *tail, + void *user_data, int flags) +{ + Lisp_Object event; + Lisp_Object previous_event = Qnil; + int count = 0; + + EVENT_CHAIN_LOOP (event, *head) + { + if (fn (event, user_data)) + { + if (NILP (previous_event)) + dequeue_event (head, tail); + else + { + XSET_EVENT_NEXT (previous_event, XEVENT_NEXT (event)); + if (EQ (*tail, event)) + *tail = previous_event; + } + + if (flags & MECR_DEALLOCATE_EVENT) + Fdeallocate_event (event); + count++; + } + else + previous_event = event; + } + return count; +} + /* Return the number of events (possibly 0) on an event chain. */ int @@ -1914,6 +1175,37 @@ } } +/* USE_CONSOLE_META_FLAG is as in `character-to-event'. + DO_BACKSPACE_MAPPING means that if CON is a TTY, and C is a the TTY's + backspace character, the event will have keysym `backspace' instead of + '(control h). It is clearly correct to do this conversion is the + character was just read from a TTY, clearly incorrect inside of + define-key, which must be able to handle all consoles. #### What about + in other circumstances? #### Should the user have access to this flag? + + + #### We need to go through and review all the flags in + character_to_event() and event_to_character() and figure out exactly + under what circumstances they should or should not be set, then go + through and review all callers of character_to_event(), + Fcharacter_to_event(), event_to_character(), and Fevent_to_character() + and check that they are passing the correct flags in for their varied + circumstances. + + #### Some of this garbage, and some of the flags, could go away if we + implemented the suggestion, originally from event-Xt.c: + + #### The way that keysym correspondence to characters should work: + - a Lisp_Event should contain a keysym AND a character slot. + - keybindings are tried with the keysym. If no binding can be found, + and there is a corresponding character, call self-insert-command. + + #### Nuke x-iso8859-1.el. + #### Nuke the Qascii_character property. + #### Nuke Vcharacter_set_property. + + This would apparently solve a lot of different problems. +*/ void character_to_event (Ichar c, Lisp_Event *event, struct console *con, @@ -1921,11 +1213,7 @@ { Lisp_Object k = Qnil; int m = 0; -#ifdef USE_KKCC if (EVENT_TYPE (event) == dead_event) -#else /* not USE_KKCC */ - if (event->event_type == dead_event) -#endif /* not USE_KKCC */ invalid_argument ("character-to-event called with a deallocated event!", Qunbound); #ifndef MULE @@ -1933,6 +1221,9 @@ #endif if (c > 127 && c <= 255) { + /* #### What if the user wanted a Latin-1 char? Perhaps the answer + is what was suggested above. + */ int meta_flag = 1; if (use_console_meta_flag && CONSOLE_TTY_P (con)) meta_flag = TTY_FLAGS (con).meta_key; @@ -1959,7 +1250,7 @@ case 'M': k = QKreturn; m &= ~XEMACS_MOD_CONTROL; break; case '[': k = QKescape; m &= ~XEMACS_MOD_CONTROL; break; default: -#if defined(HAVE_TTY) +#if defined (HAVE_TTY) if (do_backspace_mapping && CHARP (con->tty_erase_char) && c - '@' == XCHAR (con->tty_erase_char)) @@ -1967,34 +1258,26 @@ k = QKbackspace; m &= ~XEMACS_MOD_CONTROL; } -#endif /* defined(HAVE_TTY) && !defined(CYGWIN) */ +#endif /* defined (HAVE_TTY) */ break; } if (c >= 'A' && c <= 'Z') c -= 'A'-'a'; } -#if defined(HAVE_TTY) +#if defined (HAVE_TTY) else if (do_backspace_mapping && CHARP (con->tty_erase_char) && c == XCHAR (con->tty_erase_char)) k = QKbackspace; -#endif /* defined(HAVE_TTY) && !defined(CYGWIN) */ +#endif /* defined (HAVE_TTY) */ else if (c == 127) k = QKdelete; else if (c == ' ') k = QKspace; -#ifdef USE_KKCC set_event_type (event, key_press_event); SET_EVENT_TIMESTAMP_ZERO (event); /* #### */ SET_EVENT_CHANNEL (event, wrap_console (con)); - XSET_KEY_DATA_KEYSYM (EVENT_DATA (event), (!NILP (k) ? k : make_char (c))); - XSET_KEY_DATA_MODIFIERS (EVENT_DATA (event), m); -#else /* not USE_KKCC */ - event->event_type = key_press_event; - event->timestamp = 0; /* #### */ - event->channel = wrap_console (con); - event->event.key.keysym = (!NILP (k) ? k : make_char (c)); - event->event.key.modifiers = m; -#endif /* not USE_KKCC */ + SET_EVENT_KEY_KEYSYM (event, (!NILP (k) ? k : make_char (c))); + SET_EVENT_KEY_MODIFIERS (event, m); } /* This variable controls what character name -> character code mapping @@ -2008,73 +1291,40 @@ Lisp_Object Vcharacter_set_property; Ichar -event_to_character (Lisp_Event *event, +event_to_character (Lisp_Object event, int allow_extra_modifiers, int allow_meta, - int allow_non_ascii) + int map_device_key_names) { Ichar c = 0; Lisp_Object code; -#ifdef USE_KKCC - if (EVENT_TYPE (event) != key_press_event) -#else /* not USE_KKCC */ - if (event->event_type != key_press_event) -#endif /* not USE_KKCC */ + if (XEVENT_TYPE (event) != key_press_event) { -#ifdef USE_KKCC - assert (EVENT_TYPE (event) != dead_event); -#else /* not USE_KKCC */ - assert (event->event_type != dead_event); -#endif /* not USE_KKCC */ + assert (XEVENT_TYPE (event) != dead_event); return -1; } if (!allow_extra_modifiers && -#ifdef USE_KKCC - XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT)) -#else /* not USE_KKCC */ - event->event.key.modifiers & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT)) -#endif /* not USE_KKCC */ + XEVENT_KEY_MODIFIERS (event) & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT)) return -1; -#ifdef USE_KKCC - if (CHAR_OR_CHAR_INTP (XKEY_DATA_KEYSYM (EVENT_DATA (event)))) - c = XCHAR_OR_CHAR_INT (XKEY_DATA_KEYSYM (EVENT_DATA (event))); - else if (!SYMBOLP (XKEY_DATA_KEYSYM (EVENT_DATA (event)))) -#else /* not USE_KKCC */ - if (CHAR_OR_CHAR_INTP (event->event.key.keysym)) - c = XCHAR_OR_CHAR_INT (event->event.key.keysym); - else if (!SYMBOLP (event->event.key.keysym)) -#endif /* not USE_KKCC */ + if (CHAR_OR_CHAR_INTP (XEVENT_KEY_KEYSYM (event))) + c = XCHAR_OR_CHAR_INT (XEVENT_KEY_KEYSYM (event)); + else if (!SYMBOLP (XEVENT_KEY_KEYSYM (event))) abort (); - else if (allow_non_ascii && !NILP (Vcharacter_set_property) + else if (map_device_key_names && !NILP (Vcharacter_set_property) /* Allow window-system-specific extensibility of keysym->code mapping */ -#ifdef USE_KKCC - && CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)), - Vcharacter_set_property, - Qnil))) -#else /* not USE_KKCC */ - && CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym, + && CHAR_OR_CHAR_INTP (code = Fget (XEVENT_KEY_KEYSYM (event), Vcharacter_set_property, Qnil))) -#endif /* not USE_KKCC */ c = XCHAR_OR_CHAR_INT (code); -#ifdef USE_KKCC - else if (CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)), + else if (CHAR_OR_CHAR_INTP (code = Fget (XEVENT_KEY_KEYSYM (event), Qascii_character, Qnil))) -#else /* not USE_KKCC */ - else if (CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym, - Qascii_character, Qnil))) -#endif /* not USE_KKCC */ c = XCHAR_OR_CHAR_INT (code); else return -1; -#ifdef USE_KKCC - if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_CONTROL) -#else /* not USE_KKCC */ - if (event->event.key.modifiers & XEMACS_MOD_CONTROL) -#endif /* not USE_KKCC */ + if (XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_CONTROL) { if (c >= 'a' && c <= 'z') c -= ('a' - 'A'); @@ -2092,17 +1342,10 @@ if (! allow_extra_modifiers) return -1; } -#ifdef USE_KKCC - if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_META) -#else /* not USE_KKCC */ - if (event->event.key.modifiers & XEMACS_MOD_META) -#endif /* not USE_KKCC */ + if (XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_META) { if (! allow_meta) return -1; - if (c & 0200) return -1; /* don't allow M-oslash (overlap) */ -#ifdef MULE - if (c >= 256) return -1; -#endif + if (c >= 128) return -1; /* don't allow M-oslash (overlap) */ c |= 0200; } return c; @@ -2119,21 +1362,24 @@ If the ALLOW-META argument is non-nil, then the Meta modifier will be represented by turning on the high bit of the byte returned; otherwise, nil will be returned for events containing the Meta modifier. -If the ALLOW-NON-ASCII argument is non-nil, then characters which are - present in the prevailing character set (see the `character-set-property' - variable) will be returned as their code in that character set, instead of - the return value being restricted to ASCII. -Note that specifying both ALLOW-META and ALLOW-NON-ASCII is ambiguous, as - both use the high bit; `M-x' and `oslash' will be indistinguishable. +If the MAP-DEVICE-KEY-NAMES argument is non-nil, then named keysyms that + represent printable characters will be converted to that character. This + means, for example, that under X, where a circumflexed lowercase o returns + a key with the name `ocircumflex' rather than the actual character, this + name will be converted to the appropriate character. See + `character-set-property' for some sense of how this works. #### This + should not be exposed and may be removed at some point. +Note that ALLOW-META may cause ambiguity between meta characters and + Latin-1 characters. */ - (event, allow_extra_modifiers, allow_meta, allow_non_ascii)) + (event, allow_extra_modifiers, allow_meta, map_device_key_names)) { Ichar c; CHECK_LIVE_EVENT (event); - c = event_to_character (XEVENT (event), + c = event_to_character (event, !NILP (allow_extra_modifiers), !NILP (allow_meta), - !NILP (allow_non_ascii)); + !NILP (map_device_key_names)); return c < 0 ? Qnil : make_char (c); } @@ -2155,13 +1401,17 @@ defaults to the selected console. If KEY-DESCRIPTION is an integer or character, the high bit may be -interpreted as the meta key. (This is done for backward compatibility -in lots of places.) If USE-CONSOLE-META-FLAG is nil, this will always -be the case. If USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for -CONSOLE affects whether the high bit is interpreted as a meta -key. (See `set-input-mode'.) If you don't want this silly meta -interpretation done, you should pass in a list containing the -character. +interpreted as the meta key. (This is done for backward compatibility in +lots of places -- specifically, because lots of Lisp code uses specs like +?\M-d and "\M-d" in key code, expecting this to work; yet these are in +reality converted directly to 8-bit characters by the Lisp reader.) If +USE-CONSOLE-META-FLAG is nil or CONSOLE is not a TTY, this will always be +the case. If USE-CONSOLE-META-FLAG is non-nil and CONSOLE is a TTY, the +`meta' flag for CONSOLE affects whether the high bit is interpreted as a +meta key. (See `set-input-mode'.) Don't set this flag to non-nil unless +you know what you're doing (more specifically, only if the character came +directly from a TTY, not from the user). If you don't want this silly meta +interpretation done, you should pass in a list containing the character. Beware that character-to-event and event-to-character are not strictly inverse functions, since events contain much more information than the @@ -2227,33 +1477,19 @@ /* Concatenate a string description of EVENT onto the end of BUF. If BRIEF, use short forms for keys, e.g. C- instead of control-. */ -#ifdef USE_KKCC void format_event_object (Eistring *buf, Lisp_Object event, int brief) -#else /* not USE_KKCC */ -void -format_event_object (Eistring *buf, Lisp_Event *event, int brief) -#endif /* not USE_KKCC */ { int mouse_p = 0; int mod = 0; Lisp_Object key; -#ifdef USE_KKCC - switch (EVENT_TYPE (XEVENT(event))) -#else /* not USE_KKCC */ - switch (event->event_type) -#endif /* not USE_KKCC */ + switch (XEVENT_TYPE (event)) { case key_press_event: { -#ifdef USE_KKCC - mod = XKEY_DATA_MODIFIERS (XEVENT_DATA(event)); - key = XKEY_DATA_KEYSYM (XEVENT_DATA(event)); -#else /* not USE_KKCC */ - mod = event->event.key.modifiers; - key = event->event.key.keysym; -#endif /* not USE_KKCC */ + mod = XEVENT_KEY_MODIFIERS (event); + key = XEVENT_KEY_KEYSYM (event); /* Hack. */ if (! brief && CHARP (key) && mod & (XEMACS_MOD_CONTROL | XEMACS_MOD_META | XEMACS_MOD_SUPER | @@ -2273,13 +1509,8 @@ case button_press_event: { mouse_p++; -#ifdef USE_KKCC - mod = XBUTTON_DATA_MODIFIERS (XEVENT_DATA(event)); - key = make_char (XBUTTON_DATA_BUTTON (XEVENT_DATA(event)) + '0'); -#else /* not USE_KKCC */ - mod = event->event.button.modifiers; - key = make_char (event->event.button.button + '0'); -#endif /* not USE_KKCC */ + mod = XEVENT_BUTTON_MODIFIERS (event); + key = make_char (XEVENT_BUTTON_BUTTON (event) + '0'); break; } case magic_event: @@ -2289,11 +1520,7 @@ GCPRO1 (stream); stream = make_resizing_buffer_output_stream (); -#ifdef USE_KKCC - event_stream_format_magic_event (XEVENT(event), stream); -#else /* not USE_KKCC */ - event_stream_format_magic_event (event, stream); -#endif /* not USE_KKCC */ + event_stream_format_magic_event (XEVENT (event), stream); Lstream_flush (XLSTREAM (stream)); eicat_raw (buf, resizing_buffer_stream_ptr (XLSTREAM (stream)), Lstream_byte_count (XLSTREAM (stream))); @@ -2355,6 +1582,51 @@ eicat_c (buf, "up"); } +void +upshift_event (Lisp_Object event) +{ + Lisp_Object keysym = XEVENT_KEY_KEYSYM (event); + Ichar c = 0; + + if (CHAR_OR_CHAR_INTP (keysym) + && ((c = XCHAR_OR_CHAR_INT (keysym)), + c >= 'a' && c <= 'z')) + XSET_EVENT_KEY_KEYSYM (event, make_char (c + 'A' - 'a')); + else + if (!(XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_SHIFT)) + XSET_EVENT_KEY_MODIFIERS + (event, XEVENT_KEY_MODIFIERS (event) |= XEMACS_MOD_SHIFT); +} + +void +downshift_event (Lisp_Object event) +{ + Lisp_Object keysym = XEVENT_KEY_KEYSYM (event); + Ichar c = 0; + + if (XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_SHIFT) + XSET_EVENT_KEY_MODIFIERS + (event, XEVENT_KEY_MODIFIERS (event) & ~XEMACS_MOD_SHIFT); + else if (CHAR_OR_CHAR_INTP (keysym) + && ((c = XCHAR_OR_CHAR_INT (keysym)), + c >= 'A' && c <= 'Z')) + XSET_EVENT_KEY_KEYSYM (event, make_char (c + 'a' - 'A')); +} + +int +event_upshifted_p (Lisp_Object event) +{ + Lisp_Object keysym = XEVENT_KEY_KEYSYM (event); + Ichar c = 0; + + if ((XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_SHIFT) + || (CHAR_OR_CHAR_INTP (keysym) + && ((c = XCHAR_OR_CHAR_INT (keysym)), + c >= 'A' && c <= 'Z'))) + return 1; + else + return 0; +} DEFUN ("eventp", Feventp, 1, 1, 0, /* True if OBJECT is an event object. @@ -2369,13 +1641,8 @@ */ (object)) { -#ifdef USE_KKCC return EVENTP (object) && XEVENT_TYPE (object) != dead_event ? Qt : Qnil; -#else /* not USE_KKCC */ - return EVENTP (object) && XEVENT (object)->event_type != dead_event ? - Qt : Qnil; -#endif /* not USE_KKCC */ } #if 0 /* debugging functions */ @@ -2441,11 +1708,7 @@ (event)) { CHECK_LIVE_EVENT (event); -#ifdef USE_KKCC switch (XEVENT_TYPE (event)) -#else /* not USE_KKCC */ - switch (XEVENT (event)->event_type) -#endif /* not USE_KKCC */ { case key_press_event: return Qkey_press; case button_press_event: return Qbutton_press; @@ -2481,13 +1744,8 @@ /* This junk is so that timestamps don't get to be negative, but contain as many bits as this particular emacs will allow. */ -#ifdef USE_KKCC return make_int (((1L << (VALBITS - 1)) - 1) & XEVENT_TIMESTAMP (event)); -#else /* not USE_KKCC */ - return make_int (((1L << (VALBITS - 1)) - 1) & - XEVENT (event)->timestamp); -#endif /* not USE_KKCC */ } #define TIMESTAMP_HALFSPACE (1L << (VALBITS - 2)) @@ -2512,21 +1770,12 @@ return t1 - t2 < TIMESTAMP_HALFSPACE ? Qnil : Qt; } -#ifdef USE_KKCC #define CHECK_EVENT_TYPE(e,t1,sym) do { \ CHECK_LIVE_EVENT (e); \ if (XEVENT_TYPE (e) != (t1)) \ e = wrong_type_argument (sym,e); \ } while (0) -#else /* not USE_KKCC */ -#define CHECK_EVENT_TYPE(e,t1,sym) do { \ - CHECK_LIVE_EVENT (e); \ - if (XEVENT(e)->event_type != (t1)) \ - e = wrong_type_argument (sym,e); \ -} while (0) -#endif /* not USE_KKCC */ -#ifdef USE_KKCC #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \ CHECK_LIVE_EVENT (e); \ { \ @@ -2536,19 +1785,7 @@ e = wrong_type_argument (sym,e); \ } \ } while (0) -#else /* not USE_KKCC */ -#define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \ - CHECK_LIVE_EVENT (e); \ - { \ - emacs_event_type CET_type = XEVENT (e)->event_type; \ - if (CET_type != (t1) && \ - CET_type != (t2)) \ - e = wrong_type_argument (sym,e); \ - } \ -} while (0) -#endif /* not USE_KKCC */ -#ifdef USE_KKCC #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \ CHECK_LIVE_EVENT (e); \ { \ @@ -2559,18 +1796,6 @@ e = wrong_type_argument (sym,e); \ } \ } while (0) -#else /* not USE_KKCC */ -#define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \ - CHECK_LIVE_EVENT (e); \ - { \ - emacs_event_type CET_type = XEVENT (e)->event_type; \ - if (CET_type != (t1) && \ - CET_type != (t2) && \ - CET_type != (t3)) \ - e = wrong_type_argument (sym,e); \ - } \ -} while (0) -#endif /* not USE_KKCC */ DEFUN ("event-key", Fevent_key, 1, 1, 0, /* Return the Keysym of the key-press event EVENT. @@ -2579,11 +1804,7 @@ (event)) { CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p); -#ifdef USE_KKCC - return XKEY_DATA_KEYSYM (XEVENT_DATA (event)); -#else /* not USE_KKCC */ - return XEVENT (event)->event.key.keysym; -#endif /* not USE_KKCC */ + return XEVENT_KEY_KEYSYM (event); } DEFUN ("event-button", Fevent_button, 1, 1, 0, /* @@ -2591,25 +1812,16 @@ */ (event)) { - CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event, misc_user_event, Qbutton_event_p); #ifdef HAVE_WINDOW_SYSTEM -#ifdef USE_KKCC - if ( XEVENT_TYPE (event) == misc_user_event) - return make_int (XMISC_USER_DATA_BUTTON (XEVENT_DATA (event))); + if (XEVENT_TYPE (event) == misc_user_event) + return make_int (XEVENT_MISC_USER_BUTTON (event)); else - return make_int (XBUTTON_DATA_BUTTON (XEVENT_DATA (event))); -#else /* not USE_KKCC */ - if ( XEVENT (event)->event_type == misc_user_event) - return make_int (XEVENT (event)->event.misc.button); - else - return make_int (XEVENT (event)->event.button.button); -#endif /* not USE_KKCC */ + return make_int (XEVENT_BUTTON_BUTTON (event)); #else /* !HAVE_WINDOW_SYSTEM */ return Qzero; #endif /* !HAVE_WINDOW_SYSTEM */ - } DEFUN ("event-modifier-bits", Fevent_modifier_bits, 1, 1, 0, /* @@ -2621,39 +1833,21 @@ { again: CHECK_LIVE_EVENT (event); -#ifdef USE_KKCC switch (XEVENT_TYPE (event)) { case key_press_event: - return make_int (XKEY_DATA_MODIFIERS (XEVENT_DATA (event))); + return make_int (XEVENT_KEY_MODIFIERS (event)); case button_press_event: case button_release_event: - return make_int (XBUTTON_DATA_MODIFIERS (XEVENT_DATA (event))); + return make_int (XEVENT_BUTTON_MODIFIERS (event)); case pointer_motion_event: - return make_int (XMOTION_DATA_MODIFIERS (XEVENT_DATA (event))); + return make_int (XEVENT_MOTION_MODIFIERS (event)); case misc_user_event: - return make_int (XMISC_USER_DATA_MODIFIERS (XEVENT_DATA (event))); + return make_int (XEVENT_MISC_USER_MODIFIERS (event)); default: event = wrong_type_argument (intern ("key-or-mouse-event-p"), event); goto again; } -#else /* not USE_KKCC */ - switch (XEVENT (event)->event_type) - { - case key_press_event: - return make_int (XEVENT (event)->event.key.modifiers); - case button_press_event: - case button_release_event: - return make_int (XEVENT (event)->event.button.modifiers); - case pointer_motion_event: - return make_int (XEVENT (event)->event.motion.modifiers); - case misc_user_event: - return make_int (XEVENT (event)->event.misc.modifiers); - default: - event = wrong_type_argument (intern ("key-or-mouse-event-p"), event); - goto again; - } -#endif /* not USE_KKCC */ } DEFUN ("event-modifiers", Fevent_modifiers, 1, 1, 0, /* @@ -2726,45 +1920,24 @@ struct window *w; struct frame *f; -#ifdef USE_KKCC if (XEVENT_TYPE (event) == pointer_motion_event) { - *x = XMOTION_DATA_X (XEVENT_DATA (event)); - *y = XMOTION_DATA_Y (XEVENT_DATA (event)); + *x = XEVENT_MOTION_X (event); + *y = XEVENT_MOTION_Y (event); } else if (XEVENT_TYPE (event) == button_press_event || XEVENT_TYPE (event) == button_release_event) { - *x = XBUTTON_DATA_X (XEVENT_DATA (event)); - *y = XBUTTON_DATA_Y (XEVENT_DATA (event)); + *x = XEVENT_BUTTON_X (event); + *y = XEVENT_BUTTON_Y (event); } else if (XEVENT_TYPE (event) == misc_user_event) { - *x = XMISC_USER_DATA_X (XEVENT_DATA (event)); - *y = XMISC_USER_DATA_Y (XEVENT_DATA (event)); + *x = XEVENT_MISC_USER_X (event); + *y = XEVENT_MISC_USER_Y (event); } else return 0; -#else /* not USE_KKCC */ - if (XEVENT (event)->event_type == pointer_motion_event) - { - *x = XEVENT (event)->event.motion.x; - *y = XEVENT (event)->event.motion.y; - } - else if (XEVENT (event)->event_type == button_press_event || - XEVENT (event)->event_type == button_release_event) - { - *x = XEVENT (event)->event.button.x; - *y = XEVENT (event)->event.button.y; - } - else if (XEVENT (event)->event_type == misc_user_event) - { - *x = XEVENT (event)->event.misc.x; - *y = XEVENT (event)->event.misc.y; - } - else - return 0; -#endif /* not USE_KKCC */ f = XFRAME (EVENT_CHANNEL (XEVENT (event))); if (relative) @@ -2901,47 +2074,25 @@ Lisp_Object ret_obj1, ret_obj2; CHECK_LIVE_EVENT (event); -#ifdef USE_KKCC frame = XEVENT_CHANNEL (event); switch (XEVENT_TYPE (event)) { case pointer_motion_event : - pix_x = XMOTION_DATA_X (XEVENT_DATA (event)); - pix_y = XMOTION_DATA_Y (XEVENT_DATA (event)); + pix_x = XEVENT_MOTION_X (event); + pix_y = XEVENT_MOTION_Y (event); break; case button_press_event : case button_release_event : - pix_x = XBUTTON_DATA_X (XEVENT_DATA (event)); - pix_y = XBUTTON_DATA_Y (XEVENT_DATA (event)); + pix_x = XEVENT_BUTTON_X (event); + pix_y = XEVENT_BUTTON_Y (event); break; case misc_user_event : - pix_x = XMISC_USER_DATA_X (XEVENT_DATA (event)); - pix_y = XMISC_USER_DATA_Y (XEVENT_DATA (event)); + pix_x = XEVENT_MISC_USER_X (event); + pix_y = XEVENT_MISC_USER_Y (event); break; default: dead_wrong_type_argument (Qmouse_event_p, event); } -#else /* not USE_KKCC */ - frame = XEVENT (event)->channel; - switch (XEVENT (event)->event_type) - { - case pointer_motion_event : - pix_x = XEVENT (event)->event.motion.x; - pix_y = XEVENT (event)->event.motion.y; - break; - case button_press_event : - case button_release_event : - pix_x = XEVENT (event)->event.button.x; - pix_y = XEVENT (event)->event.button.y; - break; - case misc_user_event : - pix_x = XEVENT (event)->event.misc.x; - pix_y = XEVENT (event)->event.misc.y; - break; - default: - dead_wrong_type_argument (Qmouse_event_p, event); - } -#endif /* not USE_KKCC */ result = pixel_to_glyph_translation (XFRAME (frame), pix_x, pix_y, &ret_x, &ret_y, &ret_obj_x, &ret_obj_y, @@ -3250,13 +2401,8 @@ */ (event)) { -#ifdef USE_KKCC CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p); - return XPROCESS_DATA_PROCESS (XEVENT_DATA (event)); -#else /* not USE_KKCC */ - CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p); - return XEVENT (event)->event.process.process; -#endif /* not USE_KKCC */ + return XEVENT_PROCESS_PROCESS (event); } DEFUN ("event-function", Fevent_function, 1, 1, 0, /* @@ -3267,33 +2413,18 @@ { again: CHECK_LIVE_EVENT (event); -#ifdef USE_KKCC switch (XEVENT_TYPE (event)) { case timeout_event: - return XTIMEOUT_DATA_FUNCTION (XEVENT_DATA (event)); + return XEVENT_TIMEOUT_FUNCTION (event); case misc_user_event: - return XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event)); + return XEVENT_MISC_USER_FUNCTION (event); case eval_event: - return XEVAL_DATA_FUNCTION (XEVENT_DATA (event)); + return XEVENT_EVAL_FUNCTION (event); default: event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); goto again; } -#else /* not USE_KKCC */ - switch (XEVENT (event)->event_type) - { - case timeout_event: - return XEVENT (event)->event.timeout.function; - case misc_user_event: - return XEVENT (event)->event.misc.function; - case eval_event: - return XEVENT (event)->event.eval.function; - default: - event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); - goto again; - } -#endif /* not USE_KKCC */ } DEFUN ("event-object", Fevent_object, 1, 1, 0, /* @@ -3304,33 +2435,18 @@ { again: CHECK_LIVE_EVENT (event); -#ifdef USE_KKCC switch (XEVENT_TYPE (event)) { case timeout_event: - return XTIMEOUT_DATA_OBJECT (XEVENT_DATA (event)); + return XEVENT_TIMEOUT_OBJECT (event); case misc_user_event: - return XMISC_USER_DATA_OBJECT (XEVENT_DATA (event)); + return XEVENT_MISC_USER_OBJECT (event); case eval_event: - return XEVAL_DATA_OBJECT (XEVENT_DATA (event)); + return XEVENT_EVAL_OBJECT (event); default: event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); goto again; } -#else /* not USE_KKCC */ - switch (XEVENT (event)->event_type) - { - case timeout_event: - return XEVENT (event)->event.timeout.object; - case misc_user_event: - return XEVENT (event)->event.misc.object; - case eval_event: - return XEVENT (event)->event.eval.object; - default: - event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); - goto again; - } -#endif /* not USE_KKCC */ } DEFUN ("event-properties", Fevent_properties, 1, 1, 0, /* @@ -3349,30 +2465,18 @@ props = cons3 (Qtimestamp, Fevent_timestamp (event), props); -#ifdef USE_KKCC switch (EVENT_TYPE (e)) -#else /* not USE_KKCC */ - switch (e->event_type) -#endif /* not USE_KKCC */ { default: abort (); case process_event: -#ifdef USE_KKCC - props = cons3 (Qprocess, XPROCESS_DATA_PROCESS (EVENT_DATA (e)), props); -#else /* not USE_KKCC */ - props = cons3 (Qprocess, e->event.process.process, props); -#endif /* not USE_KKCC */ + props = cons3 (Qprocess, EVENT_PROCESS_PROCESS (e), props); break; case timeout_event: props = cons3 (Qobject, Fevent_object (event), props); props = cons3 (Qfunction, Fevent_function (event), props); -#ifdef USE_KKCC - props = cons3 (Qid, make_int (XTIMEOUT_DATA_ID_NUMBER (EVENT_DATA (e))), props); -#else /* not USE_KKCC */ - props = cons3 (Qid, make_int (e->event.timeout.id_number), props); -#endif /* not USE_KKCC */ + props = cons3 (Qid, make_int (EVENT_TIMEOUT_ID_NUMBER (e)), props); break; case key_press_event: @@ -3432,7 +2536,7 @@ syms_of_events (void) { INIT_LRECORD_IMPLEMENTATION (event); -#ifdef USE_KKCC +#ifdef EVENT_DATA_AS_OBJECTS INIT_LRECORD_IMPLEMENTATION (key_data); INIT_LRECORD_IMPLEMENTATION (button_data); INIT_LRECORD_IMPLEMENTATION (motion_data); @@ -3442,7 +2546,7 @@ INIT_LRECORD_IMPLEMENTATION (misc_user_data); INIT_LRECORD_IMPLEMENTATION (magic_eval_data); INIT_LRECORD_IMPLEMENTATION (magic_data); -#endif /* USE_KKCC */ +#endif /* EVENT_DATA_AS_OBJECTS */ DEFSUBR (Fcharacter_to_event); DEFSUBR (Fevent_to_character); @@ -3520,12 +2624,15 @@ reinit_vars_of_events (); DEFVAR_LISP ("character-set-property", &Vcharacter_set_property /* -A symbol used to look up the 8-bit character of a keysym. -To convert a keysym symbol to an 8-bit code, as when that key is -bound to self-insert-command, we will look up the property that this -variable names on the property list of the keysym-symbol. The window- -system-specific code will set up appropriate properties and set this -variable. +This is used to map e.g. `ocircumflex' to the appropriate character under X. +This value of this variable (a symbol, normally `x-iso8859-1' if not nil) +if used to look up a property on the keysym in question, which should +correspond to a character. + +#### This is way bogus and will be removed soon. + +The conversion between X keysyms and characters is now handled more or less +automatically using XDisplayKeycodes(). */ ); Vcharacter_set_property = Qnil; }