Mercurial > hg > xemacs-beta
comparison src/event-stream.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 | a123f88fa975 |
children | fffe735e63ee |
comparison
equal
deleted
inserted
replaced
1203:5f2f8dcbfb3e | 1204:e22b0213b713 |
---|---|
48 * macros. You'd be surprised how easy it is to break this. | 48 * macros. You'd be surprised how easy it is to break this. |
49 * | 49 * |
50 */ | 50 */ |
51 | 51 |
52 /* TODO: | 52 /* TODO: |
53 This stuff is way too hard to maintain - needs rework. | 53 [This stuff is way too hard to maintain - needs rework.] |
54 I don't think it's that bad in the main. I've done a fair amount of | |
55 cleanup work over the ages; the only stuff that's probably still somewhat | |
56 messy is the command-builder handling, which is that way because it's | |
57 trying to be "compatible" with pseudo-standards established by Emacs | |
58 v18. | |
54 | 59 |
55 The command builder should deal only with key and button events. | 60 The command builder should deal only with key and button events. |
56 Other command events should be able to come in the MIDDLE of a key | 61 Other command events should be able to come in the MIDDLE of a key |
57 sequence, without disturbing the key sequence composition, or the | 62 sequence, without disturbing the key sequence composition, or the |
58 command builder structure representing it. | 63 command builder structure representing it. |
272 struct event_stream *event_stream; | 277 struct event_stream *event_stream; |
273 | 278 |
274 static void echo_key_event (struct command_builder *, Lisp_Object event); | 279 static void echo_key_event (struct command_builder *, Lisp_Object event); |
275 static void maybe_kbd_translate (Lisp_Object event); | 280 static void maybe_kbd_translate (Lisp_Object event); |
276 | 281 |
277 /* This structure is basically a typeahead queue: things like | 282 /* There are two event queues here -- the command event queue (#### which |
278 wait-reading-process-output will delay the execution of | 283 should be called "deferred event queue" and is in my glyph ws) and the |
279 keyboard and mouse events by pushing them here. | 284 dispatch event queue (#### MS Windows actually has an extra dispatch |
280 | 285 queue for non-user events and uses the generic one only for user events; |
281 Chained through event_next() | 286 we should probably generalize this). |
282 command_event_queue_tail is a pointer to the last-added element. | 287 |
288 The dispatch queue (which used to occur duplicated inside of each event | |
289 implementation) is used for events that have been read from the | |
290 window-system event queue(s) and not yet process by | |
291 next_event_internal(). It exists for two reasons: (1) because in many | |
292 implementations, events often come from the window system by way of | |
293 callbacks, and need to push the event to be returned onto a queue; (2) | |
294 in order to handle QUIT in a guaranteed correct fashion without | |
295 resorting to weird implementation-specific hacks that may or may not | |
296 work well, we need to drain the window-system event queues and then look | |
297 through to see if there's an event matching quit-char (usually ^G). the | |
298 drained events need to go onto a queue. (There are other, similar cases | |
299 where we need to drain the pending events so we can look ahead -- for | |
300 example, checking for pending expose events under X to avoid excessive | |
301 server activity.) | |
302 | |
303 The command event queue is used *AFTER* an event has been read from | |
304 next_event_internal(), when it needs to be pushed back. This includes, | |
305 for example, accept-process-output, sleep-for and | |
306 wait_delaying_user_input(). Eval events and the like, generated by | |
307 enqueue-eval-event, enqueue_magic_eval_event(), etc. are also pushed | |
308 onto this queue. Some events generated by callbacks are also pushed | |
309 onto this queue, #### although maybe shouldn't be. | |
310 | |
311 The command queue takes precedence over the dispatch queue. | |
312 | |
313 #### It is worth investigating to see whether both queues are really | |
314 needed, and how exactly they should be used. enqueue-eval-event, for | |
315 example, could certainly push onto the dispatch queue, and all callbacks | |
316 maybe should. wait_delaying_user_input() seems to need both queues, | |
317 since it can take events from the dispatch queue and push them onto the | |
318 command queue; but it perhaps could be rewritten to avoid this. #### | |
319 In general we need to review the handling of these two queues, figure | |
320 out exactly what ought to be happening, and document it. | |
283 */ | 321 */ |
322 | |
284 static Lisp_Object command_event_queue; | 323 static Lisp_Object command_event_queue; |
285 static Lisp_Object command_event_queue_tail; | 324 static Lisp_Object command_event_queue_tail; |
325 | |
326 Lisp_Object dispatch_event_queue; | |
327 static Lisp_Object dispatch_event_queue_tail; | |
286 | 328 |
287 /* Nonzero means echo unfinished commands after this many seconds of pause. */ | 329 /* Nonzero means echo unfinished commands after this many seconds of pause. */ |
288 static Lisp_Object Vecho_keystrokes; | 330 static Lisp_Object Vecho_keystrokes; |
289 | 331 |
290 /* The number of keystrokes since the last auto-save. */ | 332 /* The number of keystrokes since the last auto-save. */ |
316 #define CHECK_COMMAND_BUILDER(x) CHECK_RECORD (x, command_builder) | 358 #define CHECK_COMMAND_BUILDER(x) CHECK_RECORD (x, command_builder) |
317 #define CONCHECK_COMMAND_BUILDER(x) CONCHECK_RECORD (x, command_builder) | 359 #define CONCHECK_COMMAND_BUILDER(x) CONCHECK_RECORD (x, command_builder) |
318 | 360 |
319 static Lisp_Object Vcommand_builder_free_list; | 361 static Lisp_Object Vcommand_builder_free_list; |
320 | 362 |
321 #ifdef USE_KKCC | 363 static const struct memory_description command_builder_description [] = { |
322 static const struct lrecord_description munging_key_translation_description_1 [] = { | |
323 { XD_LISP_OBJECT, offsetof (struct munging_key_translation, first_mungeable_event) }, | |
324 { XD_END } | |
325 }; | |
326 | |
327 static const struct struct_description munging_key_translation_description = { | |
328 sizeof (Lisp_Object), | |
329 munging_key_translation_description_1 | |
330 }; | |
331 | |
332 static const struct lrecord_description command_builder_description [] = { | |
333 { XD_LISP_OBJECT, offsetof (struct command_builder, current_events) }, | 364 { XD_LISP_OBJECT, offsetof (struct command_builder, current_events) }, |
334 { XD_LISP_OBJECT, offsetof (struct command_builder, most_current_event) }, | 365 { XD_LISP_OBJECT, offsetof (struct command_builder, most_current_event) }, |
335 { XD_LISP_OBJECT, offsetof (struct command_builder, last_non_munged_event) }, | 366 { XD_LISP_OBJECT, offsetof (struct command_builder, last_non_munged_event) }, |
336 { XD_LISP_OBJECT, offsetof (struct command_builder, console) }, | 367 { XD_LISP_OBJECT, offsetof (struct command_builder, console) }, |
337 { XD_STRUCT_ARRAY, offsetof (struct command_builder, munge_me), 2, &munging_key_translation_description }, | 368 { XD_LISP_OBJECT_ARRAY, offsetof (struct command_builder, first_mungeable_event), 2 }, |
338 { XD_END } | 369 { XD_END } |
339 }; | 370 }; |
340 #endif /* USE_KKCC */ | |
341 | 371 |
342 static Lisp_Object | 372 static Lisp_Object |
343 mark_command_builder (Lisp_Object obj) | 373 mark_command_builder (Lisp_Object obj) |
344 { | 374 { |
345 struct command_builder *builder = XCOMMAND_BUILDER (obj); | 375 struct command_builder *builder = XCOMMAND_BUILDER (obj); |
346 mark_object (builder->current_events); | 376 mark_object (builder->current_events); |
347 mark_object (builder->most_current_event); | 377 mark_object (builder->most_current_event); |
348 mark_object (builder->last_non_munged_event); | 378 mark_object (builder->last_non_munged_event); |
349 mark_object (builder->munge_me[0].first_mungeable_event); | 379 mark_object (builder->first_mungeable_event[0]); |
350 mark_object (builder->munge_me[1].first_mungeable_event); | 380 mark_object (builder->first_mungeable_event[1]); |
351 return builder->console; | 381 return builder->console; |
352 } | 382 } |
353 | 383 |
354 static void | 384 static void |
355 finalize_command_builder (void *header, int for_disksave) | 385 finalize_command_builder (void *header, int for_disksave) |
363 b->echo_buf = 0; | 393 b->echo_buf = 0; |
364 } | 394 } |
365 } | 395 } |
366 } | 396 } |
367 | 397 |
368 #ifdef USE_KKCC | |
369 DEFINE_LRECORD_IMPLEMENTATION ("command-builder", command_builder, | 398 DEFINE_LRECORD_IMPLEMENTATION ("command-builder", command_builder, |
370 0, /*dumpable-flag*/ | 399 0, /*dumpable-flag*/ |
371 mark_command_builder, internal_object_printer, | 400 mark_command_builder, internal_object_printer, |
372 finalize_command_builder, 0, 0, | 401 finalize_command_builder, 0, 0, |
373 command_builder_description, | 402 command_builder_description, |
374 struct command_builder); | 403 struct command_builder); |
375 #else /* not USE_KKCC */ | |
376 DEFINE_LRECORD_IMPLEMENTATION ("command-builder", command_builder, | |
377 mark_command_builder, internal_object_printer, | |
378 finalize_command_builder, 0, 0, 0, | |
379 struct command_builder); | |
380 #endif /* not USE_KKCC */ | |
381 | 404 |
382 static void | 405 static void |
383 reset_command_builder_event_chain (struct command_builder *builder) | 406 reset_command_builder_event_chain (struct command_builder *builder) |
384 { | 407 { |
385 builder->current_events = Qnil; | 408 builder->current_events = Qnil; |
386 builder->most_current_event = Qnil; | 409 builder->most_current_event = Qnil; |
387 builder->last_non_munged_event = Qnil; | 410 builder->last_non_munged_event = Qnil; |
388 builder->munge_me[0].first_mungeable_event = Qnil; | 411 builder->first_mungeable_event[0] = Qnil; |
389 builder->munge_me[1].first_mungeable_event = Qnil; | 412 builder->first_mungeable_event[1] = Qnil; |
390 } | 413 } |
391 | 414 |
392 Lisp_Object | 415 Lisp_Object |
393 allocate_command_builder (Lisp_Object console, int with_echo_buf) | 416 allocate_command_builder (Lisp_Object console, int with_echo_buf) |
394 { | 417 { |
395 Lisp_Object builder_obj = | 418 Lisp_Object builder_obj = |
396 allocate_managed_lcrecord (Vcommand_builder_free_list); | 419 alloc_managed_lcrecord (Vcommand_builder_free_list); |
397 struct command_builder *builder = XCOMMAND_BUILDER (builder_obj); | 420 struct command_builder *builder = XCOMMAND_BUILDER (builder_obj); |
398 | 421 |
399 builder->console = console; | 422 builder->console = console; |
400 reset_command_builder_event_chain (builder); | 423 reset_command_builder_event_chain (builder); |
401 if (with_echo_buf) | 424 if (with_echo_buf) |
440 new_buildings->current_events); | 463 new_buildings->current_events); |
441 new_buildings->last_non_munged_event = | 464 new_buildings->last_non_munged_event = |
442 transfer_event_chain_pointer (collapsing->last_non_munged_event, | 465 transfer_event_chain_pointer (collapsing->last_non_munged_event, |
443 collapsing->current_events, | 466 collapsing->current_events, |
444 new_buildings->current_events); | 467 new_buildings->current_events); |
445 new_buildings->munge_me[0].first_mungeable_event = | 468 new_buildings->first_mungeable_event[0] = |
446 transfer_event_chain_pointer (collapsing->munge_me[0]. | 469 transfer_event_chain_pointer (collapsing->first_mungeable_event[0], |
447 first_mungeable_event, | |
448 collapsing->current_events, | 470 collapsing->current_events, |
449 new_buildings->current_events); | 471 new_buildings->current_events); |
450 new_buildings->munge_me[1].first_mungeable_event = | 472 new_buildings->first_mungeable_event[1] = |
451 transfer_event_chain_pointer (collapsing->munge_me[1]. | 473 transfer_event_chain_pointer (collapsing->first_mungeable_event[1], |
452 first_mungeable_event, | |
453 collapsing->current_events, | 474 collapsing->current_events, |
454 new_buildings->current_events); | 475 new_buildings->current_events); |
455 | 476 |
456 return wrap_command_builder (new_buildings); | 477 return wrap_command_builder (new_buildings); |
457 } | 478 } |
479 XSET_EVENT_NEXT (builder->most_current_event, event); | 500 XSET_EVENT_NEXT (builder->most_current_event, event); |
480 else | 501 else |
481 builder->current_events = event; | 502 builder->current_events = event; |
482 | 503 |
483 builder->most_current_event = event; | 504 builder->most_current_event = event; |
484 if (NILP (builder->munge_me[0].first_mungeable_event)) | 505 if (NILP (builder->first_mungeable_event[0])) |
485 builder->munge_me[0].first_mungeable_event = event; | 506 builder->first_mungeable_event[0] = event; |
486 if (NILP (builder->munge_me[1].first_mungeable_event)) | 507 if (NILP (builder->first_mungeable_event[1])) |
487 builder->munge_me[1].first_mungeable_event = event; | 508 builder->first_mungeable_event[1] = event; |
488 } | 509 } |
489 | 510 |
490 | 511 |
491 /**********************************************************************/ | 512 /**********************************************************************/ |
492 /* Low-level interfaces onto event methods */ | 513 /* Low-level interfaces onto event methods */ |
511 } | 532 } |
512 | 533 |
513 static int | 534 static int |
514 event_stream_event_pending_p (int user) | 535 event_stream_event_pending_p (int user) |
515 { | 536 { |
537 /* #### Hmmm ... There may be some duplication in "drain queue" and | |
538 "event pending". Couldn't we just drain the queue and see what's in | |
539 it, and not maybe need a separate event method for this? Would this | |
540 work when USER is 0? Maybe this would be slow? */ | |
516 return event_stream && event_stream->event_pending_p (user); | 541 return event_stream && event_stream->event_pending_p (user); |
517 } | 542 } |
518 | 543 |
519 static void | 544 static void |
520 event_stream_force_event_pending (struct frame *f) | 545 event_stream_force_event_pending (struct frame *f) |
521 { | 546 { |
522 if (event_stream->force_event_pending) | 547 if (event_stream->force_event_pending_cb) |
523 event_stream->force_event_pending (f); | 548 event_stream->force_event_pending_cb (f); |
524 } | 549 } |
525 | 550 |
526 static int | 551 static int |
527 maybe_read_quit_event (Lisp_Event *event) | 552 maybe_read_quit_event (Lisp_Event *event) |
528 { | 553 { |
538 else | 563 else |
539 con = XCONSOLE (Fselected_console ()); | 564 con = XCONSOLE (Fselected_console ()); |
540 | 565 |
541 if (sigint_happened) | 566 if (sigint_happened) |
542 { | 567 { |
543 int ch = CONSOLE_QUIT_CHAR (con); | |
544 sigint_happened = 0; | 568 sigint_happened = 0; |
545 Vquit_flag = Qnil; | 569 Vquit_flag = Qnil; |
546 character_to_event (ch, event, con, 1, 1); | 570 Fcopy_event (CONSOLE_QUIT_EVENT (con), wrap_event (event)); |
547 event->channel = wrap_console (con); | |
548 return 1; | 571 return 1; |
549 } | 572 } |
550 return 0; | 573 return 0; |
551 } | 574 } |
552 | 575 |
752 check_event_stream_ok (EVENT_STREAM_PROCESS); | 775 check_event_stream_ok (EVENT_STREAM_PROCESS); |
753 event_stream->delete_io_streams_cb (instream, outstream, errstream, | 776 event_stream->delete_io_streams_cb (instream, outstream, errstream, |
754 in_usid, err_usid); | 777 in_usid, err_usid); |
755 } | 778 } |
756 | 779 |
780 static void | |
781 event_stream_drain_queue (void) | |
782 { | |
783 if (event_stream && event_stream->drain_queue_cb) | |
784 event_stream->drain_queue_cb (); | |
785 } | |
786 | |
787 struct remove_quit_p_data | |
788 { | |
789 int critical; | |
790 }; | |
791 | |
792 static int | |
793 remove_quit_p_event (Lisp_Object ev, void *the_data) | |
794 { | |
795 struct remove_quit_p_data *data = (struct remove_quit_p_data *) the_data; | |
796 struct console *con = event_console_or_selected (ev); | |
797 | |
798 if (XEVENT_TYPE (ev) == key_press_event) | |
799 { | |
800 if (event_matches_key_specifier_p (ev, CONSOLE_QUIT_EVENT (con))) | |
801 return 1; | |
802 if (event_matches_key_specifier_p (ev, | |
803 CONSOLE_CRITICAL_QUIT_EVENT (con))) | |
804 { | |
805 data->critical = 1; | |
806 return 1; | |
807 } | |
808 } | |
809 | |
810 return 0; | |
811 } | |
812 | |
813 static int | |
814 event_stream_quit_check_disallowed_p (void) | |
815 { | |
816 if (event_stream && event_stream->quit_check_disallowed_p_cb) | |
817 return event_stream->quit_check_disallowed_p_cb (); | |
818 else | |
819 return 0; | |
820 } | |
821 | |
757 void | 822 void |
758 event_stream_quit_p (void) | 823 event_stream_quit_p (void) |
759 { | 824 { |
760 if (event_stream) | 825 struct remove_quit_p_data data; |
761 event_stream->quit_p_cb (); | 826 |
827 if (event_stream_quit_check_disallowed_p ()) | |
828 return; | |
829 | |
830 /* Drain queue so we can check for pending C-g events. */ | |
831 event_stream_drain_queue (); | |
832 data.critical = 0; | |
833 | |
834 if (map_event_chain_remove (remove_quit_p_event, | |
835 &dispatch_event_queue, | |
836 &dispatch_event_queue_tail, | |
837 &data, MECR_DEALLOCATE_EVENT)) | |
838 Vquit_flag = data.critical ? Qcritical : Qt; | |
762 } | 839 } |
763 | 840 |
764 static int | 841 static int |
765 event_stream_current_event_timestamp (struct console *c) | 842 event_stream_current_event_timestamp (struct console *c) |
766 { | 843 { |
789 { | 866 { |
790 buf_index = 0; /* We're echoing now */ | 867 buf_index = 0; /* We're echoing now */ |
791 clear_echo_area (selected_frame (), Qnil, 0); | 868 clear_echo_area (selected_frame (), Qnil, 0); |
792 } | 869 } |
793 | 870 |
794 #ifdef USE_KKCC | |
795 format_event_object (buf, event, 1); | 871 format_event_object (buf, event, 1); |
796 #else /* not USE_KKCC */ | |
797 format_event_object (buf, XEVENT(event), 1); | |
798 #endif /* not USE_KKCC */ | |
799 len = eilen (buf); | 872 len = eilen (buf); |
800 | 873 |
801 if (len + buf_index + 4 > command_builder->echo_buf_length) | 874 if (len + buf_index + 4 > command_builder->echo_buf_length) |
802 { | 875 { |
803 eifree (buf); | 876 eifree (buf); |
901 if (!HASH_TABLEP (Vkeyboard_translate_table)) | 974 if (!HASH_TABLEP (Vkeyboard_translate_table)) |
902 return; | 975 return; |
903 if (EQ (Fhash_table_count (Vkeyboard_translate_table), Qzero)) | 976 if (EQ (Fhash_table_count (Vkeyboard_translate_table), Qzero)) |
904 return; | 977 return; |
905 | 978 |
906 c = event_to_character (XEVENT (event), 0, 0, 0); | 979 c = event_to_character (event, 0, 0, 0); |
907 if (c != -1) | 980 if (c != -1) |
908 { | 981 { |
909 Lisp_Object traduit = Fgethash (make_char (c), Vkeyboard_translate_table, | 982 Lisp_Object traduit = Fgethash (make_char (c), Vkeyboard_translate_table, |
910 Qnil); | 983 Qnil); |
911 if (!NILP (traduit) && SYMBOLP (traduit)) | 984 if (!NILP (traduit) && SYMBOLP (traduit)) |
912 { | 985 { |
913 #ifdef USE_KKCC | 986 XSET_EVENT_KEY_KEYSYM (event, traduit); |
914 XSET_KEY_DATA_KEYSYM (XEVENT_DATA (event), traduit); | 987 XSET_EVENT_KEY_MODIFIERS (event, 0); |
915 XSET_KEY_DATA_MODIFIERS (XEVENT_DATA (event), 0); | |
916 #else /* not USE_KKCC */ | |
917 XEVENT (event)->event.key.keysym = traduit; | |
918 XEVENT (event)->event.key.modifiers = 0; | |
919 #endif /* not USE_KKCC */ | |
920 did_translate = 1; | 988 did_translate = 1; |
921 } | 989 } |
922 else if (CHARP (traduit)) | 990 else if (CHARP (traduit)) |
923 { | 991 { |
924 #ifdef USE_KKCC | |
925 Lisp_Object ev2 = Fmake_event(Qnil, Qnil); | |
926 #else /* not USE_KKCC */ | |
927 Lisp_Event ev2; | |
928 | |
929 /* This used to call Fcharacter_to_event() directly into EVENT, | 992 /* This used to call Fcharacter_to_event() directly into EVENT, |
930 but that can eradicate timestamps and other such stuff. | 993 but that can eradicate timestamps and other such stuff. |
931 This way is safer. */ | 994 This way is safer. */ |
932 zero_event (&ev2); | 995 Lisp_Object ev2 = Fmake_event (Qnil, Qnil); |
933 #endif /* not USE_KKCC */ | 996 |
934 | |
935 #ifdef USE_KKCC | |
936 character_to_event (XCHAR (traduit), XEVENT (ev2), | 997 character_to_event (XCHAR (traduit), XEVENT (ev2), |
937 XCONSOLE (XEVENT_CHANNEL (event)), 1, 1); | 998 XCONSOLE (XEVENT_CHANNEL (event)), 0, 1); |
938 XSET_KEY_DATA_KEYSYM (XEVENT_DATA (event), XKEY_DATA_KEYSYM (XEVENT_DATA (ev2))); | 999 XSET_EVENT_KEY_KEYSYM (event, XEVENT_KEY_KEYSYM (ev2)); |
939 XSET_KEY_DATA_MODIFIERS (XEVENT_DATA (event), | 1000 XSET_EVENT_KEY_MODIFIERS (event, XEVENT_KEY_MODIFIERS (ev2)); |
940 XKEY_DATA_MODIFIERS (XEVENT_DATA (ev2))); | 1001 Fdeallocate_event (ev2); |
941 #else /* not USE_KKCC */ | |
942 character_to_event (XCHAR (traduit), &ev2, | |
943 XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 1, 1); | |
944 XEVENT (event)->event.key.keysym = ev2.event.key.keysym; | |
945 XEVENT (event)->event.key.modifiers = ev2.event.key.modifiers; | |
946 #endif /* not USE_KKCC */ | |
947 did_translate = 1; | 1002 did_translate = 1; |
948 } | 1003 } |
949 } | 1004 } |
950 | 1005 |
951 if (!did_translate) | 1006 if (!did_translate) |
952 { | 1007 { |
953 #ifdef USE_KKCC | 1008 Lisp_Object traduit = Fgethash (XEVENT_KEY_KEYSYM (event), |
954 Lisp_Object traduit = Fgethash (XKEY_DATA_KEYSYM (XEVENT_DATA (event)), | |
955 Vkeyboard_translate_table, Qnil); | 1009 Vkeyboard_translate_table, Qnil); |
956 #else /* not USE_KKCC */ | |
957 Lisp_Object traduit = Fgethash (XEVENT (event)->event.key.keysym, | |
958 Vkeyboard_translate_table, Qnil); | |
959 #endif /* not USE_KKCC */ | |
960 if (!NILP (traduit) && SYMBOLP (traduit)) | 1010 if (!NILP (traduit) && SYMBOLP (traduit)) |
961 { | 1011 { |
962 #ifdef USE_KKCC | 1012 XSET_EVENT_KEY_KEYSYM (event, traduit); |
963 XSET_KEY_DATA_KEYSYM (XEVENT_DATA (event), traduit); | |
964 #else /* not USE_KKCC */ | |
965 XEVENT (event)->event.key.keysym = traduit; | |
966 #endif /* not USE_KKCC */ | |
967 did_translate = 1; | 1013 did_translate = 1; |
968 } | 1014 } |
969 else if (CHARP (traduit)) | 1015 else if (CHARP (traduit)) |
970 { | 1016 { |
971 #ifdef USE_KKCC | |
972 Lisp_Object ev2 = Fmake_event(Qnil, Qnil); | |
973 #else /* not USE_KKCC */ | |
974 Lisp_Event ev2; | |
975 | |
976 /* This used to call Fcharacter_to_event() directly into EVENT, | 1017 /* This used to call Fcharacter_to_event() directly into EVENT, |
977 but that can eradicate timestamps and other such stuff. | 1018 but that can eradicate timestamps and other such stuff. |
978 This way is safer. */ | 1019 This way is safer. */ |
979 zero_event (&ev2); | 1020 Lisp_Object ev2 = Fmake_event (Qnil, Qnil); |
980 #endif /* not USE_KKCC */ | 1021 |
981 | |
982 #ifdef USE_KKCC | |
983 character_to_event (XCHAR (traduit), XEVENT (ev2), | 1022 character_to_event (XCHAR (traduit), XEVENT (ev2), |
984 XCONSOLE (XEVENT_CHANNEL (event)), 1, 1); | 1023 XCONSOLE (XEVENT_CHANNEL (event)), 0, 1); |
985 XSET_KEY_DATA_KEYSYM (XEVENT_DATA (event), XKEY_DATA_KEYSYM (XEVENT_DATA (ev2))); | 1024 XSET_EVENT_KEY_KEYSYM (event, XEVENT_KEY_KEYSYM (ev2)); |
986 XSET_KEY_DATA_MODIFIERS (XEVENT_DATA (event), | 1025 XSET_EVENT_KEY_MODIFIERS (event, |
987 XKEY_DATA_MODIFIERS (XEVENT_DATA (event)) | | 1026 XEVENT_KEY_MODIFIERS (event) | |
988 XKEY_DATA_MODIFIERS (XEVENT_DATA (ev2))); | 1027 XEVENT_KEY_MODIFIERS (ev2)); |
989 #else /* not USE_KKCC */ | 1028 |
990 character_to_event (XCHAR (traduit), &ev2, | 1029 Fdeallocate_event (ev2); |
991 XCONSOLE (EVENT_CHANNEL (XEVENT (event))), 1, 1); | |
992 XEVENT (event)->event.key.keysym = ev2.event.key.keysym; | |
993 XEVENT (event)->event.key.modifiers |= ev2.event.key.modifiers; | |
994 #endif /* not USE_KKCC */ | |
995 | |
996 did_translate = 1; | 1030 did_translate = 1; |
997 } | 1031 } |
998 } | 1032 } |
999 | 1033 |
1000 #ifdef DEBUG_XEMACS | 1034 #ifdef DEBUG_XEMACS |
1084 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); | 1118 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); |
1085 } | 1119 } |
1086 } | 1120 } |
1087 | 1121 |
1088 redisplay (); | 1122 redisplay (); |
1089 if (event_matches_key_specifier_p (XEVENT (event), make_char (' '))) | 1123 if (event_matches_key_specifier_p (event, make_char (' '))) |
1090 { | 1124 { |
1091 /* Discard next key if it is a space */ | 1125 /* Discard next key if it is a space */ |
1092 reset_key_echo (command_builder, 1); | 1126 reset_key_echo (command_builder, 1); |
1093 Fnext_command_event (event, Qnil); | 1127 Fnext_command_event (event, Qnil); |
1094 } | 1128 } |
1301 Lisp_Timeout *tm = XTIMEOUT (obj); | 1335 Lisp_Timeout *tm = XTIMEOUT (obj); |
1302 mark_object (tm->function); | 1336 mark_object (tm->function); |
1303 return tm->object; | 1337 return tm->object; |
1304 } | 1338 } |
1305 | 1339 |
1306 static const struct lrecord_description timeout_description[] = { | 1340 static const struct memory_description timeout_description[] = { |
1307 { XD_LISP_OBJECT, offsetof (Lisp_Timeout, function) }, | 1341 { XD_LISP_OBJECT, offsetof (Lisp_Timeout, function) }, |
1308 { XD_LISP_OBJECT, offsetof (Lisp_Timeout, object) }, | 1342 { XD_LISP_OBJECT, offsetof (Lisp_Timeout, object) }, |
1309 { XD_END } | 1343 { XD_END } |
1310 }; | 1344 }; |
1311 | 1345 |
1312 #ifdef USE_KKCC | |
1313 DEFINE_LRECORD_IMPLEMENTATION ("timeout", timeout, | 1346 DEFINE_LRECORD_IMPLEMENTATION ("timeout", timeout, |
1314 1, /*dumpable-flag*/ | 1347 1, /*dumpable-flag*/ |
1315 mark_timeout, internal_object_printer, | 1348 mark_timeout, internal_object_printer, |
1316 0, 0, 0, timeout_description, Lisp_Timeout); | 1349 0, 0, 0, timeout_description, Lisp_Timeout); |
1317 #else /* not USE_KKCC */ | |
1318 DEFINE_LRECORD_IMPLEMENTATION ("timeout", timeout, | |
1319 mark_timeout, internal_object_printer, | |
1320 0, 0, 0, timeout_description, Lisp_Timeout); | |
1321 #endif /* not USE_KKCC */ | |
1322 | 1350 |
1323 /* Generate a timeout and return its ID. */ | 1351 /* Generate a timeout and return its ID. */ |
1324 | 1352 |
1325 int | 1353 int |
1326 event_stream_generate_wakeup (unsigned int milliseconds, | 1354 event_stream_generate_wakeup (unsigned int milliseconds, |
1327 unsigned int vanilliseconds, | 1355 unsigned int vanilliseconds, |
1328 Lisp_Object function, Lisp_Object object, | 1356 Lisp_Object function, Lisp_Object object, |
1329 int async_p) | 1357 int async_p) |
1330 { | 1358 { |
1331 Lisp_Object op = allocate_managed_lcrecord (Vtimeout_free_list); | 1359 Lisp_Object op = alloc_managed_lcrecord (Vtimeout_free_list); |
1332 Lisp_Timeout *timeout = XTIMEOUT (op); | 1360 Lisp_Timeout *timeout = XTIMEOUT (op); |
1333 EMACS_TIME current_time; | 1361 EMACS_TIME current_time; |
1334 EMACS_TIME interval; | 1362 EMACS_TIME interval; |
1335 | 1363 |
1336 /* Don't just use ++timeout_id_tick, for the (admittedly rare) case | 1364 /* Don't just use ++timeout_id_tick, for the (admittedly rare) case |
1696 dequeue_command_event (void) | 1724 dequeue_command_event (void) |
1697 { | 1725 { |
1698 return dequeue_event (&command_event_queue, &command_event_queue_tail); | 1726 return dequeue_event (&command_event_queue, &command_event_queue_tail); |
1699 } | 1727 } |
1700 | 1728 |
1729 void | |
1730 enqueue_dispatch_event (Lisp_Object event) | |
1731 { | |
1732 enqueue_event (event, &dispatch_event_queue, &dispatch_event_queue_tail); | |
1733 } | |
1734 | |
1735 Lisp_Object | |
1736 dequeue_dispatch_event (void) | |
1737 { | |
1738 return dequeue_event (&dispatch_event_queue, &dispatch_event_queue_tail); | |
1739 } | |
1740 | |
1701 static void | 1741 static void |
1702 enqueue_command_event_1 (Lisp_Object event_to_copy) | 1742 enqueue_command_event_1 (Lisp_Object event_to_copy) |
1703 { | 1743 { |
1704 enqueue_command_event (Fcopy_event (event_to_copy, Qnil)); | 1744 enqueue_command_event (Fcopy_event (event_to_copy, Qnil)); |
1705 } | 1745 } |
1706 | 1746 |
1707 void | 1747 void |
1708 enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object) | 1748 enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object) |
1709 { | 1749 { |
1710 Lisp_Object event = Fmake_event (Qnil, Qnil); | 1750 Lisp_Object event = Fmake_event (Qnil, Qnil); |
1711 #ifdef USE_KKCC | |
1712 XSET_EVENT_TYPE (event, magic_eval_event); | 1751 XSET_EVENT_TYPE (event, magic_eval_event); |
1713 /* channel for magic_eval events is nil */ | 1752 /* channel for magic_eval events is nil */ |
1714 XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION (XEVENT_DATA (event), fun); | 1753 XSET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (event, fun); |
1715 XSET_MAGIC_EVAL_DATA_OBJECT (XEVENT_DATA (event), object); | 1754 XSET_EVENT_MAGIC_EVAL_OBJECT (event, object); |
1716 #else /* not USE_KKCC */ | |
1717 XEVENT (event)->event_type = magic_eval_event; | |
1718 /* channel for magic_eval events is nil */ | |
1719 XEVENT (event)->event.magic_eval.internal_function = fun; | |
1720 XEVENT (event)->event.magic_eval.object = object; | |
1721 #endif /* not USE_KKCC */ | |
1722 enqueue_command_event (event); | 1755 enqueue_command_event (event); |
1723 } | 1756 } |
1724 | 1757 |
1725 DEFUN ("enqueue-eval-event", Fenqueue_eval_event, 2, 2, 0, /* | 1758 DEFUN ("enqueue-eval-event", Fenqueue_eval_event, 2, 2, 0, /* |
1726 Add an eval event to the back of the eval event queue. | 1759 Add an eval event to the back of the eval event queue. |
1731 */ | 1764 */ |
1732 (function, object)) | 1765 (function, object)) |
1733 { | 1766 { |
1734 Lisp_Object event = Fmake_event (Qnil, Qnil); | 1767 Lisp_Object event = Fmake_event (Qnil, Qnil); |
1735 | 1768 |
1736 #ifdef USE_KKCC | |
1737 XSET_EVENT_TYPE (event, eval_event); | 1769 XSET_EVENT_TYPE (event, eval_event); |
1738 /* channel for eval events is nil */ | 1770 /* channel for eval events is nil */ |
1739 XSET_EVAL_DATA_FUNCTION (XEVENT_DATA (event), function); | 1771 XSET_EVENT_EVAL_FUNCTION (event, function); |
1740 XSET_EVAL_DATA_OBJECT (XEVENT_DATA (event), object); | 1772 XSET_EVENT_EVAL_OBJECT (event, object); |
1741 #else /* not USE_KKCC */ | |
1742 XEVENT (event)->event_type = eval_event; | |
1743 /* channel for eval events is nil */ | |
1744 XEVENT (event)->event.eval.function = function; | |
1745 XEVENT (event)->event.eval.object = object; | |
1746 #endif /* not USE_KKCC */ | |
1747 enqueue_command_event (event); | 1773 enqueue_command_event (event); |
1748 | 1774 |
1749 return event; | 1775 return event; |
1750 } | 1776 } |
1751 | 1777 |
1752 Lisp_Object | 1778 Lisp_Object |
1753 enqueue_misc_user_event (Lisp_Object channel, Lisp_Object function, | 1779 enqueue_misc_user_event (Lisp_Object channel, Lisp_Object function, |
1754 Lisp_Object object) | 1780 Lisp_Object object) |
1755 { | 1781 { |
1756 Lisp_Object event = Fmake_event (Qnil, Qnil); | 1782 Lisp_Object event = Fmake_event (Qnil, Qnil); |
1757 #ifdef USE_KKCC | |
1758 XSET_EVENT_TYPE (event, misc_user_event); | 1783 XSET_EVENT_TYPE (event, misc_user_event); |
1759 XSET_EVENT_CHANNEL (event, channel); | 1784 XSET_EVENT_CHANNEL (event, channel); |
1760 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), function); | 1785 XSET_EVENT_MISC_USER_FUNCTION (event, function); |
1761 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event), object); | 1786 XSET_EVENT_MISC_USER_OBJECT (event, object); |
1762 XSET_MISC_USER_DATA_BUTTON (XEVENT_DATA (event), 0); | 1787 XSET_EVENT_MISC_USER_BUTTON (event, 0); |
1763 XSET_MISC_USER_DATA_MODIFIERS (XEVENT_DATA (event), 0); | 1788 XSET_EVENT_MISC_USER_MODIFIERS (event, 0); |
1764 XSET_MISC_USER_DATA_X (XEVENT_DATA (event), -1); | 1789 XSET_EVENT_MISC_USER_X (event, -1); |
1765 XSET_MISC_USER_DATA_Y (XEVENT_DATA (event), -1); | 1790 XSET_EVENT_MISC_USER_Y (event, -1); |
1766 #else /* not USE_KKCC */ | |
1767 XEVENT (event)->event_type = misc_user_event; | |
1768 XEVENT (event)->channel = channel; | |
1769 XEVENT (event)->event.misc.function = function; | |
1770 XEVENT (event)->event.misc.object = object; | |
1771 XEVENT (event)->event.misc.button = 0; | |
1772 XEVENT (event)->event.misc.modifiers = 0; | |
1773 XEVENT (event)->event.misc.x = -1; | |
1774 XEVENT (event)->event.misc.y = -1; | |
1775 #endif /* not USE_KKCC */ | |
1776 enqueue_command_event (event); | 1791 enqueue_command_event (event); |
1777 | 1792 |
1778 return event; | 1793 return event; |
1779 } | 1794 } |
1780 | 1795 |
1783 Lisp_Object object, | 1798 Lisp_Object object, |
1784 int button, int modifiers, int x, int y) | 1799 int button, int modifiers, int x, int y) |
1785 { | 1800 { |
1786 Lisp_Object event = Fmake_event (Qnil, Qnil); | 1801 Lisp_Object event = Fmake_event (Qnil, Qnil); |
1787 | 1802 |
1788 #ifdef USE_KKCC | |
1789 XSET_EVENT_TYPE (event, misc_user_event); | 1803 XSET_EVENT_TYPE (event, misc_user_event); |
1790 XSET_EVENT_CHANNEL (event, channel); | 1804 XSET_EVENT_CHANNEL (event, channel); |
1791 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), function); | 1805 XSET_EVENT_MISC_USER_FUNCTION (event, function); |
1792 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event), object); | 1806 XSET_EVENT_MISC_USER_OBJECT (event, object); |
1793 XSET_MISC_USER_DATA_BUTTON (XEVENT_DATA (event), button); | 1807 XSET_EVENT_MISC_USER_BUTTON (event, button); |
1794 XSET_MISC_USER_DATA_MODIFIERS (XEVENT_DATA (event), modifiers); | 1808 XSET_EVENT_MISC_USER_MODIFIERS (event, modifiers); |
1795 XSET_MISC_USER_DATA_X (XEVENT_DATA (event), x); | 1809 XSET_EVENT_MISC_USER_X (event, x); |
1796 XSET_MISC_USER_DATA_Y (XEVENT_DATA (event), y); | 1810 XSET_EVENT_MISC_USER_Y (event, y); |
1797 #else /* not USE_KKCC */ | |
1798 XEVENT (event)->event_type = misc_user_event; | |
1799 XEVENT (event)->channel = channel; | |
1800 XEVENT (event)->event.misc.function = function; | |
1801 XEVENT (event)->event.misc.object = object; | |
1802 XEVENT (event)->event.misc.button = button; | |
1803 XEVENT (event)->event.misc.modifiers = modifiers; | |
1804 XEVENT (event)->event.misc.x = x; | |
1805 XEVENT (event)->event.misc.y = y; | |
1806 #endif /* not USE_KKCC */ | |
1807 enqueue_command_event (event); | 1811 enqueue_command_event (event); |
1808 | 1812 |
1809 return event; | 1813 return event; |
1810 } | 1814 } |
1811 | 1815 |
2186 /* The command_event_queue was empty. Wait for an event. */ | 2190 /* The command_event_queue was empty. Wait for an event. */ |
2187 event_stream_next_event (e); | 2191 event_stream_next_event (e); |
2188 /* If this was a timeout, then we need to extract some data | 2192 /* If this was a timeout, then we need to extract some data |
2189 out of the returned closure and might need to resignal | 2193 out of the returned closure and might need to resignal |
2190 it. */ | 2194 it. */ |
2191 #ifdef USE_KKCC | |
2192 if (EVENT_TYPE (e) == timeout_event) | 2195 if (EVENT_TYPE (e) == timeout_event) |
2193 #else /* not USE_KKCC */ | |
2194 if (e->event_type == timeout_event) | |
2195 #endif /* not USE_KKCC */ | |
2196 { | 2196 { |
2197 Lisp_Object tristan, isolde; | 2197 Lisp_Object tristan, isolde; |
2198 | 2198 |
2199 #ifdef USE_KKCC | 2199 SET_EVENT_TIMEOUT_ID_NUMBER (e, |
2200 XSET_TIMEOUT_DATA_ID_NUMBER (EVENT_DATA (e), | 2200 event_stream_resignal_wakeup (EVENT_TIMEOUT_INTERVAL_ID (e), 0, &tristan, &isolde)); |
2201 event_stream_resignal_wakeup (XTIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (e)), 0, &tristan, &isolde)); | 2201 |
2202 | 2202 SET_EVENT_TIMEOUT_FUNCTION (e, tristan); |
2203 XSET_TIMEOUT_DATA_FUNCTION (EVENT_DATA (e), tristan); | 2203 SET_EVENT_TIMEOUT_OBJECT (e, isolde); |
2204 XSET_TIMEOUT_DATA_OBJECT (EVENT_DATA (e), isolde); | |
2205 /* next_event_internal() doesn't print out timeout events | 2204 /* next_event_internal() doesn't print out timeout events |
2206 because of the extra info we just set. */ | 2205 because of the extra info we just set. */ |
2207 #else /* not USE_KKCC */ | |
2208 e->event.timeout.id_number = | |
2209 event_stream_resignal_wakeup (e->event.timeout.interval_id, 0, | |
2210 &tristan, &isolde); | |
2211 | |
2212 e->event.timeout.function = tristan; | |
2213 e->event.timeout.object = isolde; | |
2214 /* next_event_internal() doesn't print out timeout events | |
2215 because of the extra info we just set. */ | |
2216 #endif /* not USE_KKCC */ | |
2217 DEBUG_PRINT_EMACS_EVENT ("real, timeout", target_event); | 2206 DEBUG_PRINT_EMACS_EVENT ("real, timeout", target_event); |
2218 } | 2207 } |
2219 | 2208 |
2220 /* If we read a ^G, then set quit-flag and try to QUIT. | 2209 /* If we read a ^G, then set quit-flag and try to QUIT. |
2221 This may be blocked (see above). | 2210 This may be blocked (see above). |
2222 */ | 2211 */ |
2223 #ifdef USE_KKCC | |
2224 if (EVENT_TYPE (e) == key_press_event && | 2212 if (EVENT_TYPE (e) == key_press_event && |
2225 #else /* not USE_KKCC */ | |
2226 if (e->event_type == key_press_event && | |
2227 #endif /* not USE_KKCC */ | |
2228 event_matches_key_specifier_p | 2213 event_matches_key_specifier_p |
2229 (e, make_char (CONSOLE_QUIT_CHAR (XCONSOLE (EVENT_CHANNEL (e)))))) | 2214 (target_event, CONSOLE_QUIT_EVENT (XCONSOLE (EVENT_CHANNEL (e))))) |
2230 { | 2215 { |
2231 Vquit_flag = Qt; | 2216 Vquit_flag = Qt; |
2232 QUIT; | 2217 QUIT; |
2233 } | 2218 } |
2234 } | 2219 } |
2493 /* last-input-char and last-input-time are derived from | 2478 /* last-input-char and last-input-time are derived from |
2494 last-input-event. | 2479 last-input-event. |
2495 Note that last-input-char will never have its high-bit set, in an | 2480 Note that last-input-char will never have its high-bit set, in an |
2496 effort to sidestep the ambiguity between M-x and oslash. | 2481 effort to sidestep the ambiguity between M-x and oslash. |
2497 */ | 2482 */ |
2498 Vlast_input_char = Fevent_to_character (Vlast_input_event, | 2483 Vlast_input_char = Fevent_to_character (Vlast_input_event, Qnil, Qnil, Qnil); |
2499 Qnil, Qnil, Qnil); | |
2500 { | 2484 { |
2501 EMACS_TIME t; | 2485 EMACS_TIME t; |
2502 EMACS_GET_TIME (t); | 2486 EMACS_GET_TIME (t); |
2503 if (!CONSP (Vlast_input_time)) | 2487 if (!CONSP (Vlast_input_time)) |
2504 Vlast_input_time = Fcons (Qnil, Qnil); | 2488 Vlast_input_time = Fcons (Qnil, Qnil); |
2536 /* If this is the help char and there is a help form, then execute | 2520 /* If this is the help char and there is a help form, then execute |
2537 the help form and swallow this character. Note that | 2521 the help form and swallow this character. Note that |
2538 execute_help_form() calls Fnext_command_event(), which calls this | 2522 execute_help_form() calls Fnext_command_event(), which calls this |
2539 function, as well as Fdispatch_event. */ | 2523 function, as well as Fdispatch_event. */ |
2540 if (!NILP (Vhelp_form) && | 2524 if (!NILP (Vhelp_form) && |
2541 event_matches_key_specifier_p (XEVENT (event), Vhelp_char)) | 2525 event_matches_key_specifier_p (event, Vhelp_char)) |
2542 { | 2526 { |
2543 /* temporarily reenable quit checking here, because we could get stuck */ | 2527 /* temporarily reenable quit checking here, because we could get stuck */ |
2544 Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ | 2528 Vquit_flag = Qnil; /* see begin_dont_check_for_quit() */ |
2545 unbind_to (depth); | 2529 unbind_to (depth); |
2546 execute_help_form (command_builder, event); | 2530 execute_help_form (command_builder, event); |
2871 switch (XEVENT_TYPE (event)) | 2855 switch (XEVENT_TYPE (event)) |
2872 { | 2856 { |
2873 case process_event: | 2857 case process_event: |
2874 { | 2858 { |
2875 if (NILP (process) || | 2859 if (NILP (process) || |
2876 #ifdef USE_KKCC | 2860 EQ (XEVENT_PROCESS_PROCESS (event), process)) |
2877 EQ (XPROCESS_DATA_PROCESS (XEVENT_DATA (event)), process)) | |
2878 #else /* not USE_KKCC */ | |
2879 EQ (XEVENT (event)->event.process.process, process)) | |
2880 #endif /* not USE_KKCC */ | |
2881 { | 2861 { |
2882 done = 1; | 2862 done = 1; |
2883 /* RMS's version always returns nil when proc is nil, | 2863 /* RMS's version always returns nil when proc is nil, |
2884 and only returns t if input ever arrived on proc. */ | 2864 and only returns t if input ever arrived on proc. */ |
2885 result = Qt; | 2865 result = Qt; |
3157 case empty_event: | 3137 case empty_event: |
3158 return; | 3138 return; |
3159 | 3139 |
3160 case eval_event: | 3140 case eval_event: |
3161 { | 3141 { |
3162 #ifdef USE_KKCC | 3142 call1 (XEVENT_EVAL_FUNCTION (event), |
3163 call1 (XEVAL_DATA_FUNCTION (XEVENT_DATA (event)), | 3143 XEVENT_EVAL_OBJECT (event)); |
3164 XEVAL_DATA_OBJECT (XEVENT_DATA (event))); | |
3165 #else /* not USE_KKCC */ | |
3166 call1 (XEVENT (event)->event.eval.function, | |
3167 XEVENT (event)->event.eval.object); | |
3168 #endif /* not USE_KKCC */ | |
3169 return; | 3144 return; |
3170 } | 3145 } |
3171 | 3146 |
3172 case magic_eval_event: | 3147 case magic_eval_event: |
3173 { | 3148 { |
3174 #ifdef USE_KKCC | 3149 XEVENT_MAGIC_EVAL_INTERNAL_FUNCTION (event) |
3175 XMAGIC_EVAL_DATA_INTERNAL_FUNCTION (XEVENT_DATA (event)) | 3150 XEVENT_MAGIC_EVAL_OBJECT (event); |
3176 XMAGIC_EVAL_DATA_OBJECT (XEVENT_DATA (event)); | |
3177 #else /* not USE_KKCC */ | |
3178 (XEVENT (event)->event.magic_eval.internal_function) | |
3179 (XEVENT (event)->event.magic_eval.object); | |
3180 #endif /* not USE_KKCC */ | |
3181 return; | 3151 return; |
3182 } | 3152 } |
3183 | 3153 |
3184 case pointer_motion_event: | 3154 case pointer_motion_event: |
3185 { | 3155 { |
3188 return; | 3158 return; |
3189 } | 3159 } |
3190 | 3160 |
3191 case process_event: | 3161 case process_event: |
3192 { | 3162 { |
3193 #ifdef USE_KKCC | 3163 Lisp_Object p = XEVENT_PROCESS_PROCESS (event); |
3194 Lisp_Object p = XPROCESS_DATA_PROCESS (XEVENT_DATA (event)); | |
3195 #else /* not USE_KKCC */ | |
3196 Lisp_Object p = XEVENT (event)->event.process.process; | |
3197 #endif /* not USE_KKCC */ | |
3198 Charcount readstatus; | 3164 Charcount readstatus; |
3199 int iter; | 3165 int iter; |
3200 | 3166 |
3201 assert (PROCESSP (p)); | 3167 assert (PROCESSP (p)); |
3202 for (iter = 0; iter < 2; iter++) | 3168 for (iter = 0; iter < 2; iter++) |
3286 | 3252 |
3287 case timeout_event: | 3253 case timeout_event: |
3288 { | 3254 { |
3289 Lisp_Event *e = XEVENT (event); | 3255 Lisp_Event *e = XEVENT (event); |
3290 | 3256 |
3291 #ifdef USE_KKCC | 3257 if (!NILP (EVENT_TIMEOUT_FUNCTION (e))) |
3292 if (!NILP (XTIMEOUT_DATA_FUNCTION (EVENT_DATA (e)))) | 3258 call1 (EVENT_TIMEOUT_FUNCTION (e), |
3293 call1 (XTIMEOUT_DATA_FUNCTION (EVENT_DATA (e)), | 3259 EVENT_TIMEOUT_OBJECT (e)); |
3294 XTIMEOUT_DATA_OBJECT (EVENT_DATA (e))); | |
3295 #else /* not USE_KKCC */ | |
3296 if (!NILP (e->event.timeout.function)) | |
3297 call1 (e->event.timeout.function, | |
3298 e->event.timeout.object); | |
3299 #endif /* not USE_KKCC */ | |
3300 return; | 3260 return; |
3301 } | 3261 } |
3302 case magic_event: | 3262 case magic_event: |
3303 event_stream_handle_magic_event (XEVENT (event)); | 3263 event_stream_handle_magic_event (XEVENT (event)); |
3304 return; | 3264 return; |
3362 enum munge_me_out_the_door munge, | 3322 enum munge_me_out_the_door munge, |
3363 int has_normal_binding_p, int *did_munge) | 3323 int has_normal_binding_p, int *did_munge) |
3364 { | 3324 { |
3365 Lisp_Object suffix; | 3325 Lisp_Object suffix; |
3366 | 3326 |
3367 EVENT_CHAIN_LOOP (suffix, builder->munge_me[munge].first_mungeable_event) | 3327 EVENT_CHAIN_LOOP (suffix, builder->first_mungeable_event[munge]) |
3368 { | 3328 { |
3369 Lisp_Object result = munging_key_map_event_binding (suffix, munge); | 3329 Lisp_Object result = munging_key_map_event_binding (suffix, munge); |
3370 | 3330 |
3371 if (NILP (result)) | 3331 if (NILP (result)) |
3372 continue; | 3332 continue; |
3406 deallocated events afterwards, which is bad -- so make it | 3366 deallocated events afterwards, which is bad -- so make it |
3407 point at the beginning of the munged events. */ | 3367 point at the beginning of the munged events. */ |
3408 EVENT_CHAIN_LOOP (tempev, suffix) | 3368 EVENT_CHAIN_LOOP (tempev, suffix) |
3409 { | 3369 { |
3410 Lisp_Object *mungeable_event = | 3370 Lisp_Object *mungeable_event = |
3411 &builder->munge_me[1 - munge].first_mungeable_event; | 3371 &builder->first_mungeable_event[1 - munge]; |
3412 if (EQ (tempev, *mungeable_event)) | 3372 if (EQ (tempev, *mungeable_event)) |
3413 { | 3373 { |
3414 *mungeable_event = new_chain; | 3374 *mungeable_event = new_chain; |
3415 break; | 3375 break; |
3416 } | 3376 } |
3417 } | 3377 } |
3418 | 3378 |
3419 /* Now munge the current event chain in the command builder. */ | 3379 /* Now munge the current event chain in the command builder. */ |
3420 n = event_chain_count (suffix); | 3380 n = event_chain_count (suffix); |
3421 command_builder_replace_suffix (builder, suffix, new_chain); | 3381 command_builder_replace_suffix (builder, suffix, new_chain); |
3422 builder->munge_me[munge].first_mungeable_event = Qnil; | 3382 builder->first_mungeable_event[munge] = Qnil; |
3423 | 3383 |
3424 *did_munge = 1; | 3384 *did_munge = 1; |
3425 | 3385 |
3426 return command_builder_find_leaf_1 (builder); | 3386 return command_builder_find_leaf_1 (builder); |
3427 } | 3387 } |
3450 Lisp_Object evee = builder->current_events; | 3410 Lisp_Object evee = builder->current_events; |
3451 | 3411 |
3452 if (XEVENT_TYPE (evee) == misc_user_event) | 3412 if (XEVENT_TYPE (evee) == misc_user_event) |
3453 { | 3413 { |
3454 if (allow_misc_user_events_p && (NILP (XEVENT_NEXT (evee)))) | 3414 if (allow_misc_user_events_p && (NILP (XEVENT_NEXT (evee)))) |
3455 #ifdef USE_KKCC | 3415 return list2 (XEVENT_EVAL_FUNCTION (evee), |
3456 return list2 (XEVAL_DATA_FUNCTION (XEVENT_DATA (evee)), | 3416 XEVENT_EVAL_OBJECT (evee)); |
3457 XEVAL_DATA_OBJECT (XEVENT_DATA (evee))); | |
3458 #else /* not USE_KKCC */ | |
3459 return list2 (XEVENT (evee)->event.eval.function, | |
3460 XEVENT (evee)->event.eval.object); | |
3461 #endif /* not USE_KKCC */ | |
3462 else | 3417 else |
3463 return Qnil; | 3418 return Qnil; |
3464 } | 3419 } |
3465 | 3420 |
3466 /* if we're currently in a menu accelerator, check there for further | 3421 /* if we're currently in a menu accelerator, check there for further |
3512 a shifted character, then try again with the lowercase version. */ | 3467 a shifted character, then try again with the lowercase version. */ |
3513 | 3468 |
3514 if (XEVENT_TYPE (builder->most_current_event) == key_press_event | 3469 if (XEVENT_TYPE (builder->most_current_event) == key_press_event |
3515 && !NILP (Vretry_undefined_key_binding_unshifted)) | 3470 && !NILP (Vretry_undefined_key_binding_unshifted)) |
3516 { | 3471 { |
3517 Lisp_Object terminal = builder->most_current_event; | 3472 if (event_upshifted_p (builder->most_current_event)) |
3518 #ifdef USE_KKCC | |
3519 Lisp_Key_Data* key = XKEY_DATA (XEVENT_DATA (terminal)); | |
3520 #else /* not USE_KKCC */ | |
3521 struct key_data *key = &XEVENT (terminal)->event.key; | |
3522 #endif /* not USE_KKCC */ | |
3523 Ichar c = 0; | |
3524 #ifdef USE_KKCC | |
3525 if ((KEY_DATA_MODIFIERS (key) & XEMACS_MOD_SHIFT) | |
3526 || (CHAR_OR_CHAR_INTP (KEY_DATA_KEYSYM(key)) | |
3527 && ((c = XCHAR_OR_CHAR_INT (KEY_DATA_KEYSYM(key))), | |
3528 c >= 'A' && c <= 'Z'))) | |
3529 #else /* not USE_KKCC */ | |
3530 if ((key->modifiers & XEMACS_MOD_SHIFT) | |
3531 || (CHAR_OR_CHAR_INTP (key->keysym) | |
3532 && ((c = XCHAR_OR_CHAR_INT (key->keysym)), | |
3533 c >= 'A' && c <= 'Z'))) | |
3534 #endif /* not USE_KKCC */ | |
3535 { | 3473 { |
3536 Lisp_Object neubauten = copy_command_builder (builder, 0); | 3474 Lisp_Object neubauten = copy_command_builder (builder, 0); |
3537 struct command_builder *neub = XCOMMAND_BUILDER (neubauten); | 3475 struct command_builder *neub = XCOMMAND_BUILDER (neubauten); |
3538 struct gcpro gcpro1; | 3476 struct gcpro gcpro1; |
3539 | 3477 |
3540 GCPRO1 (neubauten); | 3478 GCPRO1 (neubauten); |
3541 terminal = event_chain_tail (neub->current_events); | 3479 downshift_event (event_chain_tail (neub->current_events)); |
3542 #ifdef USE_KKCC | |
3543 key = XKEY_DATA (XEVENT_DATA (terminal)); | |
3544 | |
3545 if (KEY_DATA_MODIFIERS (key) & XEMACS_MOD_SHIFT) | |
3546 SET_KEY_DATA_MODIFIERS (key, (KEY_DATA_MODIFIERS (key) & (~ XEMACS_MOD_SHIFT))); | |
3547 else | |
3548 SET_KEY_DATA_KEYSYM (key, make_char (c + 'a' - 'A')); | |
3549 #else /* not USE_KKCC */ | |
3550 key = &XEVENT (terminal)->event.key; | |
3551 | |
3552 if (key->modifiers & XEMACS_MOD_SHIFT) | |
3553 key->modifiers &= (~ XEMACS_MOD_SHIFT); | |
3554 else | |
3555 key->keysym = make_char (c + 'a' - 'A'); | |
3556 #endif /* not USE_KKCC */ | |
3557 | |
3558 result = | 3480 result = |
3559 command_builder_find_leaf_no_mule_processing | 3481 command_builder_find_leaf_no_mule_processing |
3560 (neub, allow_misc_user_events_p, did_munge); | 3482 (neub, allow_misc_user_events_p, did_munge); |
3561 | 3483 |
3562 if (!NILP (result)) | 3484 if (!NILP (result)) |
3571 } | 3493 } |
3572 } | 3494 } |
3573 | 3495 |
3574 /* help-char is `auto-bound' in every keymap */ | 3496 /* help-char is `auto-bound' in every keymap */ |
3575 if (!NILP (Vprefix_help_command) && | 3497 if (!NILP (Vprefix_help_command) && |
3576 event_matches_key_specifier_p (XEVENT (builder->most_current_event), | 3498 event_matches_key_specifier_p (builder->most_current_event, Vhelp_char)) |
3577 Vhelp_char)) | |
3578 return Vprefix_help_command; | 3499 return Vprefix_help_command; |
3579 | 3500 |
3580 return Qnil; | 3501 return Qnil; |
3581 } | 3502 } |
3582 | 3503 |
3621 | 3542 |
3622 /* If keysym is a non-ASCII char, bind it to self-insert-char by default. */ | 3543 /* If keysym is a non-ASCII char, bind it to self-insert-char by default. */ |
3623 if (XEVENT_TYPE (builder->most_current_event) == key_press_event | 3544 if (XEVENT_TYPE (builder->most_current_event) == key_press_event |
3624 && !NILP (Vcomposed_character_default_binding)) | 3545 && !NILP (Vcomposed_character_default_binding)) |
3625 { | 3546 { |
3626 #ifdef USE_KKCC | 3547 Lisp_Object keysym = XEVENT_KEY_KEYSYM (builder->most_current_event); |
3627 Lisp_Object keysym = | |
3628 XKEY_DATA_KEYSYM(XEVENT_DATA (builder->most_current_event)); | |
3629 #else /* not USE_KKCC */ | |
3630 Lisp_Object keysym = | |
3631 XEVENT (builder->most_current_event)->event.key.keysym; | |
3632 #endif /* not USE_KKCC */ | |
3633 if (CHARP (keysym) && !ichar_ascii_p (XCHAR (keysym))) | 3548 if (CHARP (keysym) && !ichar_ascii_p (XCHAR (keysym))) |
3634 return Vcomposed_character_default_binding; | 3549 return Vcomposed_character_default_binding; |
3635 } | 3550 } |
3636 #endif | 3551 #endif |
3637 | 3552 |
4038 */ | 3953 */ |
4039 { | 3954 { |
4040 Lisp_Object recent = command_builder->most_current_event; | 3955 Lisp_Object recent = command_builder->most_current_event; |
4041 | 3956 |
4042 if (EVENTP (recent) | 3957 if (EVENTP (recent) |
4043 && event_matches_key_specifier_p (XEVENT (recent), Vmeta_prefix_char)) | 3958 && event_matches_key_specifier_p (recent, Vmeta_prefix_char)) |
4044 { | 3959 { |
4045 Lisp_Event *e; | 3960 Lisp_Event *e; |
4046 /* When we see a sequence like "ESC x", pretend we really saw "M-x". | 3961 /* When we see a sequence like "ESC x", pretend we really saw "M-x". |
4047 DoubleThink the recent-keys and this-command-keys as well. */ | 3962 DoubleThink the recent-keys and this-command-keys as well. */ |
4048 | 3963 |
4050 builder to be a copy of this one with the meta-bit set instead of | 3965 builder to be a copy of this one with the meta-bit set instead of |
4051 pushing a new event. | 3966 pushing a new event. |
4052 */ | 3967 */ |
4053 Fcopy_event (event, recent); | 3968 Fcopy_event (event, recent); |
4054 e = XEVENT (recent); | 3969 e = XEVENT (recent); |
4055 #ifdef USE_KKCC | |
4056 if (EVENT_TYPE (e) == key_press_event) | 3970 if (EVENT_TYPE (e) == key_press_event) |
4057 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (e), | 3971 SET_EVENT_KEY_MODIFIERS (e, EVENT_KEY_MODIFIERS (e) | |
4058 XKEY_DATA_MODIFIERS (EVENT_DATA (e)) | | 3972 XEMACS_MOD_META); |
4059 XEMACS_MOD_META); | |
4060 else if (EVENT_TYPE (e) == button_press_event | 3973 else if (EVENT_TYPE (e) == button_press_event |
4061 || EVENT_TYPE (e) == button_release_event) | 3974 || EVENT_TYPE (e) == button_release_event) |
4062 XSET_BUTTON_DATA_MODIFIERS (EVENT_DATA (e), | 3975 SET_EVENT_BUTTON_MODIFIERS (e, EVENT_BUTTON_MODIFIERS (e) | |
4063 XBUTTON_DATA_MODIFIERS (EVENT_DATA (e)) | | 3976 XEMACS_MOD_META); |
4064 XEMACS_MOD_META); | |
4065 #else /* not USE_KKCC */ | |
4066 if (e->event_type == key_press_event) | |
4067 e->event.key.modifiers |= XEMACS_MOD_META; | |
4068 else if (e->event_type == button_press_event | |
4069 || e->event_type == button_release_event) | |
4070 e->event.button.modifiers |= XEMACS_MOD_META; | |
4071 #endif /* not USE_KKCC */ | |
4072 else | 3977 else |
4073 abort (); | 3978 abort (); |
4074 | 3979 |
4075 { | 3980 { |
4076 int tckn = event_chain_count (Vthis_command_keys); | 3981 int tckn = event_chain_count (Vthis_command_keys); |
4123 } | 4028 } |
4124 /* #### i don't trust this at all. --ben */ | 4029 /* #### i don't trust this at all. --ben */ |
4125 #if 0 | 4030 #if 0 |
4126 else if (!NILP (Vquit_flag)) | 4031 else if (!NILP (Vquit_flag)) |
4127 { | 4032 { |
4128 Lisp_Object quit_event = Fmake_event (Qnil, Qnil); | |
4129 Lisp_Event *e = XEVENT (quit_event); | |
4130 /* if quit happened during menu acceleration, pretend we read it */ | 4033 /* if quit happened during menu acceleration, pretend we read it */ |
4131 struct console *con = XCONSOLE (Fselected_console ()); | 4034 struct console *con = XCONSOLE (Fselected_console ()); |
4132 int ch = CONSOLE_QUIT_CHAR (con); | 4035 |
4133 | 4036 enqueue_command_event (Fcopy_event (CONSOLE_QUIT_EVENT (con), |
4134 character_to_event (ch, e, con, 1, 1); | 4037 Qnil)); |
4135 e->channel = wrap_console (con); | |
4136 | |
4137 enqueue_command_event (quit_event); | |
4138 Vquit_flag = Qnil; | 4038 Vquit_flag = Qnil; |
4139 } | 4039 } |
4140 #endif | 4040 #endif |
4141 } | 4041 } |
4142 else if (!NILP (leaf)) | 4042 else if (!NILP (leaf)) |
4160 is_scrollbar_event (Lisp_Object event) | 4060 is_scrollbar_event (Lisp_Object event) |
4161 { | 4061 { |
4162 #ifdef HAVE_SCROLLBARS | 4062 #ifdef HAVE_SCROLLBARS |
4163 Lisp_Object fun; | 4063 Lisp_Object fun; |
4164 | 4064 |
4165 #ifdef USE_KKCC | |
4166 if (XEVENT_TYPE (event) != misc_user_event) | 4065 if (XEVENT_TYPE (event) != misc_user_event) |
4167 return 0; | 4066 return 0; |
4168 fun = XMISC_USER_DATA_FUNCTION(XEVENT_DATA (event)); | 4067 fun = XEVENT_MISC_USER_FUNCTION (event); |
4169 #else /* not USE_KKCC */ | |
4170 if (XEVENT (event)->event_type != misc_user_event) | |
4171 return 0; | |
4172 fun = XEVENT (event)->event.misc.function; | |
4173 #endif /* not USE_KKCC */ | |
4174 | 4068 |
4175 return (EQ (fun, Qscrollbar_line_up) || | 4069 return (EQ (fun, Qscrollbar_line_up) || |
4176 EQ (fun, Qscrollbar_line_down) || | 4070 EQ (fun, Qscrollbar_line_down) || |
4177 EQ (fun, Qscrollbar_page_up) || | 4071 EQ (fun, Qscrollbar_page_up) || |
4178 EQ (fun, Qscrollbar_page_down) || | 4072 EQ (fun, Qscrollbar_page_down) || |
4305 buffer_reset_changes (XBUFFER (w->buffer)); | 4199 buffer_reset_changes (XBUFFER (w->buffer)); |
4306 } | 4200 } |
4307 | 4201 |
4308 pre_command_hook (); | 4202 pre_command_hook (); |
4309 | 4203 |
4310 #ifdef USE_KKCC | |
4311 if (XEVENT_TYPE (event) == misc_user_event) | 4204 if (XEVENT_TYPE (event) == misc_user_event) |
4312 { | 4205 { |
4313 call1 (XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event)), | 4206 call1 (XEVENT_MISC_USER_FUNCTION (event), |
4314 XMISC_USER_DATA_OBJECT (XEVENT_DATA (event))); | 4207 XEVENT_MISC_USER_OBJECT (event)); |
4315 } | 4208 } |
4316 #else /* not USE_KKCC */ | |
4317 if (XEVENT (event)->event_type == misc_user_event) | |
4318 { | |
4319 call1 (XEVENT (event)->event.eval.function, | |
4320 XEVENT (event)->event.eval.object); | |
4321 } | |
4322 #endif /* not USE_KKCC */ | |
4323 else | 4209 else |
4324 { | 4210 { |
4325 Fcommand_execute (Vthis_command, Qnil, Qnil); | 4211 Fcommand_execute (Vthis_command, Qnil, Qnil); |
4326 } | 4212 } |
4327 | 4213 |
4501 console = Vselected_console; | 4387 console = Vselected_console; |
4502 else if (!EQ (console, Vselected_console)) | 4388 else if (!EQ (console, Vselected_console)) |
4503 Fselect_console (console); | 4389 Fselect_console (console); |
4504 | 4390 |
4505 command_builder = XCOMMAND_BUILDER (XCONSOLE (console)->command_builder); | 4391 command_builder = XCOMMAND_BUILDER (XCONSOLE (console)->command_builder); |
4506 #ifdef USE_KKCC | |
4507 switch (XEVENT_TYPE (event)) | 4392 switch (XEVENT_TYPE (event)) |
4508 #else /* not USE_KKCC */ | |
4509 switch (XEVENT (event)->event_type) | |
4510 #endif /* not USE_KKCC */ | |
4511 { | 4393 { |
4512 case button_press_event: | 4394 case button_press_event: |
4513 case button_release_event: | 4395 case button_release_event: |
4514 case key_press_event: | 4396 case key_press_event: |
4515 { | 4397 { |
4667 anyway (for keyboard macros). There's even one instance | 4549 anyway (for keyboard macros). There's even one instance |
4668 (in pending-del.el) of `this-command' getting set to a cons | 4550 (in pending-del.el) of `this-command' getting set to a cons |
4669 (a lambda expression). So in the `eval' case I'll just | 4551 (a lambda expression). So in the `eval' case I'll just |
4670 convert it into a lambda expression. | 4552 convert it into a lambda expression. |
4671 */ | 4553 */ |
4672 #ifdef USE_KKCC | 4554 if (EQ (XEVENT_MISC_USER_FUNCTION (event), Qcall_interactively) |
4673 if (EQ (XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event)), Qcall_interactively) | 4555 && SYMBOLP (XEVENT_MISC_USER_OBJECT (event))) |
4674 && SYMBOLP (XMISC_USER_DATA_OBJECT (XEVENT_DATA (event)))) | 4556 Vthis_command = XEVENT_MISC_USER_OBJECT (event); |
4675 Vthis_command = XMISC_USER_DATA_OBJECT (XEVENT_DATA (event)); | 4557 else if (EQ (XEVENT_MISC_USER_FUNCTION (event), Qeval)) |
4676 else if (EQ (XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event)), Qeval)) | |
4677 Vthis_command = | 4558 Vthis_command = |
4678 Fcons (Qlambda, Fcons (Qnil, XMISC_USER_DATA_OBJECT (XEVENT_DATA (event)))); | 4559 Fcons (Qlambda, Fcons (Qnil, XEVENT_MISC_USER_OBJECT (event))); |
4679 else if (SYMBOLP (XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event)))) | 4560 else if (SYMBOLP (XEVENT_MISC_USER_FUNCTION (event))) |
4680 /* A scrollbar command or the like. */ | 4561 /* A scrollbar command or the like. */ |
4681 Vthis_command = XMISC_USER_DATA_FUNCTION (XEVENT_DATA (event)); | 4562 Vthis_command = XEVENT_MISC_USER_FUNCTION (event); |
4682 #else /* not USE_KKCC */ | |
4683 if (EQ (XEVENT (event)->event.eval.function, Qcall_interactively) | |
4684 && SYMBOLP (XEVENT (event)->event.eval.object)) | |
4685 Vthis_command = XEVENT (event)->event.eval.object; | |
4686 else if (EQ (XEVENT (event)->event.eval.function, Qeval)) | |
4687 Vthis_command = | |
4688 Fcons (Qlambda, Fcons (Qnil, XEVENT (event)->event.eval.object)); | |
4689 else if (SYMBOLP (XEVENT (event)->event.eval.function)) | |
4690 /* A scrollbar command or the like. */ | |
4691 Vthis_command = XEVENT (event)->event.eval.function; | |
4692 #endif /* not USE_KKCC */ | |
4693 else | 4563 else |
4694 /* Huh? */ | 4564 /* Huh? */ |
4695 Vthis_command = Qnil; | 4565 Vthis_command = Qnil; |
4696 | 4566 |
4697 /* clear the echo area */ | 4567 /* clear the echo area */ |
4779 command_builder = XCOMMAND_BUILDER (con->command_builder); | 4649 command_builder = XCOMMAND_BUILDER (con->command_builder); |
4780 if (! command_event_p (event)) | 4650 if (! command_event_p (event)) |
4781 execute_internal_event (event); | 4651 execute_internal_event (event); |
4782 else | 4652 else |
4783 { | 4653 { |
4784 #ifdef USE_KKCC | |
4785 if (XEVENT_TYPE (event) == misc_user_event) | 4654 if (XEVENT_TYPE (event) == misc_user_event) |
4786 #else /* not USE_KKCC */ | |
4787 if (XEVENT (event)->event_type == misc_user_event) | |
4788 #endif /* not USE_KKCC */ | |
4789 reset_current_events (command_builder); | 4655 reset_current_events (command_builder); |
4790 result = lookup_command_event (command_builder, event, 1); | 4656 result = lookup_command_event (command_builder, event, 1); |
4791 if (!KEYMAPP (result)) | 4657 if (!KEYMAPP (result)) |
4792 { | 4658 { |
4793 result = current_events_into_vector (command_builder); | 4659 result = current_events_into_vector (command_builder); |
4850 dribble_out_event (Lisp_Object event) | 4716 dribble_out_event (Lisp_Object event) |
4851 { | 4717 { |
4852 if (NILP (Vdribble_file)) | 4718 if (NILP (Vdribble_file)) |
4853 return; | 4719 return; |
4854 | 4720 |
4855 #ifdef USE_KKCC | |
4856 if (XEVENT_TYPE (event) == key_press_event && | 4721 if (XEVENT_TYPE (event) == key_press_event && |
4857 !XKEY_DATA_MODIFIERS (XEVENT_DATA (event))) | 4722 !XEVENT_KEY_MODIFIERS (event)) |
4858 { | 4723 { |
4859 Lisp_Object keysym = XKEY_DATA_KEYSYM (XEVENT_DATA (event)); | 4724 Lisp_Object keysym = XEVENT_KEY_KEYSYM (event); |
4860 if (CHARP (XKEY_DATA_KEYSYM (XEVENT_DATA (event)))) | 4725 if (CHARP (XEVENT_KEY_KEYSYM (event))) |
4861 #else /* not USE_KKCC */ | |
4862 if (XEVENT (event)->event_type == key_press_event && | |
4863 !XEVENT (event)->event.key.modifiers) | |
4864 { | |
4865 Lisp_Object keysym = XEVENT (event)->event.key.keysym; | |
4866 if (CHARP (XEVENT (event)->event.key.keysym)) | |
4867 #endif /* not USE_KKCC */ | |
4868 { | 4726 { |
4869 Ichar ch = XCHAR (keysym); | 4727 Ichar ch = XCHAR (keysym); |
4870 Ibyte str[MAX_ICHAR_LEN]; | 4728 Ibyte str[MAX_ICHAR_LEN]; |
4871 Bytecount len = set_itext_ichar (str, ch); | 4729 Bytecount len = set_itext_ichar (str, ch); |
4872 Lstream_write (XLSTREAM (Vdribble_file), str, len); | 4730 Lstream_write (XLSTREAM (Vdribble_file), str, len); |
5020 staticpro (&Vrecent_keys_ring); | 4878 staticpro (&Vrecent_keys_ring); |
5021 | 4879 |
5022 Vthis_command_keys = Qnil; | 4880 Vthis_command_keys = Qnil; |
5023 staticpro (&Vthis_command_keys); | 4881 staticpro (&Vthis_command_keys); |
5024 Vthis_command_keys_tail = Qnil; | 4882 Vthis_command_keys_tail = Qnil; |
5025 dump_add_root_object (&Vthis_command_keys_tail); | 4883 dump_add_root_lisp_object (&Vthis_command_keys_tail); |
5026 | 4884 |
5027 command_event_queue = Qnil; | 4885 command_event_queue = Qnil; |
5028 staticpro (&command_event_queue); | 4886 staticpro (&command_event_queue); |
5029 command_event_queue_tail = Qnil; | 4887 command_event_queue_tail = Qnil; |
5030 dump_add_root_object (&command_event_queue_tail); | 4888 dump_add_root_lisp_object (&command_event_queue_tail); |
4889 | |
4890 dispatch_event_queue = Qnil; | |
4891 staticpro (&dispatch_event_queue); | |
4892 dispatch_event_queue_tail = Qnil; | |
4893 dump_add_root_lisp_object (&dispatch_event_queue_tail); | |
5031 | 4894 |
5032 Vlast_selected_frame = Qnil; | 4895 Vlast_selected_frame = Qnil; |
5033 staticpro (&Vlast_selected_frame); | 4896 staticpro (&Vlast_selected_frame); |
5034 | 4897 |
5035 pending_timeout_list = Qnil; | 4898 pending_timeout_list = Qnil; |