Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
1203:5f2f8dcbfb3e | 1204:e22b0213b713 |
---|---|
39 #include "toolbar.h" | 39 #include "toolbar.h" |
40 #include "window.h" | 40 #include "window.h" |
41 | 41 |
42 #include "console-tty-impl.h" /* for stuff in character_to_event */ | 42 #include "console-tty-impl.h" /* for stuff in character_to_event */ |
43 | 43 |
44 #ifdef USE_KKCC | |
45 #include "console-x.h" | |
46 #endif /* USE_KKCC */ | |
47 | |
48 /* Where old events go when they are explicitly deallocated. | 44 /* Where old events go when they are explicitly deallocated. |
49 The event chain here is cut loose before GC, so these will be freed | 45 The event chain here is cut loose before GC, so these will be freed |
50 eventually. | 46 eventually. |
51 */ | 47 */ |
52 static Lisp_Object Vevent_resource; | 48 static Lisp_Object Vevent_resource; |
71 clear_event_resource (void) | 67 clear_event_resource (void) |
72 { | 68 { |
73 Vevent_resource = Qnil; | 69 Vevent_resource = Qnil; |
74 } | 70 } |
75 | 71 |
76 #ifdef USE_KKCC | |
77 /* Make sure we lose quickly if we try to use this event */ | 72 /* Make sure we lose quickly if we try to use this event */ |
78 static void | 73 static void |
79 deinitialize_event (Lisp_Object ev) | 74 deinitialize_event (Lisp_Object ev) |
80 { | 75 { |
81 Lisp_Event *event = XEVENT (ev); | 76 Lisp_Event *event = XEVENT (ev); |
82 | 77 |
78 int i; | |
79 for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++) | |
80 ((int *) event) [i] = 0xdeadbeef; /* -559038737 base 10 */ | |
81 set_lheader_implementation (&event->lheader, &lrecord_event); | |
83 set_event_type (event, dead_event); | 82 set_event_type (event, dead_event); |
84 SET_EVENT_CHANNEL (event, Qnil); | 83 SET_EVENT_CHANNEL (event, Qnil); |
85 set_lheader_implementation (&event->lheader, &lrecord_event); | |
86 XSET_EVENT_NEXT (ev, Qnil); | 84 XSET_EVENT_NEXT (ev, Qnil); |
87 XSET_EVENT_DATA (ev, Qnil); | |
88 } | 85 } |
89 | 86 |
90 /* Set everything to zero or nil so that it's predictable. */ | 87 /* Set everything to zero or nil so that it's predictable. */ |
91 void | 88 void |
92 zero_event (Lisp_Event *e) | 89 zero_event (Lisp_Event *e) |
93 { | 90 { |
94 SET_EVENT_DATA (e, Qnil); | 91 xzero (*e); |
92 set_lheader_implementation (&e->lheader, &lrecord_event); | |
95 set_event_type (e, empty_event); | 93 set_event_type (e, empty_event); |
94 SET_EVENT_CHANNEL (e, Qnil); | |
96 SET_EVENT_NEXT (e, Qnil); | 95 SET_EVENT_NEXT (e, Qnil); |
97 SET_EVENT_CHANNEL (e, Qnil); | 96 } |
98 SET_EVENT_TIMESTAMP_ZERO (e); | 97 |
99 } | 98 static const struct memory_description key_data_description_1 [] = { |
100 | |
101 static const struct lrecord_description event_description [] = { | |
102 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, next) }, | |
103 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, channel) }, | |
104 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, event_data) }, | |
105 { XD_END } | |
106 }; | |
107 | |
108 static Lisp_Object | |
109 mark_event (Lisp_Object obj) | |
110 { | |
111 mark_object (XEVENT_DATA(obj)); | |
112 mark_object (XEVENT_CHANNEL(obj)); | |
113 return (XEVENT_NEXT(obj)); | |
114 } | |
115 | |
116 | |
117 static const struct lrecord_description key_data_description [] = { | |
118 { XD_LISP_OBJECT, offsetof (struct Lisp_Key_Data, keysym) }, | 99 { XD_LISP_OBJECT, offsetof (struct Lisp_Key_Data, keysym) }, |
119 { XD_END } | 100 { XD_END } |
120 }; | 101 }; |
121 | 102 |
122 static Lisp_Object | 103 static const struct sized_memory_description key_data_description = { |
123 mark_key_data (Lisp_Object obj) | 104 sizeof (Lisp_Key_Data), key_data_description_1 |
124 { | 105 }; |
125 return (XKEY_DATA_KEYSYM(obj)); | 106 |
126 } | 107 static const struct memory_description button_data_description_1 [] = { |
127 | |
128 | |
129 static const struct lrecord_description button_data_description [] = { | |
130 { XD_END } | 108 { XD_END } |
131 }; | 109 }; |
132 | 110 |
133 static Lisp_Object | 111 static const struct sized_memory_description button_data_description = { |
134 mark_button_data (Lisp_Object obj) | 112 sizeof (Lisp_Button_Data), button_data_description_1 |
135 { | 113 }; |
136 return Qnil; | 114 |
137 } | 115 static const struct memory_description motion_data_description_1 [] = { |
138 | |
139 | |
140 static const struct lrecord_description motion_data_description [] = { | |
141 { XD_END } | 116 { XD_END } |
142 }; | 117 }; |
143 | 118 |
144 static Lisp_Object | 119 static const struct sized_memory_description motion_data_description = { |
145 mark_motion_data (Lisp_Object obj) | 120 sizeof (Lisp_Motion_Data), motion_data_description_1 |
146 { | 121 }; |
147 return Qnil; | 122 |
148 } | 123 static const struct memory_description process_data_description_1 [] = { |
149 | |
150 | |
151 static const struct lrecord_description process_data_description [] = { | |
152 { XD_LISP_OBJECT, offsetof (struct Lisp_Process_Data, process) }, | 124 { XD_LISP_OBJECT, offsetof (struct Lisp_Process_Data, process) }, |
153 { XD_END } | 125 { XD_END } |
154 }; | 126 }; |
155 | 127 |
156 static Lisp_Object | 128 static const struct sized_memory_description process_data_description = { |
157 mark_process_data (Lisp_Object obj) | 129 sizeof (Lisp_Process_Data), process_data_description_1 |
158 { | 130 }; |
159 return (XPROCESS_DATA_PROCESS(obj)); | 131 |
160 } | 132 static const struct memory_description timeout_data_description_1 [] = { |
161 | |
162 | |
163 static const struct lrecord_description timeout_data_description [] = { | |
164 { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, function) }, | 133 { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, function) }, |
165 { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, object) }, | 134 { XD_LISP_OBJECT, offsetof (struct Lisp_Timeout_Data, object) }, |
166 { XD_END } | 135 { XD_END } |
167 }; | 136 }; |
168 | 137 |
169 static Lisp_Object | 138 static const struct sized_memory_description timeout_data_description = { |
170 mark_timeout_data (Lisp_Object obj) | 139 sizeof (Lisp_Timeout_Data), timeout_data_description_1 |
171 { | 140 }; |
172 mark_object (XTIMEOUT_DATA_FUNCTION(obj)); | 141 |
173 return (XTIMEOUT_DATA_OBJECT(obj)); | 142 static const struct memory_description eval_data_description_1 [] = { |
174 } | |
175 | |
176 | |
177 static const struct lrecord_description eval_data_description [] = { | |
178 { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, function) }, | 143 { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, function) }, |
179 { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, object) }, | 144 { XD_LISP_OBJECT, offsetof (struct Lisp_Eval_Data, object) }, |
180 { XD_END } | 145 { XD_END } |
181 }; | 146 }; |
182 | 147 |
183 static Lisp_Object | 148 static const struct sized_memory_description eval_data_description = { |
184 mark_eval_data (Lisp_Object obj) | 149 sizeof (Lisp_Eval_Data), eval_data_description_1 |
185 { | 150 }; |
186 mark_object (XEVAL_DATA_FUNCTION(obj)); | 151 |
187 return (XEVAL_DATA_OBJECT(obj)); | 152 static const struct memory_description misc_user_data_description_1 [] = { |
188 } | |
189 | |
190 | |
191 static const struct lrecord_description misc_user_data_description [] = { | |
192 { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, function) }, | 153 { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, function) }, |
193 { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, object) }, | 154 { XD_LISP_OBJECT, offsetof (struct Lisp_Misc_User_Data, object) }, |
194 { XD_END } | 155 { XD_END } |
195 }; | 156 }; |
196 | 157 |
197 static Lisp_Object | 158 static const struct sized_memory_description misc_user_data_description = { |
198 mark_misc_user_data (Lisp_Object obj) | 159 sizeof (Lisp_Misc_User_Data), misc_user_data_description_1 |
199 { | 160 }; |
200 mark_object (XMISC_USER_DATA_FUNCTION(obj)); | 161 |
201 return (XMISC_USER_DATA_OBJECT(obj)); | 162 static const struct memory_description magic_eval_data_description_1 [] = { |
202 } | |
203 | |
204 | |
205 static const struct lrecord_description magic_eval_data_description [] = { | |
206 { XD_LISP_OBJECT, offsetof (struct Lisp_Magic_Eval_Data, object) }, | 163 { XD_LISP_OBJECT, offsetof (struct Lisp_Magic_Eval_Data, object) }, |
207 { XD_END } | 164 { XD_END } |
208 }; | 165 }; |
209 | 166 |
210 static Lisp_Object | 167 static const struct sized_memory_description magic_eval_data_description = { |
211 mark_magic_eval_data (Lisp_Object obj) | 168 sizeof (Lisp_Magic_Eval_Data), magic_eval_data_description_1 |
212 { | 169 }; |
213 return (XMAGIC_EVAL_DATA_OBJECT(obj)); | 170 |
214 } | 171 static const struct memory_description magic_data_description_1 [] = { |
215 | |
216 | |
217 static const struct lrecord_description magic_data_description [] = { | |
218 { XD_END } | 172 { XD_END } |
219 }; | 173 }; |
220 | 174 |
175 static const struct sized_memory_description magic_data_description = { | |
176 sizeof (Lisp_Magic_Data), magic_data_description_1 | |
177 }; | |
178 | |
179 static const struct memory_description event_data_description_1 [] = { | |
180 { XD_STRUCT_ARRAY, key_press_event, 1, &key_data_description }, | |
181 { XD_STRUCT_ARRAY, button_press_event, 1, &button_data_description }, | |
182 { XD_STRUCT_ARRAY, button_release_event, 1, &button_data_description }, | |
183 { XD_STRUCT_ARRAY, pointer_motion_event, 1, &motion_data_description }, | |
184 { XD_STRUCT_ARRAY, process_event, 1, &process_data_description }, | |
185 { XD_STRUCT_ARRAY, timeout_event, 1, &timeout_data_description }, | |
186 { XD_STRUCT_ARRAY, magic_event, 1, &magic_data_description }, | |
187 { XD_STRUCT_ARRAY, magic_eval_event, 1, &magic_eval_data_description }, | |
188 { XD_STRUCT_ARRAY, eval_event, 1, &eval_data_description }, | |
189 { XD_STRUCT_ARRAY, misc_user_event, 1, &misc_user_data_description }, | |
190 { XD_END } | |
191 }; | |
192 | |
193 static const struct sized_memory_description event_data_description = { | |
194 0, event_data_description_1 | |
195 }; | |
196 | |
197 static const struct memory_description event_description [] = { | |
198 { XD_INT, offsetof (struct Lisp_Event, event_type) }, | |
199 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, next) }, | |
200 { XD_LISP_OBJECT, offsetof (struct Lisp_Event, channel) }, | |
201 { XD_UNION, offsetof (struct Lisp_Event, event), | |
202 XD_INDIRECT (0, 0), &event_data_description }, | |
203 { XD_END } | |
204 }; | |
205 | |
206 #ifdef EVENT_DATA_AS_OBJECTS | |
207 | |
208 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("key-data", key_data, | |
209 0, /*dumpable-flag*/ | |
210 0, 0, 0, 0, 0, | |
211 key_data_description, | |
212 Lisp_Key_Data); | |
213 | |
214 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("button-data", button_data, | |
215 0, /*dumpable-flag*/ | |
216 0, 0, 0, 0, 0, | |
217 button_data_description, | |
218 Lisp_Button_Data); | |
219 | |
220 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("motion-data", motion_data, | |
221 0, /*dumpable-flag*/ | |
222 0, 0, 0, 0, 0, | |
223 motion_data_description, | |
224 Lisp_Motion_Data); | |
225 | |
226 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("process-data", process_data, | |
227 0, /*dumpable-flag*/ | |
228 0, 0, 0, 0, 0, | |
229 process_data_description, | |
230 Lisp_Process_Data); | |
231 | |
232 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("timeout-data", timeout_data, | |
233 0, /*dumpable-flag*/ | |
234 0, 0, 0, 0, 0, | |
235 timeout_data_description, | |
236 Lisp_Timeout_Data); | |
237 | |
238 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("eval-data", eval_data, | |
239 0, /*dumpable-flag*/ | |
240 0, 0, 0, 0, 0, | |
241 eval_data_description, | |
242 Lisp_Eval_Data); | |
243 | |
244 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("misc-user-data", misc_user_data, | |
245 0, /*dumpable-flag*/ | |
246 0, 0, 0, 0, 0, | |
247 misc_user_data_description, | |
248 Lisp_Misc_User_Data); | |
249 | |
250 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("magic-eval-data", magic_eval_data, | |
251 0, /*dumpable-flag*/ | |
252 0, 0, 0, 0, 0, | |
253 magic_eval_data_description, | |
254 Lisp_Magic_Eval_Data); | |
255 | |
256 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("magic-data", magic_data, | |
257 0, /*dumpable-flag*/ | |
258 0, 0, 0, 0, 0, | |
259 magic_data_description, | |
260 Lisp_Magic_Data); | |
261 | |
262 #endif /* EVENT_DATA_AS_OBJECTS */ | |
263 | |
221 static Lisp_Object | 264 static Lisp_Object |
222 mark_magic_data (Lisp_Object obj) | 265 mark_event (Lisp_Object obj) |
223 { | 266 { |
224 return Qnil; | 267 Lisp_Event *event = XEVENT (obj); |
225 } | 268 |
226 | 269 switch (event->event_type) |
227 | |
228 | |
229 static void | |
230 print_event (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
231 { | |
232 if (print_readably) | |
233 printing_unreadable_object ("#<event>"); | |
234 | |
235 switch (XEVENT_TYPE (obj)) | |
236 { | 270 { |
237 case key_press_event: | 271 case key_press_event: |
238 write_c_string (printcharfun, "#<keypress-event "); | 272 mark_object (EVENT_KEY_KEYSYM (event)); |
239 break; | |
240 case button_press_event: | |
241 write_c_string (printcharfun, "#<buttondown-event "); | |
242 break; | |
243 case button_release_event: | |
244 write_c_string (printcharfun, "#<buttonup-event "); | |
245 break; | |
246 case magic_eval_event: | |
247 write_c_string (printcharfun, "#<magic-eval-event "); | |
248 break; | |
249 case magic_event: | |
250 write_c_string (printcharfun, "#<magic-event "); | |
251 break; | |
252 case pointer_motion_event: | |
253 write_c_string (printcharfun, "#<motion-event "); | |
254 break; | 273 break; |
255 case process_event: | 274 case process_event: |
256 write_c_string (printcharfun, "#<process-event "); | 275 mark_object (EVENT_PROCESS_PROCESS (event)); |
257 break; | |
258 case timeout_event: | |
259 write_c_string (printcharfun, "#<timeout-event "); | |
260 break; | |
261 case misc_user_event: | |
262 write_c_string (printcharfun, "#<misc-user-event "); | |
263 break; | |
264 case eval_event: | |
265 write_c_string (printcharfun, "#<eval-event "); | |
266 break; | |
267 case empty_event: | |
268 write_c_string (printcharfun, "#<empty-event>"); | |
269 return; | |
270 case dead_event: | |
271 write_c_string (printcharfun, "#<DEALLOCATED-EVENT>"); | |
272 return; | |
273 default: | |
274 write_c_string (printcharfun, "#<UNKNOWN-EVENT-TYPE>"); | |
275 return; | |
276 } | |
277 | |
278 print_internal (XEVENT_DATA (obj), printcharfun, 1); | |
279 write_c_string (printcharfun, ">"); | |
280 } | |
281 | |
282 | |
283 static void | |
284 print_key_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
285 { | |
286 char buf[128]; | |
287 if (print_readably) | |
288 printing_unreadable_object ("#<key_data>"); | |
289 | |
290 sprintf (buf, "#<key_data "); | |
291 /* format_event_data_object (buf + 11, obj, 0); | |
292 sprintf (buf + strlen (buf), ">"); | |
293 write_c_string (printcharfun, buf);*/ | |
294 } | |
295 | |
296 static void | |
297 print_button_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
298 { | |
299 char buf[128]; | |
300 if (print_readably) | |
301 printing_unreadable_object ("#<button_data>"); | |
302 | |
303 sprintf (buf, "#<button_data "); | |
304 /* format_event_data_object (buf + 14, obj, 0); | |
305 sprintf (buf + strlen (buf), ">"); | |
306 write_c_string (printcharfun, buf);*/ | |
307 } | |
308 | |
309 | |
310 static void | |
311 print_motion_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
312 { | |
313 char buf[64]; | |
314 | |
315 if (print_readably) | |
316 printing_unreadable_object ("#<motion_data>"); | |
317 | |
318 sprintf (buf, "#<motion-data %ld, %ld>", | |
319 (long) XMOTION_DATA_X (obj), | |
320 (long) XMOTION_DATA_Y (obj)); | |
321 write_c_string (printcharfun, buf); | |
322 } | |
323 | |
324 | |
325 static void | |
326 print_process_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
327 { | |
328 if (print_readably) | |
329 printing_unreadable_object ("#<process_data>"); | |
330 | |
331 write_c_string (printcharfun, "#<process-data "); | |
332 print_internal (XPROCESS_DATA_PROCESS (obj), printcharfun, 1); | |
333 write_c_string (printcharfun, ">"); | |
334 } | |
335 | |
336 | |
337 static void | |
338 print_timeout_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
339 { | |
340 if (print_readably) | |
341 printing_unreadable_object ("#<timeout_data>"); | |
342 | |
343 write_c_string (printcharfun, "#<timeout-data "); | |
344 print_internal (XTIMEOUT_DATA_OBJECT (obj), printcharfun, 1); | |
345 write_c_string (printcharfun, ">"); | |
346 } | |
347 | |
348 | |
349 static void | |
350 print_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
351 { | |
352 if (print_readably) | |
353 printing_unreadable_object ("#<eval_data>"); | |
354 | |
355 write_c_string (printcharfun, "#<eval-data "); | |
356 print_internal (XEVAL_DATA_FUNCTION (obj), printcharfun, 1); | |
357 write_c_string (printcharfun, " "); | |
358 print_internal (XEVAL_DATA_OBJECT (obj), printcharfun, 1); | |
359 write_c_string (printcharfun, ">"); | |
360 } | |
361 | |
362 | |
363 static void | |
364 print_misc_user_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
365 { | |
366 if (print_readably) | |
367 printing_unreadable_object ("#<misc_user_data>"); | |
368 | |
369 write_c_string (printcharfun, "#<misc-user-data "); | |
370 print_internal (XMISC_USER_DATA_FUNCTION (obj), printcharfun, 1); | |
371 write_c_string (printcharfun, " "); | |
372 print_internal (XMISC_USER_DATA_OBJECT (obj), printcharfun, 1); | |
373 write_c_string (printcharfun, ">"); | |
374 } | |
375 | |
376 | |
377 static void | |
378 print_magic_eval_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
379 { | |
380 // char buf[128]; | |
381 | |
382 if (print_readably) | |
383 printing_unreadable_object ("#<magic_eval_data>"); | |
384 | |
385 /* format_event_data_object (buf + 18, obj, 0);*/ | |
386 } | |
387 | |
388 | |
389 static void | |
390 print_magic_data (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
391 { | |
392 char buf[128]; | |
393 | |
394 if (print_readably) | |
395 printing_unreadable_object ("#<magic_data>"); | |
396 | |
397 sprintf (buf, "#<magic-data "); | |
398 /* format_event_data_object (buf + 13, obj, 0); | |
399 sprintf (buf + strlen (buf), ">"); | |
400 write_c_string (print_readably, buf);*/ | |
401 } | |
402 | |
403 | |
404 static int | |
405 event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
406 { | |
407 Lisp_Event *e1 = XEVENT (obj1); | |
408 Lisp_Event *e2 = XEVENT (obj2); | |
409 | |
410 if (EVENT_TYPE (e1) != EVENT_TYPE (e2)) return 0; | |
411 if (!EQ (EVENT_CHANNEL (e1), EVENT_CHANNEL (e2))) return 0; | |
412 /* if (EVENT_TIMESTAMP (e1) != EVENT_TIMESTAMP (e2)) return 0; */ | |
413 switch (EVENT_TYPE (e1)) | |
414 { | |
415 default: abort (); | |
416 | |
417 case process_event: | |
418 case timeout_event: | |
419 case pointer_motion_event: | |
420 case key_press_event: | |
421 case button_press_event: | |
422 case button_release_event: | |
423 case misc_user_event: | |
424 case eval_event: | |
425 case magic_eval_event: | |
426 return internal_equal (EVENT_DATA (e1), EVENT_DATA (e2), 0); | |
427 | |
428 case magic_event: | |
429 { | |
430 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1))); | |
431 | |
432 #ifdef HAVE_X_WINDOWS | |
433 if (CONSOLE_X_P (con)) | |
434 return (XMAGIC_DATA_X_EVENT (EVENT_DATA (e1)).xany.serial == | |
435 XMAGIC_DATA_X_EVENT (EVENT_DATA (e2)).xany.serial); | |
436 #endif | |
437 #ifdef HAVE_GTK | |
438 if (CONSOLE_GTK_P (con)) | |
439 return (XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e1)) == | |
440 XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e2))); | |
441 #endif | |
442 #ifdef HAVE_MS_WINDOWS | |
443 if (CONSOLE_MSWINDOWS_P (con)) | |
444 return (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e1)) == | |
445 XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e2))); | |
446 #endif | |
447 abort (); | |
448 return 1; /* not reached */ | |
449 } | |
450 | |
451 case empty_event: /* Empty and deallocated events are equal. */ | |
452 case dead_event: | |
453 return 1; | |
454 } | |
455 } | |
456 | |
457 static int | |
458 key_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
459 { | |
460 return (EQ (XKEY_DATA_KEYSYM (obj1), XKEY_DATA_KEYSYM (obj2)) && | |
461 (XKEY_DATA_MODIFIERS (obj1) == XKEY_DATA_MODIFIERS (obj2))); | |
462 } | |
463 | |
464 static int | |
465 button_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
466 { | |
467 return (XBUTTON_DATA_BUTTON (obj1) == XBUTTON_DATA_BUTTON (obj2) && | |
468 XBUTTON_DATA_MODIFIERS (obj1) == XBUTTON_DATA_MODIFIERS (obj2)); | |
469 } | |
470 | |
471 static int | |
472 motion_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
473 { | |
474 return (XMOTION_DATA_X (obj1) == XMOTION_DATA_X (obj2) && | |
475 XMOTION_DATA_Y (obj1) == XMOTION_DATA_Y (obj2)); | |
476 } | |
477 | |
478 static int | |
479 process_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
480 { | |
481 return EQ (XPROCESS_DATA_PROCESS (obj1), XPROCESS_DATA_PROCESS (obj2)); | |
482 } | |
483 | |
484 static int | |
485 timeout_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
486 { | |
487 return (internal_equal (XTIMEOUT_DATA_FUNCTION (obj1), | |
488 XTIMEOUT_DATA_FUNCTION (obj2), 0) && | |
489 internal_equal (XTIMEOUT_DATA_OBJECT (obj1), | |
490 XTIMEOUT_DATA_OBJECT (obj2), 0)); | |
491 } | |
492 | |
493 static int | |
494 eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
495 { | |
496 return (internal_equal (XEVAL_DATA_FUNCTION (obj1), | |
497 XEVAL_DATA_FUNCTION (obj2), 0) && | |
498 internal_equal (XEVAL_DATA_OBJECT (obj1), | |
499 XEVAL_DATA_OBJECT (obj2), 0)); | |
500 } | |
501 | |
502 static int | |
503 misc_user_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
504 { | |
505 return (internal_equal (XMISC_USER_DATA_FUNCTION (obj1), | |
506 XMISC_USER_DATA_FUNCTION (obj2), 0) && | |
507 internal_equal (XMISC_USER_DATA_OBJECT (obj1), | |
508 XMISC_USER_DATA_OBJECT (obj2), 0) && | |
509 /* is this really needed for equality | |
510 or is x and y also important? */ | |
511 XMISC_USER_DATA_BUTTON (obj1) == XMISC_USER_DATA_BUTTON (obj2) && | |
512 XMISC_USER_DATA_MODIFIERS (obj1) == | |
513 XMISC_USER_DATA_MODIFIERS (obj2)); | |
514 } | |
515 | |
516 static int | |
517 magic_eval_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
518 { | |
519 return (XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj1) == | |
520 XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj2) && | |
521 internal_equal (XMAGIC_EVAL_DATA_OBJECT (obj1), | |
522 XMAGIC_EVAL_DATA_OBJECT (obj2), 0)); | |
523 } | |
524 | |
525 static int | |
526 magic_data_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
527 {assert (0); return 0;} | |
528 | |
529 static unsigned long | |
530 event_hash (Lisp_Object obj, int depth) | |
531 { | |
532 Lisp_Event *e = XEVENT (obj); | |
533 unsigned long hash; | |
534 | |
535 hash = HASH2 (EVENT_TYPE (e), LISP_HASH (EVENT_CHANNEL (e))); | |
536 switch (EVENT_TYPE (e)) | |
537 { | |
538 case process_event: | |
539 case timeout_event: | |
540 case key_press_event: | |
541 case button_press_event: | |
542 case button_release_event: | |
543 case pointer_motion_event: | |
544 case misc_user_event: | |
545 case eval_event: | |
546 case magic_eval_event: | |
547 return HASH2 (hash, internal_hash (EVENT_DATA (e), depth + 1)); | |
548 | |
549 case magic_event: | |
550 { | |
551 struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e))); | |
552 #ifdef HAVE_X_WINDOWS | |
553 if (CONSOLE_X_P (con)) | |
554 return HASH2 (hash, XMAGIC_DATA_X_EVENT (EVENT_DATA (e)).xany.serial); | |
555 #endif | |
556 #ifdef HAVE_GTK | |
557 if (CONSOLE_GTK_P (con)) | |
558 return HASH2 (hash, XMAGIC_DATA_GTK_EVENT (EVENT_DATA (e))); | |
559 #endif | |
560 #ifdef HAVE_MS_WINDOWS | |
561 if (CONSOLE_MSWINDOWS_P (con)) | |
562 return HASH2 (hash, XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e))); | |
563 #endif | |
564 abort (); | |
565 return 0; | |
566 } | |
567 | |
568 case empty_event: | |
569 case dead_event: | |
570 return hash; | |
571 | |
572 default: | |
573 abort (); | |
574 } | |
575 | |
576 return 0; /* unreached */ | |
577 } | |
578 | |
579 static unsigned long | |
580 key_data_hash (Lisp_Object obj, int depth) | |
581 { | |
582 return HASH2 (LISP_HASH (XKEY_DATA_KEYSYM (obj)), | |
583 XKEY_DATA_MODIFIERS (obj)); | |
584 } | |
585 | |
586 static unsigned long | |
587 button_data_hash (Lisp_Object obj, int depth) | |
588 { | |
589 return HASH2 (XBUTTON_DATA_BUTTON (obj), XBUTTON_DATA_MODIFIERS (obj)); | |
590 } | |
591 | |
592 static unsigned long | |
593 motion_data_hash (Lisp_Object obj, int depth) | |
594 { | |
595 return HASH2 (XMOTION_DATA_X (obj), XMOTION_DATA_Y (obj)); | |
596 } | |
597 | |
598 static unsigned long | |
599 process_data_hash (Lisp_Object obj, int depth) | |
600 { | |
601 return LISP_HASH (XPROCESS_DATA_PROCESS (obj)); | |
602 } | |
603 | |
604 static unsigned long | |
605 timeout_data_hash (Lisp_Object obj, int depth) | |
606 { | |
607 return HASH2 (internal_hash (XTIMEOUT_DATA_FUNCTION (obj), depth + 1), | |
608 internal_hash (XTIMEOUT_DATA_OBJECT (obj), depth + 1)); | |
609 } | |
610 | |
611 static unsigned long | |
612 eval_data_hash (Lisp_Object obj, int depth) | |
613 { | |
614 return HASH2 (internal_hash (XEVAL_DATA_FUNCTION (obj), depth + 1), | |
615 internal_hash (XEVAL_DATA_OBJECT (obj), depth + 1)); | |
616 } | |
617 | |
618 static unsigned long | |
619 misc_user_data_hash (Lisp_Object obj, int depth) | |
620 { | |
621 return HASH4 (internal_hash (XMISC_USER_DATA_FUNCTION (obj), depth + 1), | |
622 internal_hash (XMISC_USER_DATA_OBJECT (obj), depth + 1), | |
623 XMISC_USER_DATA_BUTTON (obj), XMISC_USER_DATA_MODIFIERS (obj)); | |
624 } | |
625 | |
626 static unsigned long | |
627 magic_eval_data_hash (Lisp_Object obj, int depth) | |
628 { | |
629 return HASH2 ((unsigned long) XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (obj), | |
630 internal_hash (XMAGIC_EVAL_DATA_OBJECT (obj), depth + 1)); | |
631 } | |
632 | |
633 static unsigned long | |
634 magic_data_hash (Lisp_Object obj, int depth) | |
635 {assert(0); return 1;} | |
636 | |
637 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("key-data", key_data, | |
638 0, /*dumpable-flag*/ | |
639 mark_key_data, | |
640 print_key_data, 0, | |
641 key_data_equal, key_data_hash, | |
642 key_data_description, | |
643 Lisp_Key_Data); | |
644 | |
645 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("button-data", button_data, | |
646 0, /*dumpable-flag*/ | |
647 mark_button_data, print_button_data, 0, | |
648 button_data_equal, button_data_hash, | |
649 button_data_description, | |
650 Lisp_Button_Data); | |
651 | |
652 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("motion-data", motion_data, | |
653 0, /*dumpable-flag*/ | |
654 mark_motion_data, print_motion_data, 0, | |
655 motion_data_equal, motion_data_hash, | |
656 motion_data_description, | |
657 Lisp_Motion_Data); | |
658 | |
659 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("process-data", process_data, | |
660 0, /*dumpable-flag*/ | |
661 mark_process_data, | |
662 print_process_data, 0, | |
663 process_data_equal, process_data_hash, | |
664 process_data_description, | |
665 Lisp_Process_Data); | |
666 | |
667 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("timeout-data", timeout_data, | |
668 0, /*dumpable-flag*/ | |
669 mark_timeout_data, | |
670 print_timeout_data, 0, | |
671 timeout_data_equal, timeout_data_hash, | |
672 timeout_data_description, | |
673 Lisp_Timeout_Data); | |
674 | |
675 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("eval-data", eval_data, | |
676 0, /*dumpable-flag*/ | |
677 mark_eval_data, | |
678 print_eval_data, 0, | |
679 eval_data_equal, eval_data_hash, | |
680 eval_data_description, | |
681 Lisp_Eval_Data); | |
682 | |
683 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("misc-user-data", misc_user_data, | |
684 0, /*dumpable-flag*/ | |
685 mark_misc_user_data, | |
686 print_misc_user_data, | |
687 0, misc_user_data_equal, | |
688 misc_user_data_hash, | |
689 misc_user_data_description, | |
690 Lisp_Misc_User_Data); | |
691 | |
692 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("magic-eval-data", magic_eval_data, | |
693 0, /*dumpable-flag*/ | |
694 mark_magic_eval_data, | |
695 print_magic_eval_data, 0, | |
696 magic_eval_data_equal, | |
697 magic_eval_data_hash, | |
698 magic_eval_data_description, | |
699 Lisp_Magic_Eval_Data); | |
700 | |
701 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("magic-data", magic_data, | |
702 0, /*dumpable-flag*/ | |
703 mark_magic_data, print_magic_data, 0, | |
704 magic_data_equal, magic_data_hash, | |
705 magic_data_description, | |
706 Lisp_Magic_Data); | |
707 | |
708 | |
709 | |
710 #else /* not USE_KKCC */ | |
711 /* Make sure we lose quickly if we try to use this event */ | |
712 static void | |
713 deinitialize_event (Lisp_Object ev) | |
714 { | |
715 int i; | |
716 Lisp_Event *event = XEVENT (ev); | |
717 | |
718 for (i = 0; i < (int) (sizeof (Lisp_Event) / sizeof (int)); i++) | |
719 ((int *) event) [i] = 0xdeadbeef; | |
720 event->event_type = dead_event; | |
721 event->channel = Qnil; | |
722 set_lheader_implementation (&event->lheader, &lrecord_event); | |
723 XSET_EVENT_NEXT (ev, Qnil); | |
724 } | |
725 | |
726 /* Set everything to zero or nil so that it's predictable. */ | |
727 void | |
728 zero_event (Lisp_Event *e) | |
729 { | |
730 xzero (*e); | |
731 set_lheader_implementation (&e->lheader, &lrecord_event); | |
732 e->event_type = empty_event; | |
733 e->next = Qnil; | |
734 e->channel = Qnil; | |
735 } | |
736 | |
737 static Lisp_Object | |
738 mark_event (Lisp_Object obj) | |
739 { | |
740 Lisp_Event *event = XEVENT (obj); | |
741 | |
742 switch (event->event_type) | |
743 { | |
744 case key_press_event: | |
745 mark_object (event->event.key.keysym); | |
746 break; | |
747 case process_event: | |
748 mark_object (event->event.process.process); | |
749 break; | 276 break; |
750 case timeout_event: | 277 case timeout_event: |
751 mark_object (event->event.timeout.function); | 278 mark_object (EVENT_TIMEOUT_FUNCTION (event)); |
752 mark_object (event->event.timeout.object); | 279 mark_object (EVENT_TIMEOUT_OBJECT (event)); |
753 break; | 280 break; |
754 case eval_event: | 281 case eval_event: |
755 case misc_user_event: | 282 case misc_user_event: |
756 mark_object (event->event.eval.function); | 283 mark_object (EVENT_EVAL_FUNCTION (event)); |
757 mark_object (event->event.eval.object); | 284 mark_object (EVENT_EVAL_OBJECT (event)); |
758 break; | 285 break; |
759 case magic_eval_event: | 286 case magic_eval_event: |
760 mark_object (event->event.magic_eval.object); | 287 mark_object (EVENT_MAGIC_EVAL_OBJECT (event)); |
761 break; | 288 break; |
762 case button_press_event: | 289 case button_press_event: |
763 case button_release_event: | 290 case button_release_event: |
764 case pointer_motion_event: | 291 case pointer_motion_event: |
765 case magic_event: | 292 case magic_event: |
776 static void | 303 static void |
777 print_event_1 (const char *str, Lisp_Object obj, Lisp_Object printcharfun) | 304 print_event_1 (const char *str, Lisp_Object obj, Lisp_Object printcharfun) |
778 { | 305 { |
779 DECLARE_EISTRING_MALLOC (ei); | 306 DECLARE_EISTRING_MALLOC (ei); |
780 write_c_string (printcharfun, str); | 307 write_c_string (printcharfun, str); |
781 format_event_object (ei, XEVENT (obj), 0); | 308 format_event_object (ei, obj, 0); |
782 write_eistring (printcharfun, ei); | 309 write_eistring (printcharfun, ei); |
783 eifree (ei); | 310 eifree (ei); |
784 } | 311 } |
785 | 312 |
786 static void | 313 static void |
814 write_fmt_string (printcharfun, "#<motion-event %ld, %ld", | 341 write_fmt_string (printcharfun, "#<motion-event %ld, %ld", |
815 (long) XINT (Vx), (long) XINT (Vy)); | 342 (long) XINT (Vx), (long) XINT (Vy)); |
816 break; | 343 break; |
817 } | 344 } |
818 case process_event: | 345 case process_event: |
819 write_fmt_string_lisp (printcharfun, "#<process-event %S", 1, XEVENT (obj)->event.process.process); | 346 write_fmt_string_lisp (printcharfun, "#<process-event %S", 1, |
347 XEVENT_PROCESS_PROCESS (obj)); | |
820 break; | 348 break; |
821 case timeout_event: | 349 case timeout_event: |
822 write_fmt_string_lisp (printcharfun, "#<timeout-event %S", 1, XEVENT (obj)->event.timeout.object); | 350 write_fmt_string_lisp (printcharfun, "#<timeout-event %S", 1, |
351 XEVENT_TIMEOUT_OBJECT (obj)); | |
823 break; | 352 break; |
824 case empty_event: | 353 case empty_event: |
825 write_c_string (printcharfun, "#<empty-event"); | 354 write_c_string (printcharfun, "#<empty-event"); |
826 break; | 355 break; |
827 case misc_user_event: | 356 case misc_user_event: |
828 write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S", 1, XEVENT (obj)->event.misc.function); | 357 write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S", 1, |
829 write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.misc.object); | 358 XEVENT_MISC_USER_FUNCTION (obj)); |
359 write_fmt_string_lisp (printcharfun, " %S)", 1, | |
360 XEVENT_MISC_USER_OBJECT (obj)); | |
830 break; | 361 break; |
831 case eval_event: | 362 case eval_event: |
832 write_fmt_string_lisp (printcharfun, "#<eval-event (%S", 1, XEVENT (obj)->event.eval.function); | 363 write_fmt_string_lisp (printcharfun, "#<eval-event (%S", 1, |
833 write_fmt_string_lisp (printcharfun, " %S)", 1, XEVENT (obj)->event.eval.object); | 364 XEVENT_EVAL_FUNCTION (obj)); |
365 write_fmt_string_lisp (printcharfun, " %S)", 1, | |
366 XEVENT_EVAL_OBJECT (obj)); | |
834 break; | 367 break; |
835 case dead_event: | 368 case dead_event: |
836 write_c_string (printcharfun, "#<DEALLOCATED-EVENT"); | 369 write_c_string (printcharfun, "#<DEALLOCATED-EVENT"); |
837 break; | 370 break; |
838 default: | 371 default: |
854 switch (e1->event_type) | 387 switch (e1->event_type) |
855 { | 388 { |
856 default: abort (); | 389 default: abort (); |
857 | 390 |
858 case process_event: | 391 case process_event: |
859 return EQ (e1->event.process.process, e2->event.process.process); | 392 return EQ (EVENT_PROCESS_PROCESS (e1), EVENT_PROCESS_PROCESS (e2)); |
860 | 393 |
861 case timeout_event: | 394 case timeout_event: |
862 return (internal_equal (e1->event.timeout.function, | 395 return (internal_equal (EVENT_TIMEOUT_FUNCTION (e1), |
863 e2->event.timeout.function, 0) && | 396 EVENT_TIMEOUT_FUNCTION (e2), 0) && |
864 internal_equal (e1->event.timeout.object, | 397 internal_equal (EVENT_TIMEOUT_OBJECT (e1), |
865 e2->event.timeout.object, 0)); | 398 EVENT_TIMEOUT_OBJECT (e2), 0)); |
866 | 399 |
867 case key_press_event: | 400 case key_press_event: |
868 return (EQ (e1->event.key.keysym, e2->event.key.keysym) && | 401 return (EQ (EVENT_KEY_KEYSYM (e1), EVENT_KEY_KEYSYM (e2)) && |
869 (e1->event.key.modifiers == e2->event.key.modifiers)); | 402 (EVENT_KEY_MODIFIERS (e1) == EVENT_KEY_MODIFIERS (e2))); |
870 | 403 |
871 case button_press_event: | 404 case button_press_event: |
872 case button_release_event: | 405 case button_release_event: |
873 return (e1->event.button.button == e2->event.button.button && | 406 return (EVENT_BUTTON_BUTTON (e1) == EVENT_BUTTON_BUTTON (e2) && |
874 e1->event.button.modifiers == e2->event.button.modifiers); | 407 EVENT_BUTTON_MODIFIERS (e1) == EVENT_BUTTON_MODIFIERS (e2)); |
875 | 408 |
876 case pointer_motion_event: | 409 case pointer_motion_event: |
877 return (e1->event.motion.x == e2->event.motion.x && | 410 return (EVENT_MOTION_X (e1) == EVENT_MOTION_X (e2) && |
878 e1->event.motion.y == e2->event.motion.y); | 411 EVENT_MOTION_Y (e1) == EVENT_MOTION_Y (e2)); |
879 | 412 |
880 case misc_user_event: | 413 case misc_user_event: |
881 return (internal_equal (e1->event.eval.function, | 414 return (internal_equal (EVENT_EVAL_FUNCTION (e1), |
882 e2->event.eval.function, 0) && | 415 EVENT_EVAL_FUNCTION (e2), 0) && |
883 internal_equal (e1->event.eval.object, | 416 internal_equal (EVENT_EVAL_OBJECT (e1), |
884 e2->event.eval.object, 0) && | 417 EVENT_EVAL_OBJECT (e2), 0) && |
885 /* is this really needed for equality | 418 /* #### is this really needed for equality |
886 or is x and y also important? */ | 419 or is x and y also important? */ |
887 e1->event.misc.button == e2->event.misc.button && | 420 EVENT_MISC_USER_BUTTON (e1) == EVENT_MISC_USER_BUTTON (e2) && |
888 e1->event.misc.modifiers == e2->event.misc.modifiers); | 421 EVENT_MISC_USER_MODIFIERS (e1) == EVENT_MISC_USER_MODIFIERS (e2)); |
889 | 422 |
890 case eval_event: | 423 case eval_event: |
891 return (internal_equal (e1->event.eval.function, | 424 return (internal_equal (EVENT_EVAL_FUNCTION (e1), |
892 e2->event.eval.function, 0) && | 425 EVENT_EVAL_FUNCTION (e2), 0) && |
893 internal_equal (e1->event.eval.object, | 426 internal_equal (EVENT_EVAL_OBJECT (e1), |
894 e2->event.eval.object, 0)); | 427 EVENT_EVAL_OBJECT (e2), 0)); |
895 | 428 |
896 case magic_eval_event: | 429 case magic_eval_event: |
897 return (e1->event.magic_eval.internal_function == | 430 return (EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (e1) == |
898 e2->event.magic_eval.internal_function && | 431 EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (e2) && |
899 internal_equal (e1->event.magic_eval.object, | 432 internal_equal (EVENT_MAGIC_EVAL_OBJECT (e1), |
900 e2->event.magic_eval.object, 0)); | 433 EVENT_MAGIC_EVAL_OBJECT (e2), 0)); |
901 | 434 |
902 case magic_event: | 435 case magic_event: |
903 return event_stream_compare_magic_event (e1, e2); | 436 return event_stream_compare_magic_event (e1, e2); |
904 | 437 |
905 case empty_event: /* Empty and deallocated events are equal. */ | 438 case empty_event: /* Empty and deallocated events are equal. */ |
916 | 449 |
917 hash = HASH2 (e->event_type, LISP_HASH (e->channel)); | 450 hash = HASH2 (e->event_type, LISP_HASH (e->channel)); |
918 switch (e->event_type) | 451 switch (e->event_type) |
919 { | 452 { |
920 case process_event: | 453 case process_event: |
921 return HASH2 (hash, LISP_HASH (e->event.process.process)); | 454 return HASH2 (hash, LISP_HASH (EVENT_PROCESS_PROCESS (e))); |
922 | 455 |
923 case timeout_event: | 456 case timeout_event: |
924 return HASH3 (hash, internal_hash (e->event.timeout.function, depth + 1), | 457 return HASH3 (hash, |
925 internal_hash (e->event.timeout.object, depth + 1)); | 458 internal_hash (EVENT_TIMEOUT_FUNCTION (e), depth + 1), |
459 internal_hash (EVENT_TIMEOUT_OBJECT (e), depth + 1)); | |
926 | 460 |
927 case key_press_event: | 461 case key_press_event: |
928 return HASH3 (hash, LISP_HASH (e->event.key.keysym), | 462 return HASH3 (hash, LISP_HASH (EVENT_KEY_KEYSYM (e)), |
929 e->event.key.modifiers); | 463 EVENT_KEY_MODIFIERS (e)); |
930 | 464 |
931 case button_press_event: | 465 case button_press_event: |
932 case button_release_event: | 466 case button_release_event: |
933 return HASH3 (hash, e->event.button.button, e->event.button.modifiers); | 467 return HASH3 (hash, EVENT_BUTTON_BUTTON (e), EVENT_BUTTON_MODIFIERS (e)); |
934 | 468 |
935 case pointer_motion_event: | 469 case pointer_motion_event: |
936 return HASH3 (hash, e->event.motion.x, e->event.motion.y); | 470 return HASH3 (hash, EVENT_MOTION_X (e), EVENT_MOTION_Y (e)); |
937 | 471 |
938 case misc_user_event: | 472 case misc_user_event: |
939 return HASH5 (hash, internal_hash (e->event.misc.function, depth + 1), | 473 return HASH5 (hash, |
940 internal_hash (e->event.misc.object, depth + 1), | 474 internal_hash (EVENT_MISC_USER_FUNCTION (e), depth + 1), |
941 e->event.misc.button, e->event.misc.modifiers); | 475 internal_hash (EVENT_MISC_USER_OBJECT (e), depth + 1), |
476 EVENT_MISC_USER_BUTTON (e), EVENT_MISC_USER_MODIFIERS (e)); | |
942 | 477 |
943 case eval_event: | 478 case eval_event: |
944 return HASH3 (hash, internal_hash (e->event.eval.function, depth + 1), | 479 return HASH3 (hash, internal_hash (EVENT_EVAL_FUNCTION (e), depth + 1), |
945 internal_hash (e->event.eval.object, depth + 1)); | 480 internal_hash (EVENT_EVAL_OBJECT (e), depth + 1)); |
946 | 481 |
947 case magic_eval_event: | 482 case magic_eval_event: |
948 return HASH3 (hash, | 483 return HASH3 (hash, |
949 (Hashcode) e->event.magic_eval.internal_function, | 484 (Hashcode) EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (e), |
950 internal_hash (e->event.magic_eval.object, depth + 1)); | 485 internal_hash (EVENT_MAGIC_EVAL_OBJECT (e), depth + 1)); |
951 | 486 |
952 case magic_event: | 487 case magic_event: |
953 return HASH2 (hash, event_stream_hash_magic_event (e)); | 488 return HASH2 (hash, event_stream_hash_magic_event (e)); |
954 | 489 |
955 case empty_event: | 490 case empty_event: |
960 abort (); | 495 abort (); |
961 } | 496 } |
962 | 497 |
963 return 0; /* unreached */ | 498 return 0; /* unreached */ |
964 } | 499 } |
965 #endif /* not USE_KKCC */ | 500 |
966 | |
967 | |
968 #ifdef USE_KKCC | |
969 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event, | 501 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event, |
970 0, /*dumpable-flag*/ | 502 0, /*dumpable-flag*/ |
971 mark_event, print_event, 0, event_equal, | 503 mark_event, print_event, 0, event_equal, |
972 event_hash, 0/*event_description*/, Lisp_Event); | 504 event_hash, event_description, |
973 #else /* not USE_KKCC */ | 505 Lisp_Event); |
974 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event, | |
975 mark_event, print_event, 0, event_equal, | |
976 event_hash, 0, Lisp_Event); | |
977 #endif /* not USE_KKCC */ | |
978 | 506 |
979 DEFUN ("make-event", Fmake_event, 0, 2, 0, /* | 507 DEFUN ("make-event", Fmake_event, 0, 2, 0, /* |
980 Return a new event of type TYPE, with properties described by PLIST. | 508 Return a new event of type TYPE, with properties described by PLIST. |
981 | 509 |
982 TYPE is a symbol, either `empty', `key-press', `button-press', | 510 TYPE is a symbol, either `empty', `key-press', `button-press', |
1050 { | 578 { |
1051 /* For empty event, we return immediately, without processing | 579 /* For empty event, we return immediately, without processing |
1052 PLIST. In fact, processing PLIST would be wrong, because the | 580 PLIST. In fact, processing PLIST would be wrong, because the |
1053 sanitizing process would fill in the properties | 581 sanitizing process would fill in the properties |
1054 (e.g. CHANNEL), which we don't want in empty events. */ | 582 (e.g. CHANNEL), which we don't want in empty events. */ |
1055 #ifdef USE_KKCC | |
1056 set_event_type (e, empty_event); | 583 set_event_type (e, empty_event); |
1057 #else /* not USE_KKCC */ | |
1058 e->event_type = empty_event; | |
1059 #endif /* not USE_KKCC */ | |
1060 if (!NILP (plist)) | 584 if (!NILP (plist)) |
1061 invalid_operation ("Cannot set properties of empty event", plist); | 585 invalid_operation ("Cannot set properties of empty event", plist); |
1062 UNGCPRO; | 586 UNGCPRO; |
1063 return event; | 587 return event; |
1064 } | 588 } |
1065 else if (EQ (type, Qkey_press)) | 589 else if (EQ (type, Qkey_press)) |
1066 { | 590 { |
1067 #ifdef USE_KKCC | |
1068 set_event_type (e, key_press_event); | 591 set_event_type (e, key_press_event); |
1069 XSET_KEY_DATA_KEYSYM (EVENT_DATA (e), Qunbound); | 592 SET_EVENT_KEY_KEYSYM (e, Qunbound); |
1070 #else /* not USE_KKCC */ | |
1071 e->event_type = key_press_event; | |
1072 e->event.key.keysym = Qunbound; | |
1073 #endif /* not USE_KKCC */ | |
1074 } | 593 } |
1075 else if (EQ (type, Qbutton_press)) | 594 else if (EQ (type, Qbutton_press)) |
1076 #ifdef USE_KKCC | |
1077 set_event_type (e, button_press_event); | 595 set_event_type (e, button_press_event); |
1078 #else /* not USE_KKCC */ | |
1079 e->event_type = button_press_event; | |
1080 #endif /* not USE_KKCC */ | |
1081 else if (EQ (type, Qbutton_release)) | 596 else if (EQ (type, Qbutton_release)) |
1082 #ifdef USE_KKCC | |
1083 set_event_type (e, button_release_event); | 597 set_event_type (e, button_release_event); |
1084 #else /* not USE_KKCC */ | |
1085 e->event_type = button_release_event; | |
1086 #endif /* not USE_KKCC */ | |
1087 else if (EQ (type, Qmotion)) | 598 else if (EQ (type, Qmotion)) |
1088 #ifdef USE_KKCC | |
1089 set_event_type (e, pointer_motion_event); | 599 set_event_type (e, pointer_motion_event); |
1090 #else /* not USE_KKCC */ | |
1091 e->event_type = pointer_motion_event; | |
1092 #endif /* not USE_KKCC */ | |
1093 else if (EQ (type, Qmisc_user)) | 600 else if (EQ (type, Qmisc_user)) |
1094 { | 601 { |
1095 #ifdef USE_KKCC | |
1096 set_event_type (e, misc_user_event); | 602 set_event_type (e, misc_user_event); |
1097 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), Qnil); | 603 SET_EVENT_MISC_USER_FUNCTION (e, Qnil); |
1098 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), Qnil); | 604 SET_EVENT_MISC_USER_OBJECT (e, Qnil); |
1099 #else /* not USE_KKCC */ | |
1100 e->event_type = misc_user_event; | |
1101 e->event.eval.function = e->event.eval.object = Qnil; | |
1102 #endif /* not USE_KKCC */ | |
1103 } | 605 } |
1104 else | 606 else |
1105 { | 607 { |
1106 /* Not allowed: Qprocess, Qtimeout, Qmagic, Qeval, Qmagic_eval. */ | 608 /* Not allowed: Qprocess, Qtimeout, Qmagic, Qeval, Qmagic_eval. */ |
1107 invalid_constant ("Invalid event type", type); | 609 invalid_constant ("Invalid event type", type); |
1118 { | 620 { |
1119 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist) | 621 EXTERNAL_PROPERTY_LIST_LOOP_3 (keyword, value, plist) |
1120 { | 622 { |
1121 if (EQ (keyword, Qchannel)) | 623 if (EQ (keyword, Qchannel)) |
1122 { | 624 { |
1123 #ifdef USE_KKCC | 625 if (EVENT_TYPE (e) == key_press_event) |
1124 if (EVENT_TYPE(e) == key_press_event) | |
1125 #else /* not USE_KKCC */ | |
1126 if (e->event_type == key_press_event) | |
1127 #endif /* not USE_KKCC */ | |
1128 { | 626 { |
1129 if (!CONSOLEP (value)) | 627 if (!CONSOLEP (value)) |
1130 value = wrong_type_argument (Qconsolep, value); | 628 value = wrong_type_argument (Qconsolep, value); |
1131 } | 629 } |
1132 else | 630 else |
1136 } | 634 } |
1137 EVENT_CHANNEL (e) = value; | 635 EVENT_CHANNEL (e) = value; |
1138 } | 636 } |
1139 else if (EQ (keyword, Qkey)) | 637 else if (EQ (keyword, Qkey)) |
1140 { | 638 { |
1141 #ifdef USE_KKCC | 639 switch (EVENT_TYPE (e)) |
1142 switch (EVENT_TYPE(e)) | |
1143 #else /* not USE_KKCC */ | |
1144 switch (e->event_type) | |
1145 #endif /* not USE_KKCC */ | |
1146 { | 640 { |
1147 case key_press_event: | 641 case key_press_event: |
1148 if (!SYMBOLP (value) && !CHARP (value)) | 642 if (!SYMBOLP (value) && !CHARP (value)) |
1149 invalid_argument ("Invalid event key", value); | 643 invalid_argument ("Invalid event key", value); |
1150 #ifdef USE_KKCC | 644 SET_EVENT_KEY_KEYSYM (e, value); |
1151 XSET_KEY_DATA_KEYSYM (EVENT_DATA(e), value); | |
1152 #else /* not USE_KKCC */ | |
1153 e->event.key.keysym = value; | |
1154 #endif /* not USE_KKCC */ | |
1155 break; | 645 break; |
1156 default: | 646 default: |
1157 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); | 647 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); |
1158 break; | 648 break; |
1159 } | 649 } |
1161 else if (EQ (keyword, Qbutton)) | 651 else if (EQ (keyword, Qbutton)) |
1162 { | 652 { |
1163 CHECK_NATNUM (value); | 653 CHECK_NATNUM (value); |
1164 check_int_range (XINT (value), 0, 7); | 654 check_int_range (XINT (value), 0, 7); |
1165 | 655 |
1166 #ifdef USE_KKCC | 656 switch (EVENT_TYPE (e)) |
1167 switch (EVENT_TYPE(e)) | |
1168 #else /* not USE_KKCC */ | |
1169 switch (e->event_type) | |
1170 #endif /* not USE_KKCC */ | |
1171 { | 657 { |
1172 case button_press_event: | 658 case button_press_event: |
1173 case button_release_event: | 659 case button_release_event: |
1174 #ifdef USE_KKCC | 660 SET_EVENT_BUTTON_BUTTON (e, XINT (value)); |
1175 XSET_BUTTON_DATA_BUTTON (EVENT_DATA (e), XINT (value)); | |
1176 #else /* not USE_KKCC */ | |
1177 e->event.button.button = XINT (value); | |
1178 #endif /* not USE_KKCC */ | |
1179 break; | 661 break; |
1180 case misc_user_event: | 662 case misc_user_event: |
1181 #ifdef USE_KKCC | 663 SET_EVENT_MISC_USER_BUTTON (e, XINT (value)); |
1182 XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (e), XINT (value)); | |
1183 #else /* not USE_KKCC */ | |
1184 e->event.misc.button = XINT (value); | |
1185 #endif /* not USE_KKCC */ | |
1186 break; | 664 break; |
1187 default: | 665 default: |
1188 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); | 666 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); |
1189 break; | 667 break; |
1190 } | 668 } |
1209 else if (EQ (sym, Qbutton5)) modifiers |= XEMACS_MOD_BUTTON5; | 687 else if (EQ (sym, Qbutton5)) modifiers |= XEMACS_MOD_BUTTON5; |
1210 else | 688 else |
1211 invalid_constant ("Invalid key modifier", sym); | 689 invalid_constant ("Invalid key modifier", sym); |
1212 } | 690 } |
1213 | 691 |
1214 #ifdef USE_KKCC | 692 switch (EVENT_TYPE (e)) |
1215 switch (EVENT_TYPE(e)) | |
1216 #else /* not USE_KKCC */ | |
1217 switch (e->event_type) | |
1218 #endif /* not USE_KKCC */ | |
1219 { | 693 { |
1220 case key_press_event: | 694 case key_press_event: |
1221 #ifdef USE_KKCC | 695 SET_EVENT_KEY_MODIFIERS (e, modifiers); |
1222 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (e), modifiers); | |
1223 #else /* not USE_KKCC */ | |
1224 e->event.key.modifiers = modifiers; | |
1225 #endif /* not USE_KKCC */ | |
1226 break; | 696 break; |
1227 case button_press_event: | 697 case button_press_event: |
1228 case button_release_event: | 698 case button_release_event: |
1229 #ifdef USE_KKCC | 699 SET_EVENT_BUTTON_MODIFIERS (e, modifiers); |
1230 XSET_BUTTON_DATA_MODIFIERS (EVENT_DATA (e), modifiers); | |
1231 #else /* not USE_KKCC */ | |
1232 e->event.button.modifiers = modifiers; | |
1233 #endif /* not USE_KKCC */ | |
1234 break; | 700 break; |
1235 case pointer_motion_event: | 701 case pointer_motion_event: |
1236 #ifdef USE_KKCC | 702 SET_EVENT_MOTION_MODIFIERS (e, modifiers); |
1237 XSET_MOTION_DATA_MODIFIERS (EVENT_DATA (e), modifiers); | |
1238 #else /* not USE_KKCC */ | |
1239 e->event.motion.modifiers = modifiers; | |
1240 #endif /* not USE_KKCC */ | |
1241 break; | 703 break; |
1242 case misc_user_event: | 704 case misc_user_event: |
1243 #ifdef USE_KKCC | 705 SET_EVENT_MISC_USER_MODIFIERS (e, modifiers); |
1244 XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (e), modifiers); | |
1245 #else /* not USE_KKCC */ | |
1246 e->event.misc.modifiers = modifiers; | |
1247 #endif /* not USE_KKCC */ | |
1248 break; | 706 break; |
1249 default: | 707 default: |
1250 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); | 708 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); |
1251 break; | 709 break; |
1252 } | 710 } |
1253 } | 711 } |
1254 else if (EQ (keyword, Qx)) | 712 else if (EQ (keyword, Qx)) |
1255 { | 713 { |
1256 #ifdef USE_KKCC | 714 switch (EVENT_TYPE (e)) |
1257 switch (EVENT_TYPE(e)) | |
1258 #else /* not USE_KKCC */ | |
1259 switch (e->event_type) | |
1260 #endif /* not USE_KKCC */ | |
1261 { | 715 { |
1262 case pointer_motion_event: | 716 case pointer_motion_event: |
1263 case button_press_event: | 717 case button_press_event: |
1264 case button_release_event: | 718 case button_release_event: |
1265 case misc_user_event: | 719 case misc_user_event: |
1273 break; | 727 break; |
1274 } | 728 } |
1275 } | 729 } |
1276 else if (EQ (keyword, Qy)) | 730 else if (EQ (keyword, Qy)) |
1277 { | 731 { |
1278 #ifdef USE_KKCC | 732 switch (EVENT_TYPE (e)) |
1279 switch (EVENT_TYPE(e)) | |
1280 #else /* not USE_KKCC */ | |
1281 switch (e->event_type) | |
1282 #endif /* not USE_KKCC */ | |
1283 { | 733 { |
1284 case pointer_motion_event: | 734 case pointer_motion_event: |
1285 case button_press_event: | 735 case button_press_event: |
1286 case button_release_event: | 736 case button_release_event: |
1287 case misc_user_event: | 737 case misc_user_event: |
1295 } | 745 } |
1296 } | 746 } |
1297 else if (EQ (keyword, Qtimestamp)) | 747 else if (EQ (keyword, Qtimestamp)) |
1298 { | 748 { |
1299 CHECK_NATNUM (value); | 749 CHECK_NATNUM (value); |
1300 #ifdef USE_KKCC | |
1301 SET_EVENT_TIMESTAMP (e, XINT (value)); | 750 SET_EVENT_TIMESTAMP (e, XINT (value)); |
1302 #else /* not USE_KKCC */ | |
1303 e->timestamp = XINT (value); | |
1304 #endif /* not USE_KKCC */ | |
1305 } | 751 } |
1306 else if (EQ (keyword, Qfunction)) | 752 else if (EQ (keyword, Qfunction)) |
1307 { | 753 { |
1308 #ifdef USE_KKCC | 754 switch (EVENT_TYPE (e)) |
1309 switch (EVENT_TYPE(e)) | |
1310 #else /* not USE_KKCC */ | |
1311 switch (e->event_type) | |
1312 #endif /* not USE_KKCC */ | |
1313 { | 755 { |
1314 case misc_user_event: | 756 case misc_user_event: |
1315 #ifdef USE_KKCC | 757 SET_EVENT_MISC_USER_FUNCTION (e, value); |
1316 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (e), value); | |
1317 #else /* not USE_KKCC */ | |
1318 e->event.eval.function = value; | |
1319 #endif /* not USE_KKCC */ | |
1320 break; | 758 break; |
1321 default: | 759 default: |
1322 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); | 760 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); |
1323 break; | 761 break; |
1324 } | 762 } |
1325 } | 763 } |
1326 else if (EQ (keyword, Qobject)) | 764 else if (EQ (keyword, Qobject)) |
1327 { | 765 { |
1328 #ifdef USE_KKCC | 766 switch (EVENT_TYPE (e)) |
1329 switch (EVENT_TYPE(e)) | |
1330 #else /* not USE_KKCC */ | |
1331 switch (e->event_type) | |
1332 #endif /* not USE_KKCC */ | |
1333 { | 767 { |
1334 case misc_user_event: | 768 case misc_user_event: |
1335 #ifdef USE_KKCC | 769 SET_EVENT_MISC_USER_OBJECT (e, value); |
1336 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (e), value); | |
1337 #else /* not USE_KKCC */ | |
1338 e->event.eval.object = value; | |
1339 #endif /* not USE_KKCC */ | |
1340 break; | 770 break; |
1341 default: | 771 default: |
1342 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); | 772 WRONG_EVENT_TYPE_FOR_PROPERTY (type, keyword); |
1343 break; | 773 break; |
1344 } | 774 } |
1349 } | 779 } |
1350 | 780 |
1351 /* Insert the channel, if missing. */ | 781 /* Insert the channel, if missing. */ |
1352 if (NILP (EVENT_CHANNEL (e))) | 782 if (NILP (EVENT_CHANNEL (e))) |
1353 { | 783 { |
1354 #ifdef USE_KKCC | |
1355 if (EVENT_TYPE (e) == key_press_event) | 784 if (EVENT_TYPE (e) == key_press_event) |
1356 #else /* not USE_KKCC */ | |
1357 if (e->event_type == key_press_event) | |
1358 #endif /* not USE_KKCC */ | |
1359 EVENT_CHANNEL (e) = Vselected_console; | 785 EVENT_CHANNEL (e) = Vselected_console; |
1360 else | 786 else |
1361 EVENT_CHANNEL (e) = Fselected_frame (Qnil); | 787 EVENT_CHANNEL (e) = Fselected_frame (Qnil); |
1362 } | 788 } |
1363 | 789 |
1369 coord_y += FRAME_REAL_TOP_TOOLBAR_HEIGHT (XFRAME (EVENT_CHANNEL (e))); | 795 coord_y += FRAME_REAL_TOP_TOOLBAR_HEIGHT (XFRAME (EVENT_CHANNEL (e))); |
1370 | 796 |
1371 switch (e->event_type) | 797 switch (e->event_type) |
1372 { | 798 { |
1373 case pointer_motion_event: | 799 case pointer_motion_event: |
1374 #ifdef USE_KKCC | 800 SET_EVENT_MOTION_X (e, coord_x); |
1375 XSET_MOTION_DATA_X (EVENT_DATA (e), coord_x); | 801 SET_EVENT_MOTION_Y (e, coord_y); |
1376 XSET_MOTION_DATA_Y (EVENT_DATA (e), coord_y); | |
1377 #else /* not USE_KKCC */ | |
1378 e->event.motion.x = coord_x; | |
1379 e->event.motion.y = coord_y; | |
1380 #endif /* not USE_KKCC */ | |
1381 break; | 802 break; |
1382 case button_press_event: | 803 case button_press_event: |
1383 case button_release_event: | 804 case button_release_event: |
1384 #ifdef USE_KKCC | 805 SET_EVENT_BUTTON_X (e, coord_x); |
1385 XSET_BUTTON_DATA_X (EVENT_DATA (e), coord_x); | 806 SET_EVENT_BUTTON_Y (e, coord_y); |
1386 XSET_BUTTON_DATA_Y (EVENT_DATA (e), coord_y); | |
1387 #else /* not USE_KKCC */ | |
1388 e->event.button.x = coord_x; | |
1389 e->event.button.y = coord_y; | |
1390 #endif /* not USE_KKCC */ | |
1391 break; | 807 break; |
1392 case misc_user_event: | 808 case misc_user_event: |
1393 #ifdef USE_KKCC | 809 SET_EVENT_MISC_USER_X (e, coord_x); |
1394 XSET_MISC_USER_DATA_X (EVENT_DATA (e), coord_x); | 810 SET_EVENT_MISC_USER_Y (e, coord_y); |
1395 XSET_MISC_USER_DATA_Y (EVENT_DATA (e), coord_y); | |
1396 #else /* not USE_KKCC */ | |
1397 e->event.misc.x = coord_x; | |
1398 e->event.misc.y = coord_y; | |
1399 #endif /* not USE_KKCC */ | |
1400 break; | 811 break; |
1401 default: | 812 default: |
1402 abort(); | 813 abort (); |
1403 } | 814 } |
1404 } | 815 } |
1405 | 816 |
1406 /* Finally, do some more validation. */ | 817 /* Finally, do some more validation. */ |
1407 #ifdef USE_KKCC | 818 switch (EVENT_TYPE (e)) |
1408 switch (EVENT_TYPE(e)) | |
1409 #else /* not USE_KKCC */ | |
1410 switch (e->event_type) | |
1411 #endif /* not USE_KKCC */ | |
1412 { | 819 { |
1413 case key_press_event: | 820 case key_press_event: |
1414 #ifdef USE_KKCC | 821 if (UNBOUNDP (EVENT_KEY_KEYSYM (e))) |
1415 if (UNBOUNDP (XKEY_DATA_KEYSYM (EVENT_DATA (e)))) | |
1416 #else /* not USE_KKCC */ | |
1417 if (UNBOUNDP (e->event.key.keysym)) | |
1418 #endif /* not USE_KKCC */ | |
1419 sferror ("A key must be specified to make a keypress event", | 822 sferror ("A key must be specified to make a keypress event", |
1420 plist); | 823 plist); |
1421 break; | 824 break; |
1422 case button_press_event: | 825 case button_press_event: |
1423 #ifdef USE_KKCC | 826 if (!EVENT_BUTTON_BUTTON (e)) |
1424 if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e))) | |
1425 #else /* not USE_KKCC */ | |
1426 if (!e->event.button.button) | |
1427 #endif /* not USE_KKCC */ | |
1428 sferror | 827 sferror |
1429 ("A button must be specified to make a button-press event", | 828 ("A button must be specified to make a button-press event", |
1430 plist); | 829 plist); |
1431 break; | 830 break; |
1432 case button_release_event: | 831 case button_release_event: |
1433 #ifdef USE_KKCC | 832 if (!EVENT_BUTTON_BUTTON (e)) |
1434 if (!XBUTTON_DATA_BUTTON (EVENT_DATA (e))) | |
1435 #else /* not USE_KKCC */ | |
1436 if (!e->event.button.button) | |
1437 #endif /* not USE_KKCC */ | |
1438 sferror | 833 sferror |
1439 ("A button must be specified to make a button-release event", | 834 ("A button must be specified to make a button-release event", |
1440 plist); | 835 plist); |
1441 break; | 836 break; |
1442 case misc_user_event: | 837 case misc_user_event: |
1443 #ifdef USE_KKCC | 838 if (NILP (EVENT_MISC_USER_FUNCTION (e))) |
1444 if (NILP (XMISC_USER_DATA_FUNCTION (EVENT_DATA (e)))) | |
1445 #else /* not USE_KKCC */ | |
1446 if (NILP (e->event.misc.function)) | |
1447 #endif /* not USE_KKCC */ | |
1448 sferror ("A function must be specified to make a misc-user event", | 839 sferror ("A function must be specified to make a misc-user event", |
1449 plist); | 840 plist); |
1450 break; | 841 break; |
1451 default: | 842 default: |
1452 break; | 843 break; |
1453 } | 844 } |
1454 | 845 |
1455 UNGCPRO; | 846 UNGCPRO; |
1456 return event; | 847 return event; |
1457 } | 848 } |
1458 | |
1459 | |
1460 #ifdef USE_KKCC | |
1461 | |
1462 Lisp_Object | |
1463 make_key_data (void) | |
1464 { | |
1465 Lisp_Object data = allocate_key_data (); | |
1466 | |
1467 XSET_KEY_DATA_KEYSYM (data, Qnil); | |
1468 XSET_KEY_DATA_MODIFIERS (data, 0); | |
1469 | |
1470 return data; | |
1471 } | |
1472 | |
1473 Lisp_Object | |
1474 make_button_data (void) | |
1475 { | |
1476 Lisp_Object data = allocate_button_data (); | |
1477 | |
1478 XSET_BUTTON_DATA_BUTTON (data, 0); | |
1479 XSET_BUTTON_DATA_MODIFIERS (data, 0); | |
1480 XSET_BUTTON_DATA_X (data, 0); | |
1481 XSET_BUTTON_DATA_Y (data, 0); | |
1482 | |
1483 return data; | |
1484 } | |
1485 | |
1486 Lisp_Object | |
1487 make_motion_data (void) | |
1488 { | |
1489 Lisp_Object data = allocate_motion_data (); | |
1490 | |
1491 XSET_MOTION_DATA_X (data, 0); | |
1492 XSET_MOTION_DATA_Y (data, 0); | |
1493 XSET_MOTION_DATA_MODIFIERS (data, 0); | |
1494 | |
1495 return data; | |
1496 } | |
1497 | |
1498 Lisp_Object | |
1499 make_process_data (void) | |
1500 { | |
1501 Lisp_Object data = allocate_process_data (); | |
1502 | |
1503 XSET_PROCESS_DATA_PROCESS (data, Qnil); | |
1504 | |
1505 return data; | |
1506 } | |
1507 | |
1508 Lisp_Object | |
1509 make_timeout_data (void) | |
1510 { | |
1511 Lisp_Object data = allocate_timeout_data (); | |
1512 | |
1513 XSET_TIMEOUT_DATA_INTERVAL_ID (data, 0); | |
1514 XSET_TIMEOUT_DATA_ID_NUMBER(data, 0); | |
1515 XSET_TIMEOUT_DATA_FUNCTION(data, Qnil); | |
1516 XSET_TIMEOUT_DATA_OBJECT (data, Qnil); | |
1517 | |
1518 return data; | |
1519 } | |
1520 | |
1521 Lisp_Object | |
1522 make_magic_eval_data (void) | |
1523 { | |
1524 Lisp_Object data = allocate_magic_eval_data (); | |
1525 | |
1526 XSET_MAGIC_EVAL_DATA_OBJECT (data, Qnil); | |
1527 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNOBJ (data, 0); | |
1528 | |
1529 return data; | |
1530 } | |
1531 | |
1532 Lisp_Object | |
1533 make_eval_data (void) | |
1534 { | |
1535 Lisp_Object data = allocate_eval_data (); | |
1536 | |
1537 XSET_EVAL_DATA_FUNCTION (data, Qnil); | |
1538 XSET_EVAL_DATA_OBJECT (data, Qnil); | |
1539 | |
1540 return data; | |
1541 } | |
1542 | |
1543 Lisp_Object | |
1544 make_magic_data (void) | |
1545 { | |
1546 return allocate_magic_data (); | |
1547 } | |
1548 | |
1549 Lisp_Object | |
1550 make_misc_user_data (void) | |
1551 { | |
1552 Lisp_Object data = allocate_misc_user_data (); | |
1553 | |
1554 XSET_MISC_USER_DATA_FUNCTION (data, Qnil); | |
1555 XSET_MISC_USER_DATA_OBJECT (data, Qnil); | |
1556 XSET_MISC_USER_DATA_BUTTON (data, 0); | |
1557 XSET_MISC_USER_DATA_MODIFIERS (data, 0); | |
1558 XSET_MISC_USER_DATA_X (data, 0); | |
1559 XSET_MISC_USER_DATA_Y (data, 0); | |
1560 | |
1561 return data; | |
1562 } | |
1563 #endif /* USE_KKCC */ | |
1564 | |
1565 | |
1566 | 849 |
1567 DEFUN ("deallocate-event", Fdeallocate_event, 1, 1, 0, /* | 850 DEFUN ("deallocate-event", Fdeallocate_event, 1, 1, 0, /* |
1568 Allow the given event structure to be reused. | 851 Allow the given event structure to be reused. |
1569 You MUST NOT use this event object after calling this function with it. | 852 You MUST NOT use this event object after calling this function with it. |
1570 You will lose. It is not necessary to call this function, as event | 853 You will lose. It is not necessary to call this function, as event |
1611 Vevent_resource = event; | 894 Vevent_resource = event; |
1612 #endif | 895 #endif |
1613 return Qnil; | 896 return Qnil; |
1614 } | 897 } |
1615 | 898 |
1616 #ifdef USE_KKCC | |
1617 void | |
1618 copy_event_data (Lisp_Object dest, Lisp_Object src) | |
1619 { | |
1620 switch (XRECORD_LHEADER (dest)->type) { | |
1621 case lrecord_type_key_data: | |
1622 XSET_KEY_DATA_KEYSYM (dest, XKEY_DATA_KEYSYM (src)); | |
1623 XSET_KEY_DATA_MODIFIERS (dest, XKEY_DATA_MODIFIERS (src)); | |
1624 break; | |
1625 case lrecord_type_button_data: | |
1626 XSET_BUTTON_DATA_BUTTON (dest, XBUTTON_DATA_BUTTON (src)); | |
1627 XSET_BUTTON_DATA_MODIFIERS (dest, XBUTTON_DATA_MODIFIERS (src)); | |
1628 XSET_BUTTON_DATA_X (dest, XBUTTON_DATA_X (src)); | |
1629 XSET_BUTTON_DATA_Y (dest, XBUTTON_DATA_Y (src)); | |
1630 break; | |
1631 case lrecord_type_motion_data: | |
1632 XSET_MOTION_DATA_X (dest, XMOTION_DATA_X (src)); | |
1633 XSET_MOTION_DATA_Y (dest, XMOTION_DATA_Y (src)); | |
1634 XSET_MOTION_DATA_MODIFIERS (dest, XMOTION_DATA_MODIFIERS (src)); | |
1635 break; | |
1636 case lrecord_type_process_data: | |
1637 XSET_PROCESS_DATA_PROCESS (dest, XPROCESS_DATA_PROCESS (src)); | |
1638 break; | |
1639 case lrecord_type_timeout_data: | |
1640 XSET_TIMEOUT_DATA_INTERVAL_ID (dest, XTIMEOUT_DATA_INTERVAL_ID (src)); | |
1641 XSET_TIMEOUT_DATA_ID_NUMBER (dest, XTIMEOUT_DATA_ID_NUMBER (src)); | |
1642 XSET_TIMEOUT_DATA_FUNCTION (dest, XTIMEOUT_DATA_FUNCTION (src)); | |
1643 XSET_TIMEOUT_DATA_OBJECT (dest, XTIMEOUT_DATA_OBJECT (src)); | |
1644 break; | |
1645 case lrecord_type_eval_data: | |
1646 XSET_EVAL_DATA_FUNCTION (dest, XEVAL_DATA_FUNCTION (src)); | |
1647 XSET_EVAL_DATA_OBJECT (dest, XEVAL_DATA_OBJECT (src)); | |
1648 break; | |
1649 case lrecord_type_misc_user_data: | |
1650 XSET_MISC_USER_DATA_FUNCTION (dest, XMISC_USER_DATA_FUNCTION (src)); | |
1651 XSET_MISC_USER_DATA_OBJECT (dest, XMISC_USER_DATA_OBJECT (src)); | |
1652 XSET_MISC_USER_DATA_BUTTON (dest, XMISC_USER_DATA_BUTTON (src)); | |
1653 XSET_MISC_USER_DATA_MODIFIERS (dest, XMISC_USER_DATA_MODIFIERS (src)); | |
1654 XSET_MISC_USER_DATA_X (dest, XMISC_USER_DATA_X (src)); | |
1655 XSET_MISC_USER_DATA_Y (dest, XMISC_USER_DATA_Y (src)); | |
1656 break; | |
1657 case lrecord_type_magic_eval_data: | |
1658 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION (dest, XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (src)); | |
1659 XSET_MAGIC_EVAL_DATA_OBJECT (dest, XMAGIC_EVAL_DATA_OBJECT (src)); | |
1660 break; | |
1661 case lrecord_type_magic_data: | |
1662 XSET_MAGIC_DATA_UNDERLYING (dest, XMAGIC_DATA_UNDERLYING (src)); | |
1663 break; | |
1664 default: | |
1665 break; | |
1666 } | |
1667 } | |
1668 #endif /* USE_KKCC */ | |
1669 | |
1670 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /* | 899 DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /* |
1671 Make a copy of the event object EVENT1. | 900 Make a copy of the event object EVENT1. |
1672 If a second event argument EVENT2 is given, EVENT1 is copied into | 901 If a second event argument EVENT2 is given, EVENT1 is copied into |
1673 EVENT2 and EVENT2 is returned. If EVENT2 is not supplied (or is nil) | 902 EVENT2 and EVENT2 is returned. If EVENT2 is not supplied (or is nil) |
1674 then a new event will be made as with `make-event'. See also the | 903 then a new event will be made as with `make-event'. See also the |
1689 } | 918 } |
1690 | 919 |
1691 assert (XEVENT_TYPE (event1) <= last_event_type); | 920 assert (XEVENT_TYPE (event1) <= last_event_type); |
1692 assert (XEVENT_TYPE (event2) <= last_event_type); | 921 assert (XEVENT_TYPE (event2) <= last_event_type); |
1693 | 922 |
1694 #ifdef USE_KKCC | |
1695 XSET_EVENT_TYPE (event2, XEVENT_TYPE (event1)); | 923 XSET_EVENT_TYPE (event2, XEVENT_TYPE (event1)); |
1696 XSET_EVENT_CHANNEL (event2, XEVENT_CHANNEL (event1)); | 924 XSET_EVENT_CHANNEL (event2, XEVENT_CHANNEL (event1)); |
1697 XSET_EVENT_TIMESTAMP (event2, XEVENT_TIMESTAMP (event1)); | 925 XSET_EVENT_TIMESTAMP (event2, XEVENT_TIMESTAMP (event1)); |
1698 copy_event_data (XEVENT_DATA (event2), XEVENT_DATA (event1)); | 926 |
1699 | 927 #ifdef EVENT_DATA_AS_OBJECTS |
928 copy_lisp_object (XEVENT_DATA (event2), XEVENT_DATA (event1)); | |
929 #else | |
930 XEVENT (event2)->event = XEVENT (event1)->event; | |
931 #endif | |
1700 return event2; | 932 return event2; |
1701 #else /* not USE_KKCC */ | |
1702 { | |
1703 Lisp_Event *ev2 = XEVENT (event2); | |
1704 Lisp_Event *ev1 = XEVENT (event1); | |
1705 | |
1706 ev2->event_type = ev1->event_type; | |
1707 ev2->channel = ev1->channel; | |
1708 ev2->timestamp = ev1->timestamp; | |
1709 ev2->event = ev1->event; | |
1710 | |
1711 return event2; | |
1712 } | |
1713 #endif /* not USE_KKCC */ | |
1714 } | 933 } |
1715 | 934 |
1716 | 935 |
1717 /************************************************************************/ | 936 /************************************************************************/ |
1718 /* event chain functions */ | 937 /* event chain functions */ |
1802 else | 1021 else |
1803 { | 1022 { |
1804 XSET_EVENT_NEXT (*tail, event_chain); | 1023 XSET_EVENT_NEXT (*tail, event_chain); |
1805 *tail = event_chain_tail (event_chain); | 1024 *tail = event_chain_tail (event_chain); |
1806 } | 1025 } |
1026 } | |
1027 | |
1028 /* Map a function over each event in the chain. If the function returns | |
1029 non-zero, remove the event just processed. Return the total number of | |
1030 items removed. | |
1031 | |
1032 NOTE: | |
1033 | |
1034 If you want a simple mapping over an event chain, with no intention to | |
1035 add or remove items, just use EVENT_CHAIN_LOOP(). | |
1036 */ | |
1037 | |
1038 int | |
1039 map_event_chain_remove (int (*fn) (Lisp_Object ev, void *user_data), | |
1040 Lisp_Object *head, Lisp_Object *tail, | |
1041 void *user_data, int flags) | |
1042 { | |
1043 Lisp_Object event; | |
1044 Lisp_Object previous_event = Qnil; | |
1045 int count = 0; | |
1046 | |
1047 EVENT_CHAIN_LOOP (event, *head) | |
1048 { | |
1049 if (fn (event, user_data)) | |
1050 { | |
1051 if (NILP (previous_event)) | |
1052 dequeue_event (head, tail); | |
1053 else | |
1054 { | |
1055 XSET_EVENT_NEXT (previous_event, XEVENT_NEXT (event)); | |
1056 if (EQ (*tail, event)) | |
1057 *tail = previous_event; | |
1058 } | |
1059 | |
1060 if (flags & MECR_DEALLOCATE_EVENT) | |
1061 Fdeallocate_event (event); | |
1062 count++; | |
1063 } | |
1064 else | |
1065 previous_event = event; | |
1066 } | |
1067 return count; | |
1807 } | 1068 } |
1808 | 1069 |
1809 /* Return the number of events (possibly 0) on an event chain. */ | 1070 /* Return the number of events (possibly 0) on an event chain. */ |
1810 | 1071 |
1811 int | 1072 int |
1912 default: | 1173 default: |
1913 return 0; | 1174 return 0; |
1914 } | 1175 } |
1915 } | 1176 } |
1916 | 1177 |
1178 /* USE_CONSOLE_META_FLAG is as in `character-to-event'. | |
1179 DO_BACKSPACE_MAPPING means that if CON is a TTY, and C is a the TTY's | |
1180 backspace character, the event will have keysym `backspace' instead of | |
1181 '(control h). It is clearly correct to do this conversion is the | |
1182 character was just read from a TTY, clearly incorrect inside of | |
1183 define-key, which must be able to handle all consoles. #### What about | |
1184 in other circumstances? #### Should the user have access to this flag? | |
1185 | |
1186 | |
1187 #### We need to go through and review all the flags in | |
1188 character_to_event() and event_to_character() and figure out exactly | |
1189 under what circumstances they should or should not be set, then go | |
1190 through and review all callers of character_to_event(), | |
1191 Fcharacter_to_event(), event_to_character(), and Fevent_to_character() | |
1192 and check that they are passing the correct flags in for their varied | |
1193 circumstances. | |
1194 | |
1195 #### Some of this garbage, and some of the flags, could go away if we | |
1196 implemented the suggestion, originally from event-Xt.c: | |
1197 | |
1198 #### The way that keysym correspondence to characters should work: | |
1199 - a Lisp_Event should contain a keysym AND a character slot. | |
1200 - keybindings are tried with the keysym. If no binding can be found, | |
1201 and there is a corresponding character, call self-insert-command. | |
1202 | |
1203 #### Nuke x-iso8859-1.el. | |
1204 #### Nuke the Qascii_character property. | |
1205 #### Nuke Vcharacter_set_property. | |
1206 | |
1207 This would apparently solve a lot of different problems. | |
1208 */ | |
1917 | 1209 |
1918 void | 1210 void |
1919 character_to_event (Ichar c, Lisp_Event *event, struct console *con, | 1211 character_to_event (Ichar c, Lisp_Event *event, struct console *con, |
1920 int use_console_meta_flag, int do_backspace_mapping) | 1212 int use_console_meta_flag, int do_backspace_mapping) |
1921 { | 1213 { |
1922 Lisp_Object k = Qnil; | 1214 Lisp_Object k = Qnil; |
1923 int m = 0; | 1215 int m = 0; |
1924 #ifdef USE_KKCC | |
1925 if (EVENT_TYPE (event) == dead_event) | 1216 if (EVENT_TYPE (event) == dead_event) |
1926 #else /* not USE_KKCC */ | |
1927 if (event->event_type == dead_event) | |
1928 #endif /* not USE_KKCC */ | |
1929 invalid_argument ("character-to-event called with a deallocated event!", Qunbound); | 1217 invalid_argument ("character-to-event called with a deallocated event!", Qunbound); |
1930 | 1218 |
1931 #ifndef MULE | 1219 #ifndef MULE |
1932 c &= 255; | 1220 c &= 255; |
1933 #endif | 1221 #endif |
1934 if (c > 127 && c <= 255) | 1222 if (c > 127 && c <= 255) |
1935 { | 1223 { |
1224 /* #### What if the user wanted a Latin-1 char? Perhaps the answer | |
1225 is what was suggested above. | |
1226 */ | |
1936 int meta_flag = 1; | 1227 int meta_flag = 1; |
1937 if (use_console_meta_flag && CONSOLE_TTY_P (con)) | 1228 if (use_console_meta_flag && CONSOLE_TTY_P (con)) |
1938 meta_flag = TTY_FLAGS (con).meta_key; | 1229 meta_flag = TTY_FLAGS (con).meta_key; |
1939 switch (meta_flag) | 1230 switch (meta_flag) |
1940 { | 1231 { |
1957 case 'I': k = QKtab; m &= ~XEMACS_MOD_CONTROL; break; | 1248 case 'I': k = QKtab; m &= ~XEMACS_MOD_CONTROL; break; |
1958 case 'J': k = QKlinefeed; m &= ~XEMACS_MOD_CONTROL; break; | 1249 case 'J': k = QKlinefeed; m &= ~XEMACS_MOD_CONTROL; break; |
1959 case 'M': k = QKreturn; m &= ~XEMACS_MOD_CONTROL; break; | 1250 case 'M': k = QKreturn; m &= ~XEMACS_MOD_CONTROL; break; |
1960 case '[': k = QKescape; m &= ~XEMACS_MOD_CONTROL; break; | 1251 case '[': k = QKescape; m &= ~XEMACS_MOD_CONTROL; break; |
1961 default: | 1252 default: |
1962 #if defined(HAVE_TTY) | 1253 #if defined (HAVE_TTY) |
1963 if (do_backspace_mapping && | 1254 if (do_backspace_mapping && |
1964 CHARP (con->tty_erase_char) && | 1255 CHARP (con->tty_erase_char) && |
1965 c - '@' == XCHAR (con->tty_erase_char)) | 1256 c - '@' == XCHAR (con->tty_erase_char)) |
1966 { | 1257 { |
1967 k = QKbackspace; | 1258 k = QKbackspace; |
1968 m &= ~XEMACS_MOD_CONTROL; | 1259 m &= ~XEMACS_MOD_CONTROL; |
1969 } | 1260 } |
1970 #endif /* defined(HAVE_TTY) && !defined(CYGWIN) */ | 1261 #endif /* defined (HAVE_TTY) */ |
1971 break; | 1262 break; |
1972 } | 1263 } |
1973 if (c >= 'A' && c <= 'Z') c -= 'A'-'a'; | 1264 if (c >= 'A' && c <= 'Z') c -= 'A'-'a'; |
1974 } | 1265 } |
1975 #if defined(HAVE_TTY) | 1266 #if defined (HAVE_TTY) |
1976 else if (do_backspace_mapping && | 1267 else if (do_backspace_mapping && |
1977 CHARP (con->tty_erase_char) && c == XCHAR (con->tty_erase_char)) | 1268 CHARP (con->tty_erase_char) && c == XCHAR (con->tty_erase_char)) |
1978 k = QKbackspace; | 1269 k = QKbackspace; |
1979 #endif /* defined(HAVE_TTY) && !defined(CYGWIN) */ | 1270 #endif /* defined (HAVE_TTY) */ |
1980 else if (c == 127) | 1271 else if (c == 127) |
1981 k = QKdelete; | 1272 k = QKdelete; |
1982 else if (c == ' ') | 1273 else if (c == ' ') |
1983 k = QKspace; | 1274 k = QKspace; |
1984 | 1275 |
1985 #ifdef USE_KKCC | |
1986 set_event_type (event, key_press_event); | 1276 set_event_type (event, key_press_event); |
1987 SET_EVENT_TIMESTAMP_ZERO (event); /* #### */ | 1277 SET_EVENT_TIMESTAMP_ZERO (event); /* #### */ |
1988 SET_EVENT_CHANNEL (event, wrap_console (con)); | 1278 SET_EVENT_CHANNEL (event, wrap_console (con)); |
1989 XSET_KEY_DATA_KEYSYM (EVENT_DATA (event), (!NILP (k) ? k : make_char (c))); | 1279 SET_EVENT_KEY_KEYSYM (event, (!NILP (k) ? k : make_char (c))); |
1990 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (event), m); | 1280 SET_EVENT_KEY_MODIFIERS (event, m); |
1991 #else /* not USE_KKCC */ | |
1992 event->event_type = key_press_event; | |
1993 event->timestamp = 0; /* #### */ | |
1994 event->channel = wrap_console (con); | |
1995 event->event.key.keysym = (!NILP (k) ? k : make_char (c)); | |
1996 event->event.key.modifiers = m; | |
1997 #endif /* not USE_KKCC */ | |
1998 } | 1281 } |
1999 | 1282 |
2000 /* This variable controls what character name -> character code mapping | 1283 /* This variable controls what character name -> character code mapping |
2001 we are using. Window-system-specific code sets this to some symbol, | 1284 we are using. Window-system-specific code sets this to some symbol, |
2002 and we use that symbol as the plist key to convert keysyms into 8-bit | 1285 and we use that symbol as the plist key to convert keysyms into 8-bit |
2006 #### This is utterly bogus and should be removed. | 1289 #### This is utterly bogus and should be removed. |
2007 */ | 1290 */ |
2008 Lisp_Object Vcharacter_set_property; | 1291 Lisp_Object Vcharacter_set_property; |
2009 | 1292 |
2010 Ichar | 1293 Ichar |
2011 event_to_character (Lisp_Event *event, | 1294 event_to_character (Lisp_Object event, |
2012 int allow_extra_modifiers, | 1295 int allow_extra_modifiers, |
2013 int allow_meta, | 1296 int allow_meta, |
2014 int allow_non_ascii) | 1297 int map_device_key_names) |
2015 { | 1298 { |
2016 Ichar c = 0; | 1299 Ichar c = 0; |
2017 Lisp_Object code; | 1300 Lisp_Object code; |
2018 | 1301 |
2019 #ifdef USE_KKCC | 1302 if (XEVENT_TYPE (event) != key_press_event) |
2020 if (EVENT_TYPE (event) != key_press_event) | 1303 { |
2021 #else /* not USE_KKCC */ | 1304 assert (XEVENT_TYPE (event) != dead_event); |
2022 if (event->event_type != key_press_event) | |
2023 #endif /* not USE_KKCC */ | |
2024 { | |
2025 #ifdef USE_KKCC | |
2026 assert (EVENT_TYPE (event) != dead_event); | |
2027 #else /* not USE_KKCC */ | |
2028 assert (event->event_type != dead_event); | |
2029 #endif /* not USE_KKCC */ | |
2030 return -1; | 1305 return -1; |
2031 } | 1306 } |
2032 if (!allow_extra_modifiers && | 1307 if (!allow_extra_modifiers && |
2033 #ifdef USE_KKCC | 1308 XEVENT_KEY_MODIFIERS (event) & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT)) |
2034 XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT)) | |
2035 #else /* not USE_KKCC */ | |
2036 event->event.key.modifiers & (XEMACS_MOD_SUPER|XEMACS_MOD_HYPER|XEMACS_MOD_ALT)) | |
2037 #endif /* not USE_KKCC */ | |
2038 return -1; | 1309 return -1; |
2039 #ifdef USE_KKCC | 1310 if (CHAR_OR_CHAR_INTP (XEVENT_KEY_KEYSYM (event))) |
2040 if (CHAR_OR_CHAR_INTP (XKEY_DATA_KEYSYM (EVENT_DATA (event)))) | 1311 c = XCHAR_OR_CHAR_INT (XEVENT_KEY_KEYSYM (event)); |
2041 c = XCHAR_OR_CHAR_INT (XKEY_DATA_KEYSYM (EVENT_DATA (event))); | 1312 else if (!SYMBOLP (XEVENT_KEY_KEYSYM (event))) |
2042 else if (!SYMBOLP (XKEY_DATA_KEYSYM (EVENT_DATA (event)))) | |
2043 #else /* not USE_KKCC */ | |
2044 if (CHAR_OR_CHAR_INTP (event->event.key.keysym)) | |
2045 c = XCHAR_OR_CHAR_INT (event->event.key.keysym); | |
2046 else if (!SYMBOLP (event->event.key.keysym)) | |
2047 #endif /* not USE_KKCC */ | |
2048 abort (); | 1313 abort (); |
2049 else if (allow_non_ascii && !NILP (Vcharacter_set_property) | 1314 else if (map_device_key_names && !NILP (Vcharacter_set_property) |
2050 /* Allow window-system-specific extensibility of | 1315 /* Allow window-system-specific extensibility of |
2051 keysym->code mapping */ | 1316 keysym->code mapping */ |
2052 #ifdef USE_KKCC | 1317 && CHAR_OR_CHAR_INTP (code = Fget (XEVENT_KEY_KEYSYM (event), |
2053 && CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)), | |
2054 Vcharacter_set_property, | 1318 Vcharacter_set_property, |
2055 Qnil))) | 1319 Qnil))) |
2056 #else /* not USE_KKCC */ | |
2057 && CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym, | |
2058 Vcharacter_set_property, | |
2059 Qnil))) | |
2060 #endif /* not USE_KKCC */ | |
2061 c = XCHAR_OR_CHAR_INT (code); | 1320 c = XCHAR_OR_CHAR_INT (code); |
2062 #ifdef USE_KKCC | 1321 else if (CHAR_OR_CHAR_INTP (code = Fget (XEVENT_KEY_KEYSYM (event), |
2063 else if (CHAR_OR_CHAR_INTP (code = Fget (XKEY_DATA_KEYSYM (EVENT_DATA (event)), | |
2064 Qascii_character, Qnil))) | 1322 Qascii_character, Qnil))) |
2065 #else /* not USE_KKCC */ | |
2066 else if (CHAR_OR_CHAR_INTP (code = Fget (event->event.key.keysym, | |
2067 Qascii_character, Qnil))) | |
2068 #endif /* not USE_KKCC */ | |
2069 c = XCHAR_OR_CHAR_INT (code); | 1323 c = XCHAR_OR_CHAR_INT (code); |
2070 else | 1324 else |
2071 return -1; | 1325 return -1; |
2072 | 1326 |
2073 #ifdef USE_KKCC | 1327 if (XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_CONTROL) |
2074 if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_CONTROL) | |
2075 #else /* not USE_KKCC */ | |
2076 if (event->event.key.modifiers & XEMACS_MOD_CONTROL) | |
2077 #endif /* not USE_KKCC */ | |
2078 { | 1328 { |
2079 if (c >= 'a' && c <= 'z') | 1329 if (c >= 'a' && c <= 'z') |
2080 c -= ('a' - 'A'); | 1330 c -= ('a' - 'A'); |
2081 else | 1331 else |
2082 /* reject Control-Shift- keys */ | 1332 /* reject Control-Shift- keys */ |
2090 else | 1340 else |
2091 /* reject keys that can't take Control- modifiers */ | 1341 /* reject keys that can't take Control- modifiers */ |
2092 if (! allow_extra_modifiers) return -1; | 1342 if (! allow_extra_modifiers) return -1; |
2093 } | 1343 } |
2094 | 1344 |
2095 #ifdef USE_KKCC | 1345 if (XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_META) |
2096 if (XKEY_DATA_MODIFIERS (EVENT_DATA (event)) & XEMACS_MOD_META) | |
2097 #else /* not USE_KKCC */ | |
2098 if (event->event.key.modifiers & XEMACS_MOD_META) | |
2099 #endif /* not USE_KKCC */ | |
2100 { | 1346 { |
2101 if (! allow_meta) return -1; | 1347 if (! allow_meta) return -1; |
2102 if (c & 0200) return -1; /* don't allow M-oslash (overlap) */ | 1348 if (c >= 128) return -1; /* don't allow M-oslash (overlap) */ |
2103 #ifdef MULE | |
2104 if (c >= 256) return -1; | |
2105 #endif | |
2106 c |= 0200; | 1349 c |= 0200; |
2107 } | 1350 } |
2108 return c; | 1351 return c; |
2109 } | 1352 } |
2110 | 1353 |
2117 shifted ASCII equivalent (Control-Shift-A for example, will be mapped to | 1360 shifted ASCII equivalent (Control-Shift-A for example, will be mapped to |
2118 the same ASCII code as Control-A). | 1361 the same ASCII code as Control-A). |
2119 If the ALLOW-META argument is non-nil, then the Meta modifier will be | 1362 If the ALLOW-META argument is non-nil, then the Meta modifier will be |
2120 represented by turning on the high bit of the byte returned; otherwise, nil | 1363 represented by turning on the high bit of the byte returned; otherwise, nil |
2121 will be returned for events containing the Meta modifier. | 1364 will be returned for events containing the Meta modifier. |
2122 If the ALLOW-NON-ASCII argument is non-nil, then characters which are | 1365 If the MAP-DEVICE-KEY-NAMES argument is non-nil, then named keysyms that |
2123 present in the prevailing character set (see the `character-set-property' | 1366 represent printable characters will be converted to that character. This |
2124 variable) will be returned as their code in that character set, instead of | 1367 means, for example, that under X, where a circumflexed lowercase o returns |
2125 the return value being restricted to ASCII. | 1368 a key with the name `ocircumflex' rather than the actual character, this |
2126 Note that specifying both ALLOW-META and ALLOW-NON-ASCII is ambiguous, as | 1369 name will be converted to the appropriate character. See |
2127 both use the high bit; `M-x' and `oslash' will be indistinguishable. | 1370 `character-set-property' for some sense of how this works. #### This |
2128 */ | 1371 should not be exposed and may be removed at some point. |
2129 (event, allow_extra_modifiers, allow_meta, allow_non_ascii)) | 1372 Note that ALLOW-META may cause ambiguity between meta characters and |
1373 Latin-1 characters. | |
1374 */ | |
1375 (event, allow_extra_modifiers, allow_meta, map_device_key_names)) | |
2130 { | 1376 { |
2131 Ichar c; | 1377 Ichar c; |
2132 CHECK_LIVE_EVENT (event); | 1378 CHECK_LIVE_EVENT (event); |
2133 c = event_to_character (XEVENT (event), | 1379 c = event_to_character (event, |
2134 !NILP (allow_extra_modifiers), | 1380 !NILP (allow_extra_modifiers), |
2135 !NILP (allow_meta), | 1381 !NILP (allow_meta), |
2136 !NILP (allow_non_ascii)); | 1382 !NILP (map_device_key_names)); |
2137 return c < 0 ? Qnil : make_char (c); | 1383 return c < 0 ? Qnil : make_char (c); |
2138 } | 1384 } |
2139 | 1385 |
2140 DEFUN ("character-to-event", Fcharacter_to_event, 1, 4, 0, /* | 1386 DEFUN ("character-to-event", Fcharacter_to_event, 1, 4, 0, /* |
2141 Convert KEY-DESCRIPTION into an event structure, replete with bucky bits. | 1387 Convert KEY-DESCRIPTION into an event structure, replete with bucky bits. |
2153 | 1399 |
2154 Optional third arg CONSOLE is the console to store in the event, and | 1400 Optional third arg CONSOLE is the console to store in the event, and |
2155 defaults to the selected console. | 1401 defaults to the selected console. |
2156 | 1402 |
2157 If KEY-DESCRIPTION is an integer or character, the high bit may be | 1403 If KEY-DESCRIPTION is an integer or character, the high bit may be |
2158 interpreted as the meta key. (This is done for backward compatibility | 1404 interpreted as the meta key. (This is done for backward compatibility in |
2159 in lots of places.) If USE-CONSOLE-META-FLAG is nil, this will always | 1405 lots of places -- specifically, because lots of Lisp code uses specs like |
2160 be the case. If USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for | 1406 ?\M-d and "\M-d" in key code, expecting this to work; yet these are in |
2161 CONSOLE affects whether the high bit is interpreted as a meta | 1407 reality converted directly to 8-bit characters by the Lisp reader.) If |
2162 key. (See `set-input-mode'.) If you don't want this silly meta | 1408 USE-CONSOLE-META-FLAG is nil or CONSOLE is not a TTY, this will always be |
2163 interpretation done, you should pass in a list containing the | 1409 the case. If USE-CONSOLE-META-FLAG is non-nil and CONSOLE is a TTY, the |
2164 character. | 1410 `meta' flag for CONSOLE affects whether the high bit is interpreted as a |
1411 meta key. (See `set-input-mode'.) Don't set this flag to non-nil unless | |
1412 you know what you're doing (more specifically, only if the character came | |
1413 directly from a TTY, not from the user). If you don't want this silly meta | |
1414 interpretation done, you should pass in a list containing the character. | |
2165 | 1415 |
2166 Beware that character-to-event and event-to-character are not strictly | 1416 Beware that character-to-event and event-to-character are not strictly |
2167 inverse functions, since events contain much more information than the | 1417 inverse functions, since events contain much more information than the |
2168 Lisp character object type can encode. | 1418 Lisp character object type can encode. |
2169 */ | 1419 */ |
2225 | 1475 |
2226 | 1476 |
2227 /* Concatenate a string description of EVENT onto the end of BUF. If | 1477 /* Concatenate a string description of EVENT onto the end of BUF. If |
2228 BRIEF, use short forms for keys, e.g. C- instead of control-. */ | 1478 BRIEF, use short forms for keys, e.g. C- instead of control-. */ |
2229 | 1479 |
2230 #ifdef USE_KKCC | |
2231 void | 1480 void |
2232 format_event_object (Eistring *buf, Lisp_Object event, int brief) | 1481 format_event_object (Eistring *buf, Lisp_Object event, int brief) |
2233 #else /* not USE_KKCC */ | |
2234 void | |
2235 format_event_object (Eistring *buf, Lisp_Event *event, int brief) | |
2236 #endif /* not USE_KKCC */ | |
2237 { | 1482 { |
2238 int mouse_p = 0; | 1483 int mouse_p = 0; |
2239 int mod = 0; | 1484 int mod = 0; |
2240 Lisp_Object key; | 1485 Lisp_Object key; |
2241 | 1486 |
2242 #ifdef USE_KKCC | 1487 switch (XEVENT_TYPE (event)) |
2243 switch (EVENT_TYPE (XEVENT(event))) | |
2244 #else /* not USE_KKCC */ | |
2245 switch (event->event_type) | |
2246 #endif /* not USE_KKCC */ | |
2247 { | 1488 { |
2248 case key_press_event: | 1489 case key_press_event: |
2249 { | 1490 { |
2250 #ifdef USE_KKCC | 1491 mod = XEVENT_KEY_MODIFIERS (event); |
2251 mod = XKEY_DATA_MODIFIERS (XEVENT_DATA(event)); | 1492 key = XEVENT_KEY_KEYSYM (event); |
2252 key = XKEY_DATA_KEYSYM (XEVENT_DATA(event)); | |
2253 #else /* not USE_KKCC */ | |
2254 mod = event->event.key.modifiers; | |
2255 key = event->event.key.keysym; | |
2256 #endif /* not USE_KKCC */ | |
2257 /* Hack. */ | 1493 /* Hack. */ |
2258 if (! brief && CHARP (key) && | 1494 if (! brief && CHARP (key) && |
2259 mod & (XEMACS_MOD_CONTROL | XEMACS_MOD_META | XEMACS_MOD_SUPER | | 1495 mod & (XEMACS_MOD_CONTROL | XEMACS_MOD_META | XEMACS_MOD_SUPER | |
2260 XEMACS_MOD_HYPER)) | 1496 XEMACS_MOD_HYPER)) |
2261 { | 1497 { |
2271 mouse_p++; | 1507 mouse_p++; |
2272 /* Fall through */ | 1508 /* Fall through */ |
2273 case button_press_event: | 1509 case button_press_event: |
2274 { | 1510 { |
2275 mouse_p++; | 1511 mouse_p++; |
2276 #ifdef USE_KKCC | 1512 mod = XEVENT_BUTTON_MODIFIERS (event); |
2277 mod = XBUTTON_DATA_MODIFIERS (XEVENT_DATA(event)); | 1513 key = make_char (XEVENT_BUTTON_BUTTON (event) + '0'); |
2278 key = make_char (XBUTTON_DATA_BUTTON (XEVENT_DATA(event)) + '0'); | |
2279 #else /* not USE_KKCC */ | |
2280 mod = event->event.button.modifiers; | |
2281 key = make_char (event->event.button.button + '0'); | |
2282 #endif /* not USE_KKCC */ | |
2283 break; | 1514 break; |
2284 } | 1515 } |
2285 case magic_event: | 1516 case magic_event: |
2286 { | 1517 { |
2287 Lisp_Object stream; | 1518 Lisp_Object stream; |
2288 struct gcpro gcpro1; | 1519 struct gcpro gcpro1; |
2289 GCPRO1 (stream); | 1520 GCPRO1 (stream); |
2290 | 1521 |
2291 stream = make_resizing_buffer_output_stream (); | 1522 stream = make_resizing_buffer_output_stream (); |
2292 #ifdef USE_KKCC | 1523 event_stream_format_magic_event (XEVENT (event), stream); |
2293 event_stream_format_magic_event (XEVENT(event), stream); | |
2294 #else /* not USE_KKCC */ | |
2295 event_stream_format_magic_event (event, stream); | |
2296 #endif /* not USE_KKCC */ | |
2297 Lstream_flush (XLSTREAM (stream)); | 1524 Lstream_flush (XLSTREAM (stream)); |
2298 eicat_raw (buf, resizing_buffer_stream_ptr (XLSTREAM (stream)), | 1525 eicat_raw (buf, resizing_buffer_stream_ptr (XLSTREAM (stream)), |
2299 Lstream_byte_count (XLSTREAM (stream))); | 1526 Lstream_byte_count (XLSTREAM (stream))); |
2300 Lstream_delete (XLSTREAM (stream)); | 1527 Lstream_delete (XLSTREAM (stream)); |
2301 UNGCPRO; | 1528 UNGCPRO; |
2353 abort (); | 1580 abort (); |
2354 if (mouse_p) | 1581 if (mouse_p) |
2355 eicat_c (buf, "up"); | 1582 eicat_c (buf, "up"); |
2356 } | 1583 } |
2357 | 1584 |
1585 void | |
1586 upshift_event (Lisp_Object event) | |
1587 { | |
1588 Lisp_Object keysym = XEVENT_KEY_KEYSYM (event); | |
1589 Ichar c = 0; | |
1590 | |
1591 if (CHAR_OR_CHAR_INTP (keysym) | |
1592 && ((c = XCHAR_OR_CHAR_INT (keysym)), | |
1593 c >= 'a' && c <= 'z')) | |
1594 XSET_EVENT_KEY_KEYSYM (event, make_char (c + 'A' - 'a')); | |
1595 else | |
1596 if (!(XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_SHIFT)) | |
1597 XSET_EVENT_KEY_MODIFIERS | |
1598 (event, XEVENT_KEY_MODIFIERS (event) |= XEMACS_MOD_SHIFT); | |
1599 } | |
1600 | |
1601 void | |
1602 downshift_event (Lisp_Object event) | |
1603 { | |
1604 Lisp_Object keysym = XEVENT_KEY_KEYSYM (event); | |
1605 Ichar c = 0; | |
1606 | |
1607 if (XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_SHIFT) | |
1608 XSET_EVENT_KEY_MODIFIERS | |
1609 (event, XEVENT_KEY_MODIFIERS (event) & ~XEMACS_MOD_SHIFT); | |
1610 else if (CHAR_OR_CHAR_INTP (keysym) | |
1611 && ((c = XCHAR_OR_CHAR_INT (keysym)), | |
1612 c >= 'A' && c <= 'Z')) | |
1613 XSET_EVENT_KEY_KEYSYM (event, make_char (c + 'a' - 'A')); | |
1614 } | |
1615 | |
1616 int | |
1617 event_upshifted_p (Lisp_Object event) | |
1618 { | |
1619 Lisp_Object keysym = XEVENT_KEY_KEYSYM (event); | |
1620 Ichar c = 0; | |
1621 | |
1622 if ((XEVENT_KEY_MODIFIERS (event) & XEMACS_MOD_SHIFT) | |
1623 || (CHAR_OR_CHAR_INTP (keysym) | |
1624 && ((c = XCHAR_OR_CHAR_INT (keysym)), | |
1625 c >= 'A' && c <= 'Z'))) | |
1626 return 1; | |
1627 else | |
1628 return 0; | |
1629 } | |
2358 | 1630 |
2359 DEFUN ("eventp", Feventp, 1, 1, 0, /* | 1631 DEFUN ("eventp", Feventp, 1, 1, 0, /* |
2360 True if OBJECT is an event object. | 1632 True if OBJECT is an event object. |
2361 */ | 1633 */ |
2362 (object)) | 1634 (object)) |
2367 DEFUN ("event-live-p", Fevent_live_p, 1, 1, 0, /* | 1639 DEFUN ("event-live-p", Fevent_live_p, 1, 1, 0, /* |
2368 True if OBJECT is an event object that has not been deallocated. | 1640 True if OBJECT is an event object that has not been deallocated. |
2369 */ | 1641 */ |
2370 (object)) | 1642 (object)) |
2371 { | 1643 { |
2372 #ifdef USE_KKCC | |
2373 return EVENTP (object) && XEVENT_TYPE (object) != dead_event ? | 1644 return EVENTP (object) && XEVENT_TYPE (object) != dead_event ? |
2374 Qt : Qnil; | 1645 Qt : Qnil; |
2375 #else /* not USE_KKCC */ | |
2376 return EVENTP (object) && XEVENT (object)->event_type != dead_event ? | |
2377 Qt : Qnil; | |
2378 #endif /* not USE_KKCC */ | |
2379 } | 1646 } |
2380 | 1647 |
2381 #if 0 /* debugging functions */ | 1648 #if 0 /* debugging functions */ |
2382 | 1649 |
2383 DEFUN ("event-next", Fevent_next, 1, 1, 0, /* | 1650 DEFUN ("event-next", Fevent_next, 1, 1, 0, /* |
2439 | 1706 |
2440 */ | 1707 */ |
2441 (event)) | 1708 (event)) |
2442 { | 1709 { |
2443 CHECK_LIVE_EVENT (event); | 1710 CHECK_LIVE_EVENT (event); |
2444 #ifdef USE_KKCC | |
2445 switch (XEVENT_TYPE (event)) | 1711 switch (XEVENT_TYPE (event)) |
2446 #else /* not USE_KKCC */ | |
2447 switch (XEVENT (event)->event_type) | |
2448 #endif /* not USE_KKCC */ | |
2449 { | 1712 { |
2450 case key_press_event: return Qkey_press; | 1713 case key_press_event: return Qkey_press; |
2451 case button_press_event: return Qbutton_press; | 1714 case button_press_event: return Qbutton_press; |
2452 case button_release_event: return Qbutton_release; | 1715 case button_release_event: return Qbutton_release; |
2453 case misc_user_event: return Qmisc_user; | 1716 case misc_user_event: return Qmisc_user; |
2479 { | 1742 { |
2480 CHECK_LIVE_EVENT (event); | 1743 CHECK_LIVE_EVENT (event); |
2481 /* This junk is so that timestamps don't get to be negative, but contain | 1744 /* This junk is so that timestamps don't get to be negative, but contain |
2482 as many bits as this particular emacs will allow. | 1745 as many bits as this particular emacs will allow. |
2483 */ | 1746 */ |
2484 #ifdef USE_KKCC | |
2485 return make_int (((1L << (VALBITS - 1)) - 1) & | 1747 return make_int (((1L << (VALBITS - 1)) - 1) & |
2486 XEVENT_TIMESTAMP (event)); | 1748 XEVENT_TIMESTAMP (event)); |
2487 #else /* not USE_KKCC */ | |
2488 return make_int (((1L << (VALBITS - 1)) - 1) & | |
2489 XEVENT (event)->timestamp); | |
2490 #endif /* not USE_KKCC */ | |
2491 } | 1749 } |
2492 | 1750 |
2493 #define TIMESTAMP_HALFSPACE (1L << (VALBITS - 2)) | 1751 #define TIMESTAMP_HALFSPACE (1L << (VALBITS - 2)) |
2494 | 1752 |
2495 DEFUN ("event-timestamp<", Fevent_timestamp_lessp, 2, 2, 0, /* | 1753 DEFUN ("event-timestamp<", Fevent_timestamp_lessp, 2, 2, 0, /* |
2510 return t2 - t1 < TIMESTAMP_HALFSPACE ? Qt : Qnil; | 1768 return t2 - t1 < TIMESTAMP_HALFSPACE ? Qt : Qnil; |
2511 else | 1769 else |
2512 return t1 - t2 < TIMESTAMP_HALFSPACE ? Qnil : Qt; | 1770 return t1 - t2 < TIMESTAMP_HALFSPACE ? Qnil : Qt; |
2513 } | 1771 } |
2514 | 1772 |
2515 #ifdef USE_KKCC | |
2516 #define CHECK_EVENT_TYPE(e,t1,sym) do { \ | 1773 #define CHECK_EVENT_TYPE(e,t1,sym) do { \ |
2517 CHECK_LIVE_EVENT (e); \ | 1774 CHECK_LIVE_EVENT (e); \ |
2518 if (XEVENT_TYPE (e) != (t1)) \ | 1775 if (XEVENT_TYPE (e) != (t1)) \ |
2519 e = wrong_type_argument (sym,e); \ | 1776 e = wrong_type_argument (sym,e); \ |
2520 } while (0) | 1777 } while (0) |
2521 #else /* not USE_KKCC */ | 1778 |
2522 #define CHECK_EVENT_TYPE(e,t1,sym) do { \ | |
2523 CHECK_LIVE_EVENT (e); \ | |
2524 if (XEVENT(e)->event_type != (t1)) \ | |
2525 e = wrong_type_argument (sym,e); \ | |
2526 } while (0) | |
2527 #endif /* not USE_KKCC */ | |
2528 | |
2529 #ifdef USE_KKCC | |
2530 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \ | 1779 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \ |
2531 CHECK_LIVE_EVENT (e); \ | 1780 CHECK_LIVE_EVENT (e); \ |
2532 { \ | 1781 { \ |
2533 emacs_event_type CET_type = XEVENT_TYPE (e); \ | 1782 emacs_event_type CET_type = XEVENT_TYPE (e); \ |
2534 if (CET_type != (t1) && \ | 1783 if (CET_type != (t1) && \ |
2535 CET_type != (t2)) \ | 1784 CET_type != (t2)) \ |
2536 e = wrong_type_argument (sym,e); \ | 1785 e = wrong_type_argument (sym,e); \ |
2537 } \ | 1786 } \ |
2538 } while (0) | 1787 } while (0) |
2539 #else /* not USE_KKCC */ | 1788 |
2540 #define CHECK_EVENT_TYPE2(e,t1,t2,sym) do { \ | |
2541 CHECK_LIVE_EVENT (e); \ | |
2542 { \ | |
2543 emacs_event_type CET_type = XEVENT (e)->event_type; \ | |
2544 if (CET_type != (t1) && \ | |
2545 CET_type != (t2)) \ | |
2546 e = wrong_type_argument (sym,e); \ | |
2547 } \ | |
2548 } while (0) | |
2549 #endif /* not USE_KKCC */ | |
2550 | |
2551 #ifdef USE_KKCC | |
2552 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \ | 1789 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \ |
2553 CHECK_LIVE_EVENT (e); \ | 1790 CHECK_LIVE_EVENT (e); \ |
2554 { \ | 1791 { \ |
2555 emacs_event_type CET_type = XEVENT_TYPE (e); \ | 1792 emacs_event_type CET_type = XEVENT_TYPE (e); \ |
2556 if (CET_type != (t1) && \ | 1793 if (CET_type != (t1) && \ |
2557 CET_type != (t2) && \ | 1794 CET_type != (t2) && \ |
2558 CET_type != (t3)) \ | 1795 CET_type != (t3)) \ |
2559 e = wrong_type_argument (sym,e); \ | 1796 e = wrong_type_argument (sym,e); \ |
2560 } \ | 1797 } \ |
2561 } while (0) | 1798 } while (0) |
2562 #else /* not USE_KKCC */ | |
2563 #define CHECK_EVENT_TYPE3(e,t1,t2,t3,sym) do { \ | |
2564 CHECK_LIVE_EVENT (e); \ | |
2565 { \ | |
2566 emacs_event_type CET_type = XEVENT (e)->event_type; \ | |
2567 if (CET_type != (t1) && \ | |
2568 CET_type != (t2) && \ | |
2569 CET_type != (t3)) \ | |
2570 e = wrong_type_argument (sym,e); \ | |
2571 } \ | |
2572 } while (0) | |
2573 #endif /* not USE_KKCC */ | |
2574 | 1799 |
2575 DEFUN ("event-key", Fevent_key, 1, 1, 0, /* | 1800 DEFUN ("event-key", Fevent_key, 1, 1, 0, /* |
2576 Return the Keysym of the key-press event EVENT. | 1801 Return the Keysym of the key-press event EVENT. |
2577 This will be a character if the event is associated with one, else a symbol. | 1802 This will be a character if the event is associated with one, else a symbol. |
2578 */ | 1803 */ |
2579 (event)) | 1804 (event)) |
2580 { | 1805 { |
2581 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p); | 1806 CHECK_EVENT_TYPE (event, key_press_event, Qkey_press_event_p); |
2582 #ifdef USE_KKCC | 1807 return XEVENT_KEY_KEYSYM (event); |
2583 return XKEY_DATA_KEYSYM (XEVENT_DATA (event)); | |
2584 #else /* not USE_KKCC */ | |
2585 return XEVENT (event)->event.key.keysym; | |
2586 #endif /* not USE_KKCC */ | |
2587 } | 1808 } |
2588 | 1809 |
2589 DEFUN ("event-button", Fevent_button, 1, 1, 0, /* | 1810 DEFUN ("event-button", Fevent_button, 1, 1, 0, /* |
2590 Return the button-number of the button-press or button-release event EVENT. | 1811 Return the button-number of the button-press or button-release event EVENT. |
2591 */ | 1812 */ |
2592 (event)) | 1813 (event)) |
2593 { | 1814 { |
2594 | |
2595 CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event, | 1815 CHECK_EVENT_TYPE3 (event, button_press_event, button_release_event, |
2596 misc_user_event, Qbutton_event_p); | 1816 misc_user_event, Qbutton_event_p); |
2597 #ifdef HAVE_WINDOW_SYSTEM | 1817 #ifdef HAVE_WINDOW_SYSTEM |
2598 #ifdef USE_KKCC | 1818 if (XEVENT_TYPE (event) == misc_user_event) |
2599 if ( XEVENT_TYPE (event) == misc_user_event) | 1819 return make_int (XEVENT_MISC_USER_BUTTON (event)); |
2600 return make_int (XMISC_USER_DATA_BUTTON (XEVENT_DATA (event))); | |
2601 else | 1820 else |
2602 return make_int (XBUTTON_DATA_BUTTON (XEVENT_DATA (event))); | 1821 return make_int (XEVENT_BUTTON_BUTTON (event)); |
2603 #else /* not USE_KKCC */ | |
2604 if ( XEVENT (event)->event_type == misc_user_event) | |
2605 return make_int (XEVENT (event)->event.misc.button); | |
2606 else | |
2607 return make_int (XEVENT (event)->event.button.button); | |
2608 #endif /* not USE_KKCC */ | |
2609 #else /* !HAVE_WINDOW_SYSTEM */ | 1822 #else /* !HAVE_WINDOW_SYSTEM */ |
2610 return Qzero; | 1823 return Qzero; |
2611 #endif /* !HAVE_WINDOW_SYSTEM */ | 1824 #endif /* !HAVE_WINDOW_SYSTEM */ |
2612 | |
2613 } | 1825 } |
2614 | 1826 |
2615 DEFUN ("event-modifier-bits", Fevent_modifier_bits, 1, 1, 0, /* | 1827 DEFUN ("event-modifier-bits", Fevent_modifier_bits, 1, 1, 0, /* |
2616 Return a number representing the modifier keys and buttons which were down | 1828 Return a number representing the modifier keys and buttons which were down |
2617 when the given mouse or keyboard event was produced. | 1829 when the given mouse or keyboard event was produced. |
2619 */ | 1831 */ |
2620 (event)) | 1832 (event)) |
2621 { | 1833 { |
2622 again: | 1834 again: |
2623 CHECK_LIVE_EVENT (event); | 1835 CHECK_LIVE_EVENT (event); |
2624 #ifdef USE_KKCC | |
2625 switch (XEVENT_TYPE (event)) | 1836 switch (XEVENT_TYPE (event)) |
2626 { | 1837 { |
2627 case key_press_event: | 1838 case key_press_event: |
2628 return make_int (XKEY_DATA_MODIFIERS (XEVENT_DATA (event))); | 1839 return make_int (XEVENT_KEY_MODIFIERS (event)); |
2629 case button_press_event: | 1840 case button_press_event: |
2630 case button_release_event: | 1841 case button_release_event: |
2631 return make_int (XBUTTON_DATA_MODIFIERS (XEVENT_DATA (event))); | 1842 return make_int (XEVENT_BUTTON_MODIFIERS (event)); |
2632 case pointer_motion_event: | 1843 case pointer_motion_event: |
2633 return make_int (XMOTION_DATA_MODIFIERS (XEVENT_DATA (event))); | 1844 return make_int (XEVENT_MOTION_MODIFIERS (event)); |
2634 case misc_user_event: | 1845 case misc_user_event: |
2635 return make_int (XMISC_USER_DATA_MODIFIERS (XEVENT_DATA (event))); | 1846 return make_int (XEVENT_MISC_USER_MODIFIERS (event)); |
2636 default: | 1847 default: |
2637 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event); | 1848 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event); |
2638 goto again; | 1849 goto again; |
2639 } | 1850 } |
2640 #else /* not USE_KKCC */ | |
2641 switch (XEVENT (event)->event_type) | |
2642 { | |
2643 case key_press_event: | |
2644 return make_int (XEVENT (event)->event.key.modifiers); | |
2645 case button_press_event: | |
2646 case button_release_event: | |
2647 return make_int (XEVENT (event)->event.button.modifiers); | |
2648 case pointer_motion_event: | |
2649 return make_int (XEVENT (event)->event.motion.modifiers); | |
2650 case misc_user_event: | |
2651 return make_int (XEVENT (event)->event.misc.modifiers); | |
2652 default: | |
2653 event = wrong_type_argument (intern ("key-or-mouse-event-p"), event); | |
2654 goto again; | |
2655 } | |
2656 #endif /* not USE_KKCC */ | |
2657 } | 1851 } |
2658 | 1852 |
2659 DEFUN ("event-modifiers", Fevent_modifiers, 1, 1, 0, /* | 1853 DEFUN ("event-modifiers", Fevent_modifiers, 1, 1, 0, /* |
2660 Return a list of symbols, the names of the modifier keys and buttons | 1854 Return a list of symbols, the names of the modifier keys and buttons |
2661 which were down when the given mouse or keyboard event was produced. | 1855 which were down when the given mouse or keyboard event was produced. |
2724 event_x_y_pixel_internal (Lisp_Object event, int *x, int *y, int relative) | 1918 event_x_y_pixel_internal (Lisp_Object event, int *x, int *y, int relative) |
2725 { | 1919 { |
2726 struct window *w; | 1920 struct window *w; |
2727 struct frame *f; | 1921 struct frame *f; |
2728 | 1922 |
2729 #ifdef USE_KKCC | |
2730 if (XEVENT_TYPE (event) == pointer_motion_event) | 1923 if (XEVENT_TYPE (event) == pointer_motion_event) |
2731 { | 1924 { |
2732 *x = XMOTION_DATA_X (XEVENT_DATA (event)); | 1925 *x = XEVENT_MOTION_X (event); |
2733 *y = XMOTION_DATA_Y (XEVENT_DATA (event)); | 1926 *y = XEVENT_MOTION_Y (event); |
2734 } | 1927 } |
2735 else if (XEVENT_TYPE (event) == button_press_event || | 1928 else if (XEVENT_TYPE (event) == button_press_event || |
2736 XEVENT_TYPE (event) == button_release_event) | 1929 XEVENT_TYPE (event) == button_release_event) |
2737 { | 1930 { |
2738 *x = XBUTTON_DATA_X (XEVENT_DATA (event)); | 1931 *x = XEVENT_BUTTON_X (event); |
2739 *y = XBUTTON_DATA_Y (XEVENT_DATA (event)); | 1932 *y = XEVENT_BUTTON_Y (event); |
2740 } | 1933 } |
2741 else if (XEVENT_TYPE (event) == misc_user_event) | 1934 else if (XEVENT_TYPE (event) == misc_user_event) |
2742 { | 1935 { |
2743 *x = XMISC_USER_DATA_X (XEVENT_DATA (event)); | 1936 *x = XEVENT_MISC_USER_X (event); |
2744 *y = XMISC_USER_DATA_Y (XEVENT_DATA (event)); | 1937 *y = XEVENT_MISC_USER_Y (event); |
2745 } | 1938 } |
2746 else | 1939 else |
2747 return 0; | 1940 return 0; |
2748 #else /* not USE_KKCC */ | |
2749 if (XEVENT (event)->event_type == pointer_motion_event) | |
2750 { | |
2751 *x = XEVENT (event)->event.motion.x; | |
2752 *y = XEVENT (event)->event.motion.y; | |
2753 } | |
2754 else if (XEVENT (event)->event_type == button_press_event || | |
2755 XEVENT (event)->event_type == button_release_event) | |
2756 { | |
2757 *x = XEVENT (event)->event.button.x; | |
2758 *y = XEVENT (event)->event.button.y; | |
2759 } | |
2760 else if (XEVENT (event)->event_type == misc_user_event) | |
2761 { | |
2762 *x = XEVENT (event)->event.misc.x; | |
2763 *y = XEVENT (event)->event.misc.y; | |
2764 } | |
2765 else | |
2766 return 0; | |
2767 #endif /* not USE_KKCC */ | |
2768 f = XFRAME (EVENT_CHANNEL (XEVENT (event))); | 1941 f = XFRAME (EVENT_CHANNEL (XEVENT (event))); |
2769 | 1942 |
2770 if (relative) | 1943 if (relative) |
2771 { | 1944 { |
2772 w = find_window_by_pixel_pos (*x, *y, f->root_window); | 1945 w = find_window_by_pixel_pos (*x, *y, f->root_window); |
2899 Charbpos ret_bufp, ret_closest; | 2072 Charbpos ret_bufp, ret_closest; |
2900 Charcount ret_modeline_closest; | 2073 Charcount ret_modeline_closest; |
2901 Lisp_Object ret_obj1, ret_obj2; | 2074 Lisp_Object ret_obj1, ret_obj2; |
2902 | 2075 |
2903 CHECK_LIVE_EVENT (event); | 2076 CHECK_LIVE_EVENT (event); |
2904 #ifdef USE_KKCC | |
2905 frame = XEVENT_CHANNEL (event); | 2077 frame = XEVENT_CHANNEL (event); |
2906 switch (XEVENT_TYPE (event)) | 2078 switch (XEVENT_TYPE (event)) |
2907 { | 2079 { |
2908 case pointer_motion_event : | 2080 case pointer_motion_event : |
2909 pix_x = XMOTION_DATA_X (XEVENT_DATA (event)); | 2081 pix_x = XEVENT_MOTION_X (event); |
2910 pix_y = XMOTION_DATA_Y (XEVENT_DATA (event)); | 2082 pix_y = XEVENT_MOTION_Y (event); |
2911 break; | 2083 break; |
2912 case button_press_event : | 2084 case button_press_event : |
2913 case button_release_event : | 2085 case button_release_event : |
2914 pix_x = XBUTTON_DATA_X (XEVENT_DATA (event)); | 2086 pix_x = XEVENT_BUTTON_X (event); |
2915 pix_y = XBUTTON_DATA_Y (XEVENT_DATA (event)); | 2087 pix_y = XEVENT_BUTTON_Y (event); |
2916 break; | 2088 break; |
2917 case misc_user_event : | 2089 case misc_user_event : |
2918 pix_x = XMISC_USER_DATA_X (XEVENT_DATA (event)); | 2090 pix_x = XEVENT_MISC_USER_X (event); |
2919 pix_y = XMISC_USER_DATA_Y (XEVENT_DATA (event)); | 2091 pix_y = XEVENT_MISC_USER_Y (event); |
2920 break; | 2092 break; |
2921 default: | 2093 default: |
2922 dead_wrong_type_argument (Qmouse_event_p, event); | 2094 dead_wrong_type_argument (Qmouse_event_p, event); |
2923 } | 2095 } |
2924 #else /* not USE_KKCC */ | |
2925 frame = XEVENT (event)->channel; | |
2926 switch (XEVENT (event)->event_type) | |
2927 { | |
2928 case pointer_motion_event : | |
2929 pix_x = XEVENT (event)->event.motion.x; | |
2930 pix_y = XEVENT (event)->event.motion.y; | |
2931 break; | |
2932 case button_press_event : | |
2933 case button_release_event : | |
2934 pix_x = XEVENT (event)->event.button.x; | |
2935 pix_y = XEVENT (event)->event.button.y; | |
2936 break; | |
2937 case misc_user_event : | |
2938 pix_x = XEVENT (event)->event.misc.x; | |
2939 pix_y = XEVENT (event)->event.misc.y; | |
2940 break; | |
2941 default: | |
2942 dead_wrong_type_argument (Qmouse_event_p, event); | |
2943 } | |
2944 #endif /* not USE_KKCC */ | |
2945 | 2096 |
2946 result = pixel_to_glyph_translation (XFRAME (frame), pix_x, pix_y, | 2097 result = pixel_to_glyph_translation (XFRAME (frame), pix_x, pix_y, |
2947 &ret_x, &ret_y, &ret_obj_x, &ret_obj_y, | 2098 &ret_x, &ret_y, &ret_obj_x, &ret_obj_y, |
2948 &ret_w, &ret_bufp, &ret_closest, | 2099 &ret_w, &ret_bufp, &ret_closest, |
2949 &ret_modeline_closest, | 2100 &ret_modeline_closest, |
3248 DEFUN ("event-process", Fevent_process, 1, 1, 0, /* | 2399 DEFUN ("event-process", Fevent_process, 1, 1, 0, /* |
3249 Return the process of the process-output event EVENT. | 2400 Return the process of the process-output event EVENT. |
3250 */ | 2401 */ |
3251 (event)) | 2402 (event)) |
3252 { | 2403 { |
3253 #ifdef USE_KKCC | |
3254 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p); | 2404 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p); |
3255 return XPROCESS_DATA_PROCESS (XEVENT_DATA (event)); | 2405 return XEVENT_PROCESS_PROCESS (event); |
3256 #else /* not USE_KKCC */ | |
3257 CHECK_EVENT_TYPE (event, process_event, Qprocess_event_p); | |
3258 return XEVENT (event)->event.process.process; | |
3259 #endif /* not USE_KKCC */ | |
3260 } | 2406 } |
3261 | 2407 |
3262 DEFUN ("event-function", Fevent_function, 1, 1, 0, /* | 2408 DEFUN ("event-function", Fevent_function, 1, 1, 0, /* |
3263 Return the callback function of EVENT. | 2409 Return the callback function of EVENT. |
3264 EVENT should be a timeout, misc-user, or eval event. | 2410 EVENT should be a timeout, misc-user, or eval event. |
3265 */ | 2411 */ |
3266 (event)) | 2412 (event)) |
3267 { | 2413 { |
3268 again: | 2414 again: |
3269 CHECK_LIVE_EVENT (event); | 2415 CHECK_LIVE_EVENT (event); |
3270 #ifdef USE_KKCC | |
3271 switch (XEVENT_TYPE (event)) | 2416 switch (XEVENT_TYPE (event)) |
3272 { | 2417 { |
3273 case timeout_event: | 2418 case timeout_event: |
3274 return XTIMEOUT_DATA_FUNCTION (XEVENT_DATA (event)); | 2419 return XEVENT_TIMEOUT_FUNCTION (event); |
3275 case misc_user_event: | 2420 case misc_user_event: |
3276 return XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event)); | 2421 return XEVENT_MISC_USER_FUNCTION (event); |
3277 case eval_event: | 2422 case eval_event: |
3278 return XEVAL_DATA_FUNCTION (XEVENT_DATA (event)); | 2423 return XEVENT_EVAL_FUNCTION (event); |
3279 default: | 2424 default: |
3280 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); | 2425 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); |
3281 goto again; | 2426 goto again; |
3282 } | 2427 } |
3283 #else /* not USE_KKCC */ | 2428 } |
3284 switch (XEVENT (event)->event_type) | 2429 |
2430 DEFUN ("event-object", Fevent_object, 1, 1, 0, /* | |
2431 Return the callback function argument of EVENT. | |
2432 EVENT should be a timeout, misc-user, or eval event. | |
2433 */ | |
2434 (event)) | |
2435 { | |
2436 again: | |
2437 CHECK_LIVE_EVENT (event); | |
2438 switch (XEVENT_TYPE (event)) | |
3285 { | 2439 { |
3286 case timeout_event: | 2440 case timeout_event: |
3287 return XEVENT (event)->event.timeout.function; | 2441 return XEVENT_TIMEOUT_OBJECT (event); |
3288 case misc_user_event: | 2442 case misc_user_event: |
3289 return XEVENT (event)->event.misc.function; | 2443 return XEVENT_MISC_USER_OBJECT (event); |
3290 case eval_event: | 2444 case eval_event: |
3291 return XEVENT (event)->event.eval.function; | 2445 return XEVENT_EVAL_OBJECT (event); |
3292 default: | 2446 default: |
3293 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); | 2447 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); |
3294 goto again; | 2448 goto again; |
3295 } | 2449 } |
3296 #endif /* not USE_KKCC */ | |
3297 } | |
3298 | |
3299 DEFUN ("event-object", Fevent_object, 1, 1, 0, /* | |
3300 Return the callback function argument of EVENT. | |
3301 EVENT should be a timeout, misc-user, or eval event. | |
3302 */ | |
3303 (event)) | |
3304 { | |
3305 again: | |
3306 CHECK_LIVE_EVENT (event); | |
3307 #ifdef USE_KKCC | |
3308 switch (XEVENT_TYPE (event)) | |
3309 { | |
3310 case timeout_event: | |
3311 return XTIMEOUT_DATA_OBJECT (XEVENT_DATA (event)); | |
3312 case misc_user_event: | |
3313 return XMISC_USER_DATA_OBJECT (XEVENT_DATA (event)); | |
3314 case eval_event: | |
3315 return XEVAL_DATA_OBJECT (XEVENT_DATA (event)); | |
3316 default: | |
3317 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); | |
3318 goto again; | |
3319 } | |
3320 #else /* not USE_KKCC */ | |
3321 switch (XEVENT (event)->event_type) | |
3322 { | |
3323 case timeout_event: | |
3324 return XEVENT (event)->event.timeout.object; | |
3325 case misc_user_event: | |
3326 return XEVENT (event)->event.misc.object; | |
3327 case eval_event: | |
3328 return XEVENT (event)->event.eval.object; | |
3329 default: | |
3330 event = wrong_type_argument (intern ("timeout-or-eval-event-p"), event); | |
3331 goto again; | |
3332 } | |
3333 #endif /* not USE_KKCC */ | |
3334 } | 2450 } |
3335 | 2451 |
3336 DEFUN ("event-properties", Fevent_properties, 1, 1, 0, /* | 2452 DEFUN ("event-properties", Fevent_properties, 1, 1, 0, /* |
3337 Return a list of all of the properties of EVENT. | 2453 Return a list of all of the properties of EVENT. |
3338 This is in the form of a property list (alternating keyword/value pairs). | 2454 This is in the form of a property list (alternating keyword/value pairs). |
3347 e = XEVENT (event); | 2463 e = XEVENT (event); |
3348 GCPRO1 (props); | 2464 GCPRO1 (props); |
3349 | 2465 |
3350 props = cons3 (Qtimestamp, Fevent_timestamp (event), props); | 2466 props = cons3 (Qtimestamp, Fevent_timestamp (event), props); |
3351 | 2467 |
3352 #ifdef USE_KKCC | |
3353 switch (EVENT_TYPE (e)) | 2468 switch (EVENT_TYPE (e)) |
3354 #else /* not USE_KKCC */ | |
3355 switch (e->event_type) | |
3356 #endif /* not USE_KKCC */ | |
3357 { | 2469 { |
3358 default: abort (); | 2470 default: abort (); |
3359 | 2471 |
3360 case process_event: | 2472 case process_event: |
3361 #ifdef USE_KKCC | 2473 props = cons3 (Qprocess, EVENT_PROCESS_PROCESS (e), props); |
3362 props = cons3 (Qprocess, XPROCESS_DATA_PROCESS (EVENT_DATA (e)), props); | |
3363 #else /* not USE_KKCC */ | |
3364 props = cons3 (Qprocess, e->event.process.process, props); | |
3365 #endif /* not USE_KKCC */ | |
3366 break; | 2474 break; |
3367 | 2475 |
3368 case timeout_event: | 2476 case timeout_event: |
3369 props = cons3 (Qobject, Fevent_object (event), props); | 2477 props = cons3 (Qobject, Fevent_object (event), props); |
3370 props = cons3 (Qfunction, Fevent_function (event), props); | 2478 props = cons3 (Qfunction, Fevent_function (event), props); |
3371 #ifdef USE_KKCC | 2479 props = cons3 (Qid, make_int (EVENT_TIMEOUT_ID_NUMBER (e)), props); |
3372 props = cons3 (Qid, make_int (XTIMEOUT_DATA_ID_NUMBER (EVENT_DATA (e))), props); | |
3373 #else /* not USE_KKCC */ | |
3374 props = cons3 (Qid, make_int (e->event.timeout.id_number), props); | |
3375 #endif /* not USE_KKCC */ | |
3376 break; | 2480 break; |
3377 | 2481 |
3378 case key_press_event: | 2482 case key_press_event: |
3379 props = cons3 (Qmodifiers, Fevent_modifiers (event), props); | 2483 props = cons3 (Qmodifiers, Fevent_modifiers (event), props); |
3380 props = cons3 (Qkey, Fevent_key (event), props); | 2484 props = cons3 (Qkey, Fevent_key (event), props); |
3430 | 2534 |
3431 void | 2535 void |
3432 syms_of_events (void) | 2536 syms_of_events (void) |
3433 { | 2537 { |
3434 INIT_LRECORD_IMPLEMENTATION (event); | 2538 INIT_LRECORD_IMPLEMENTATION (event); |
3435 #ifdef USE_KKCC | 2539 #ifdef EVENT_DATA_AS_OBJECTS |
3436 INIT_LRECORD_IMPLEMENTATION (key_data); | 2540 INIT_LRECORD_IMPLEMENTATION (key_data); |
3437 INIT_LRECORD_IMPLEMENTATION (button_data); | 2541 INIT_LRECORD_IMPLEMENTATION (button_data); |
3438 INIT_LRECORD_IMPLEMENTATION (motion_data); | 2542 INIT_LRECORD_IMPLEMENTATION (motion_data); |
3439 INIT_LRECORD_IMPLEMENTATION (process_data); | 2543 INIT_LRECORD_IMPLEMENTATION (process_data); |
3440 INIT_LRECORD_IMPLEMENTATION (timeout_data); | 2544 INIT_LRECORD_IMPLEMENTATION (timeout_data); |
3441 INIT_LRECORD_IMPLEMENTATION (eval_data); | 2545 INIT_LRECORD_IMPLEMENTATION (eval_data); |
3442 INIT_LRECORD_IMPLEMENTATION (misc_user_data); | 2546 INIT_LRECORD_IMPLEMENTATION (misc_user_data); |
3443 INIT_LRECORD_IMPLEMENTATION (magic_eval_data); | 2547 INIT_LRECORD_IMPLEMENTATION (magic_eval_data); |
3444 INIT_LRECORD_IMPLEMENTATION (magic_data); | 2548 INIT_LRECORD_IMPLEMENTATION (magic_data); |
3445 #endif /* USE_KKCC */ | 2549 #endif /* EVENT_DATA_AS_OBJECTS */ |
3446 | 2550 |
3447 DEFSUBR (Fcharacter_to_event); | 2551 DEFSUBR (Fcharacter_to_event); |
3448 DEFSUBR (Fevent_to_character); | 2552 DEFSUBR (Fevent_to_character); |
3449 | 2553 |
3450 DEFSUBR (Fmake_event); | 2554 DEFSUBR (Fmake_event); |
3518 vars_of_events (void) | 2622 vars_of_events (void) |
3519 { | 2623 { |
3520 reinit_vars_of_events (); | 2624 reinit_vars_of_events (); |
3521 | 2625 |
3522 DEFVAR_LISP ("character-set-property", &Vcharacter_set_property /* | 2626 DEFVAR_LISP ("character-set-property", &Vcharacter_set_property /* |
3523 A symbol used to look up the 8-bit character of a keysym. | 2627 This is used to map e.g. `ocircumflex' to the appropriate character under X. |
3524 To convert a keysym symbol to an 8-bit code, as when that key is | 2628 This value of this variable (a symbol, normally `x-iso8859-1' if not nil) |
3525 bound to self-insert-command, we will look up the property that this | 2629 if used to look up a property on the keysym in question, which should |
3526 variable names on the property list of the keysym-symbol. The window- | 2630 correspond to a character. |
3527 system-specific code will set up appropriate properties and set this | 2631 |
3528 variable. | 2632 #### This is way bogus and will be removed soon. |
2633 | |
2634 The conversion between X keysyms and characters is now handled more or less | |
2635 automatically using XDisplayKeycodes(). | |
3529 */ ); | 2636 */ ); |
3530 Vcharacter_set_property = Qnil; | 2637 Vcharacter_set_property = Qnil; |
3531 } | 2638 } |