comparison src/events.h @ 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 345b7d75cab4
children 416490619c01
comparison
equal deleted inserted replaced
1203:5f2f8dcbfb3e 1204:e22b0213b713
24 24
25 #ifndef INCLUDED_events_h_ 25 #ifndef INCLUDED_events_h_
26 #define INCLUDED_events_h_ 26 #define INCLUDED_events_h_
27 27
28 #include "systime.h" 28 #include "systime.h"
29
30 #ifdef USE_KKCC
31 #include "opaque.h"
32 #endif /* USE_KKCC */
33 29
34 /* There is one object called an event_stream. This object contains 30 /* There is one object called an event_stream. This object contains
35 callback functions for doing the window-system-dependent operations 31 callback functions for doing the window-system-dependent operations
36 that XEmacs requires. 32 that XEmacs requires.
37 33
145 141
146 /* 142 /*
147 Stream pairs description 143 Stream pairs description
148 ------------------------ 144 ------------------------
149 145
150 Since there are many possible processes/event loop combinations, the event code 146 Since there are many possible processes/event loop combinations, the
151 is responsible for creating an appropriate lstream type. The process 147 event code is responsible for creating an appropriate lstream type. The
152 implementation does not care about that implementation. 148 process implementation does not care about that implementation.
153 149
154 The Create stream pair function is passed two void* values, which identify 150 The Create stream pair function is passed two void* values, which
155 process-dependent 'handles'. The process implementation uses these handles 151 identify process-dependent 'handles'. The process implementation uses
156 to communicate with child processes. The function must be prepared to receive 152 these handles to communicate with child processes. The function must be
157 handle types of any process implementation. Since only one process 153 prepared to receive handle types of any process implementation. Since
158 implementation exists in a particular XEmacs configuration, preprocessing 154 only one process implementation exists in a particular XEmacs
159 is a means of compiling in the support for the code which deals with particular 155 configuration, preprocessing is a means of compiling in the support for
160 handle types. 156 the code which deals with particular handle types.
161 157
162 For example, a unixoid type loop, which relies on file descriptors, may be 158 For example, a unixoid type loop, which relies on file descriptors, may be
163 asked to create a pair of streams by a unix-style process implementation. 159 asked to create a pair of streams by a unix-style process implementation.
164 In this case, the handles passed are unix file descriptors, and the code 160 In this case, the handles passed are unix file descriptors, and the code
165 may deal with these directly. Although, the same code may be used on Win32 161 may deal with these directly. Although, the same code may be used on Win32
207 void (*remove_timeout_cb) (int); 203 void (*remove_timeout_cb) (int);
208 void (*select_console_cb) (struct console *); 204 void (*select_console_cb) (struct console *);
209 void (*unselect_console_cb) (struct console *); 205 void (*unselect_console_cb) (struct console *);
210 void (*select_process_cb) (Lisp_Process *, int doin, int doerr); 206 void (*select_process_cb) (Lisp_Process *, int doin, int doerr);
211 void (*unselect_process_cb) (Lisp_Process *, int doin, int doerr); 207 void (*unselect_process_cb) (Lisp_Process *, int doin, int doerr);
212 void (*quit_p_cb) (void); 208 int (*quit_check_disallowed_p_cb)(void);
213 void (*force_event_pending) (struct frame* f); 209 void (*drain_queue_cb) (void);
210 void (*force_event_pending_cb)(struct frame* f);
214 void (*create_io_streams_cb) (void* /* inhandle*/, void* /*outhandle*/ , 211 void (*create_io_streams_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
215 void * /* errhandle*/, 212 void * /* errhandle*/,
216 Lisp_Object* /* instream */, 213 Lisp_Object* /* instream */,
217 Lisp_Object* /* outstream */, 214 Lisp_Object* /* outstream */,
218 Lisp_Object* /* errstream */, 215 Lisp_Object* /* errstream */,
229 #define STREAM_PTY_FLUSHING 0x0001 226 #define STREAM_PTY_FLUSHING 0x0001
230 #define STREAM_NETWORK_CONNECTION 0x0002 227 #define STREAM_NETWORK_CONNECTION 0x0002
231 228
232 extern struct event_stream *event_stream; 229 extern struct event_stream *event_stream;
233 230
234 #ifdef USE_KKCC 231 #ifdef EVENT_DATA_AS_OBJECTS
235 Lisp_Object make_key_data (void); 232 #define EVENT_FOO_BAR_1(extractor, field) ((extractor)->field)
236 Lisp_Object make_button_data (void); 233 #define EVENT_FOO_BAR(e, uptype, downtype, field) EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field)
237 Lisp_Object make_motion_data (void); 234 #define SET_EVENT_FOO_BAR_1(extractor, field, val) \
238 Lisp_Object make_process_data (void); 235 do { (extractor)->field = (val); } while (0)
239 Lisp_Object make_timeout_data (void); 236 #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) SET_EVENT_FOO_BAR_1 (X##uptype##_DATA (EVENT_DATA (e)), field, val)
240 Lisp_Object make_magic_data (void); 237 #else
241 Lisp_Object make_magic_eval_data (void); 238 #define EVENT_FOO_BAR(e, uptype, downtype, field) ((e)->event.downtype.field)
242 Lisp_Object make_eval_data (void); 239 #define SET_EVENT_FOO_BAR(e, uptype, downtype, field, val) \
243 Lisp_Object make_misc_user_data (void); 240 do { (e)->event.downtype.field = (val); } while (0)
244 #endif /* USE_KKCC */ 241 #endif
245 242
246 typedef enum emacs_event_type 243 typedef enum emacs_event_type
247 { 244 {
248 empty_event, 245 empty_event,
249 key_press_event, 246 key_press_event,
276 KEYCHAR_LAST 273 KEYCHAR_LAST
277 }; 274 };
278 275
279 #endif /* MULE */ 276 #endif /* MULE */
280 277
281 #ifdef USE_KKCC
282 struct Lisp_Key_Data 278 struct Lisp_Key_Data
283 #else /* not USE_KKCC */ 279 {
284 struct key_data 280 #ifdef EVENT_DATA_AS_OBJECTS
285 #endif /* not USE_KKCC */
286 {
287 #ifdef USE_KKCC
288 struct lrecord_header lheader; 281 struct lrecord_header lheader;
289 #endif /* USE_KKCC */ 282 #endif /* EVENT_DATA_AS_OBJECTS */
290 /* What keysym this is; a character or a symbol. */ 283 /* What keysym this is; a character or a symbol. */
291 Lisp_Object keysym; 284 Lisp_Object keysym;
292 /* Modifiers held down when key was pressed: control, meta, etc. 285 /* Modifiers held down when key was pressed: control, meta, etc.
293 Also includes buttons. For many keys, Shift is not a bit; that 286 Also includes buttons. For many keys, Shift is not a bit; that
294 is implicit in the keyboard layout. */ 287 is implicit in the keyboard layout. */
313 finds C-q mapped to C-a?) */ 306 finds C-q mapped to C-a?) */
314 Ichar alt_keychars[KEYCHAR_LAST]; 307 Ichar alt_keychars[KEYCHAR_LAST];
315 #endif /* MULE */ 308 #endif /* MULE */
316 }; 309 };
317 310
318 #ifdef USE_KKCC
319 typedef struct Lisp_Key_Data Lisp_Key_Data; 311 typedef struct Lisp_Key_Data Lisp_Key_Data;
320 312
313 #define KEY_DATA_KEYSYM(d) ((d)->keysym)
314 #define KEY_DATA_MODIFIERS(d) ((d)->modifiers)
315 #define SET_KEY_DATA_KEYSYM(d, k) ((d)->keysym = k)
316 #define SET_KEY_DATA_MODIFIERS(d, m) ((d)->modifiers = m)
317
318 #ifdef EVENT_DATA_AS_OBJECTS
321 DECLARE_LRECORD (key_data, Lisp_Key_Data); 319 DECLARE_LRECORD (key_data, Lisp_Key_Data);
322 #define XKEY_DATA(x) XRECORD (x, key_data, Lisp_Key_Data) 320 #define XKEY_DATA(x) XRECORD (x, key_data, Lisp_Key_Data)
323 #define wrap_key_data(p) wrap_record (p, key_data) 321 #define wrap_key_data(p) wrap_record (p, key_data)
324 #define KEY_DATAP(x) RECORDP (x, key_data) 322 #define KEY_DATAP(x) RECORDP (x, key_data)
325 #define CHECK_KEY_DATA(x) CHECK_RECORD (x, key_data) 323 #define CHECK_KEY_DATA(x) CHECK_RECORD (x, key_data)
326 #define CONCHECK_KEY_DATA(x) CONCHECK_RECORD (x, key_data) 324 #define CONCHECK_KEY_DATA(x) CONCHECK_RECORD (x, key_data)
327 325 #endif /* EVENT_DATA_AS_OBJECTS */
328 #define XKEY_DATA_KEYSYM(d) (XKEY_DATA (d)->keysym) 326
329 #define KEY_DATA_KEYSYM(d) ((d)->keysym) 327 #define EVENT_KEY_KEYSYM(e) EVENT_FOO_BAR (e, KEY, key, keysym)
330 #define XKEY_DATA_MODIFIERS(d) (XKEY_DATA (d)->modifiers) 328 #define XEVENT_KEY_KEYSYM(e) EVENT_KEY_KEYSYM (XEVENT (e))
331 #define KEY_DATA_MODIFIERS(d) ((d)->modifiers) 329 #define SET_EVENT_KEY_KEYSYM(e, val) \
332 330 SET_EVENT_FOO_BAR (e, KEY, key, keysym, val)
333 #define XSET_KEY_DATA_KEYSYM(d, k) (XKEY_DATA (d)->keysym = (k)) 331 #define XSET_EVENT_KEY_KEYSYM(e, val) \
334 #define SET_KEY_DATA_KEYSYM(d, k) ((d)->keysym = k) 332 SET_EVENT_KEY_KEYSYM (XEVENT (e), val)
335 #define XSET_KEY_DATA_MODIFIERS(d, m) (XKEY_DATA (d)->modifiers = m) 333
336 #define SET_KEY_DATA_MODIFIERS(d, m) ((d)->modifiers = m) 334 #define EVENT_KEY_MODIFIERS(e) EVENT_FOO_BAR (e, KEY, key, modifiers)
337 #endif /* USE_KKCC */ 335 #define XEVENT_KEY_MODIFIERS(e) EVENT_KEY_MODIFIERS (XEVENT (e))
338 336 #define SET_EVENT_KEY_MODIFIERS(e, val) \
339 #ifdef USE_KKCC 337 SET_EVENT_FOO_BAR (e, KEY, key, modifiers, val)
338 #define XSET_EVENT_KEY_MODIFIERS(e, val) \
339 SET_EVENT_KEY_MODIFIERS (XEVENT (e), val)
340
341 #define EVENT_KEY_ALT_KEYCHARS(e, n) \
342 EVENT_FOO_BAR (e, KEY, key, alt_keychars[n])
343 #define XEVENT_KEY_ALT_KEYCHARS(e, n) EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n)
344 #define SET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \
345 SET_EVENT_FOO_BAR (e, KEY, key, alt_keychars[n], val)
346 #define XSET_EVENT_KEY_ALT_KEYCHARS(e, n, val) \
347 SET_EVENT_KEY_ALT_KEYCHARS (XEVENT (e), n, val)
348
340 struct Lisp_Button_Data 349 struct Lisp_Button_Data
341 #else /* not USE_KKCC */ 350 {
342 struct button_data 351 #ifdef EVENT_DATA_AS_OBJECTS
343 #endif /* not USE_KKCC */
344 {
345 #ifdef USE_KKCC
346 struct lrecord_header lheader; 352 struct lrecord_header lheader;
347 #endif /* USE_KKCC */ 353 #endif /* EVENT_DATA_AS_OBJECTS */
348 /* What button went down or up. */ 354 /* What button went down or up. */
349 int button; 355 int button;
350 /* Bucky-bits on that button: shift, control, meta, etc. Also 356 /* Bucky-bits on that button: shift, control, meta, etc. Also
351 includes other buttons (not the one pressed). */ 357 includes other buttons (not the one pressed). */
352 int modifiers; 358 int modifiers;
353 /* Where it was at the button-state-change (in pixels). */ 359 /* Where it was at the button-state-change (in pixels). */
354 int x, y; 360 int x, y;
355 }; 361 };
356 #ifdef USE_KKCC
357 typedef struct Lisp_Button_Data Lisp_Button_Data; 362 typedef struct Lisp_Button_Data Lisp_Button_Data;
358 363
364 #ifdef EVENT_DATA_AS_OBJECTS
359 DECLARE_LRECORD (button_data, Lisp_Button_Data); 365 DECLARE_LRECORD (button_data, Lisp_Button_Data);
360 #define XBUTTON_DATA(x) XRECORD (x, button_data, Lisp_Button_Data) 366 #define XBUTTON_DATA(x) XRECORD (x, button_data, Lisp_Button_Data)
361 #define wrap_button_data(p) wrap_record (p, button_data) 367 #define wrap_button_data(p) wrap_record (p, button_data)
362 #define BUTTON_DATAP(x) RECORDP (x, button_data) 368 #define BUTTON_DATAP(x) RECORDP (x, button_data)
363 #define CHECK_BUTTON_DATA(x) CHECK_RECORD (x, button_data) 369 #define CHECK_BUTTON_DATA(x) CHECK_RECORD (x, button_data)
364 #define CONCHECK_BUTTON_DATA(x) CONCHECK_RECORD (x, button_data) 370 #define CONCHECK_BUTTON_DATA(x) CONCHECK_RECORD (x, button_data)
365 371 #endif /* EVENT_DATA_AS_OBJECTS */
366 #define XBUTTON_DATA_BUTTON(d) (XBUTTON_DATA (d)->button) 372
367 #define XBUTTON_DATA_MODIFIERS(d) (XBUTTON_DATA (d)->modifiers) 373 #define EVENT_BUTTON_BUTTON(e) EVENT_FOO_BAR (e, BUTTON, button, button)
368 #define XBUTTON_DATA_X(d) (XBUTTON_DATA (d)->x) 374 #define XEVENT_BUTTON_BUTTON(e) EVENT_BUTTON_BUTTON (XEVENT (e))
369 #define XBUTTON_DATA_Y(d) (XBUTTON_DATA (d)->y) 375 #define SET_EVENT_BUTTON_BUTTON(e, val) \
370 376 SET_EVENT_FOO_BAR (e, BUTTON, button, button, val)
371 #define XSET_BUTTON_DATA_BUTTON(d, b) (XBUTTON_DATA (d)->button = (b)) 377 #define XSET_EVENT_BUTTON_BUTTON(e, val) \
372 #define XSET_BUTTON_DATA_MODIFIERS(d, m) (XBUTTON_DATA (d)->modifiers = (m)) 378 SET_EVENT_BUTTON_BUTTON (XEVENT (e), val)
373 #define XSET_BUTTON_DATA_X(d, new_x) (XBUTTON_DATA (d)->x = (new_x)) 379
374 #define XSET_BUTTON_DATA_Y(d, new_y) (XBUTTON_DATA (d)->y = (new_y)) 380 #define EVENT_BUTTON_MODIFIERS(e) EVENT_FOO_BAR (e, BUTTON, button, modifiers)
375 #endif /* USE_KKCC */ 381 #define XEVENT_BUTTON_MODIFIERS(e) EVENT_BUTTON_MODIFIERS (XEVENT (e))
376 382 #define SET_EVENT_BUTTON_MODIFIERS(e, val) \
377 #ifdef USE_KKCC 383 SET_EVENT_FOO_BAR (e, BUTTON, button, modifiers, val)
384 #define XSET_EVENT_BUTTON_MODIFIERS(e, val) \
385 SET_EVENT_BUTTON_MODIFIERS (XEVENT (e), val)
386
387 #define EVENT_BUTTON_X(e) EVENT_FOO_BAR (e, BUTTON, button, x)
388 #define XEVENT_BUTTON_X(e) EVENT_BUTTON_X (XEVENT (e))
389 #define SET_EVENT_BUTTON_X(e, val) \
390 SET_EVENT_FOO_BAR (e, BUTTON, button, x, val)
391 #define XSET_EVENT_BUTTON_X(e, val) \
392 SET_EVENT_BUTTON_X (XEVENT (e), val)
393
394 #define EVENT_BUTTON_Y(e) EVENT_FOO_BAR (e, BUTTON, button, y)
395 #define XEVENT_BUTTON_Y(e) EVENT_BUTTON_Y (XEVENT (e))
396 #define SET_EVENT_BUTTON_Y(e, val) \
397 SET_EVENT_FOO_BAR (e, BUTTON, button, y, val)
398 #define XSET_EVENT_BUTTON_Y(e, val) \
399 SET_EVENT_BUTTON_Y (XEVENT (e), val)
400
378 struct Lisp_Motion_Data 401 struct Lisp_Motion_Data
379 #else /* not USE_KKCC */ 402 {
380 struct motion_data 403 #ifdef EVENT_DATA_AS_OBJECTS
381 #endif /* not USE_KKCC */
382 {
383 #ifdef USE_KKCC
384 struct lrecord_header lheader; 404 struct lrecord_header lheader;
385 #endif /* USE_KKCC */ 405 #endif /* EVENT_DATA_AS_OBJECTS */
386 /* Where it was after it moved (in pixels). */ 406 /* Where it was after it moved (in pixels). */
387 int x, y; 407 int x, y;
388 /* Bucky-bits down when the motion was detected. */ 408 /* Bucky-bits down when the motion was detected. */
389 int modifiers; 409 int modifiers;
390 }; 410 };
391 #ifdef USE_KKCC
392 typedef struct Lisp_Motion_Data Lisp_Motion_Data; 411 typedef struct Lisp_Motion_Data Lisp_Motion_Data;
393 412
413 #ifdef EVENT_DATA_AS_OBJECTS
394 DECLARE_LRECORD (motion_data, Lisp_Motion_Data); 414 DECLARE_LRECORD (motion_data, Lisp_Motion_Data);
395 #define XMOTION_DATA(x) XRECORD (x, motion_data, Lisp_Motion_Data) 415 #define XMOTION_DATA(x) XRECORD (x, motion_data, Lisp_Motion_Data)
396 #define wrap_motion_data(p) wrap_record (p, motion_data) 416 #define wrap_motion_data(p) wrap_record (p, motion_data)
397 #define MOTION_DATAP(x) RECORDP (x, motion_data) 417 #define MOTION_DATAP(x) RECORDP (x, motion_data)
398 #define CHECK_MOTION_DATA(x) CHECK_RECORD (x, motion_data) 418 #define CHECK_MOTION_DATA(x) CHECK_RECORD (x, motion_data)
399 #define CONCHECK_MOTION_DATA(x) CONCHECK_RECORD (x, motion_data) 419 #define CONCHECK_MOTION_DATA(x) CONCHECK_RECORD (x, motion_data)
400 420 #endif /* EVENT_DATA_AS_OBJECTS */
401 #define XMOTION_DATA_X(d) (XMOTION_DATA (d)->x) 421
402 #define XMOTION_DATA_Y(d) (XMOTION_DATA (d)->y) 422 #define EVENT_MOTION_X(e) EVENT_FOO_BAR (e, MOTION, motion, x)
403 #define XMOTION_DATA_MODIFIERS(d) (XMOTION_DATA (d)->modifiers) 423 #define XEVENT_MOTION_X(e) EVENT_MOTION_X (XEVENT (e))
404 424 #define SET_EVENT_MOTION_X(e, val) \
405 #define XSET_MOTION_DATA_X(d, new_x) (XMOTION_DATA (d)->x = (new_x)) 425 SET_EVENT_FOO_BAR (e, MOTION, motion, x, val)
406 #define XSET_MOTION_DATA_Y(d, new_y) (XMOTION_DATA (d)->y = (new_y)) 426 #define XSET_EVENT_MOTION_X(e, val) \
407 #define XSET_MOTION_DATA_MODIFIERS(d, m) (XMOTION_DATA (d)->modifiers = (m)) 427 SET_EVENT_MOTION_X (XEVENT (e), val)
408 #endif /* USE_KKCC */ 428
409 429 #define EVENT_MOTION_Y(e) EVENT_FOO_BAR (e, MOTION, motion, y)
410 #ifdef USE_KKCC 430 #define XEVENT_MOTION_Y(e) EVENT_MOTION_Y (XEVENT (e))
431 #define SET_EVENT_MOTION_Y(e, val) \
432 SET_EVENT_FOO_BAR (e, MOTION, motion, y, val)
433 #define XSET_EVENT_MOTION_Y(e, val) \
434 SET_EVENT_MOTION_Y (XEVENT (e), val)
435
436 #define EVENT_MOTION_MODIFIERS(e) EVENT_FOO_BAR (e, MOTION, motion, modifiers)
437 #define XEVENT_MOTION_MODIFIERS(e) EVENT_MOTION_MODIFIERS (XEVENT (e))
438 #define SET_EVENT_MOTION_MODIFIERS(e, val) \
439 SET_EVENT_FOO_BAR (e, MOTION, motion, modifiers, val)
440 #define XSET_EVENT_MOTION_MODIFIERS(e, val) \
441 SET_EVENT_MOTION_MODIFIERS (XEVENT (e), val)
442
411 struct Lisp_Process_Data 443 struct Lisp_Process_Data
412 #else /* not USE_KKCC */ 444 {
413 struct process_data 445 #ifdef EVENT_DATA_AS_OBJECTS
414 #endif /* not USE_KKCC */
415 {
416 #ifdef USE_KKCC
417 struct lrecord_header lheader; 446 struct lrecord_header lheader;
418 #endif /* USE_KKCC */ 447 #endif /* EVENT_DATA_AS_OBJECTS */
419 /* the XEmacs "process" object in question */ 448 /* the XEmacs "process" object in question */
420 Lisp_Object process; 449 Lisp_Object process;
421 }; 450 };
422 #ifdef USE_KKCC
423 typedef struct Lisp_Process_Data Lisp_Process_Data; 451 typedef struct Lisp_Process_Data Lisp_Process_Data;
424 452
453 #ifdef EVENT_DATA_AS_OBJECTS
425 DECLARE_LRECORD (process_data, Lisp_Process_Data); 454 DECLARE_LRECORD (process_data, Lisp_Process_Data);
426 #define XPROCESS_DATA(x) XRECORD (x, process_data, Lisp_Process_Data) 455 #define XPROCESS_DATA(x) XRECORD (x, process_data, Lisp_Process_Data)
427 #define wrap_process_data(p) wrap_record (p, process_data) 456 #define wrap_process_data(p) wrap_record (p, process_data)
428 #define PROCESS_DATAP(x) RECORDP (x, process_data) 457 #define PROCESS_DATAP(x) RECORDP (x, process_data)
429 #define CHECK_PROCESS_DATA(x) CHECK_RECORD (x, process_data) 458 #define CHECK_PROCESS_DATA(x) CHECK_RECORD (x, process_data)
430 #define CONCHECK_PROCESS_DATA(x) CONCHECK_RECORD (x, process_data) 459 #define CONCHECK_PROCESS_DATA(x) CONCHECK_RECORD (x, process_data)
431 460 #endif /* EVENT_DATA_AS_OBJECTS */
432 #define XPROCESS_DATA_PROCESS(d) (XPROCESS_DATA (d)->process) 461
433 #define XSET_PROCESS_DATA_PROCESS(d, p) (XPROCESS_DATA (d)->process = (p)) 462 #define EVENT_PROCESS_PROCESS(e) EVENT_FOO_BAR (e, PROCESS, process, process)
434 #endif /* USE_KKCC */ 463 #define XEVENT_PROCESS_PROCESS(e) EVENT_PROCESS_PROCESS (XEVENT (e))
435 464 #define SET_EVENT_PROCESS_PROCESS(e, val) \
436 #ifdef USE_KKCC 465 SET_EVENT_FOO_BAR (e, PROCESS, process, process, val)
466 #define XSET_EVENT_PROCESS_PROCESS(e, val) \
467 SET_EVENT_PROCESS_PROCESS (XEVENT (e), val)
468
437 struct Lisp_Timeout_Data 469 struct Lisp_Timeout_Data
438 #else /* not USE_KKCC */
439 struct timeout_data
440 #endif /* not USE_KKCC */
441 { 470 {
442 /* 471 /*
443 interval_id The ID returned when the associated call to 472 interval_id The ID returned when the associated call to
444 add_timeout_cb() was made 473 add_timeout_cb() was made
445 ------ the rest of the fields are filled in by XEmacs ----- 474 ------ the rest of the fields are filled in by XEmacs -----
450 themselves) 479 themselves)
451 function An elisp function to call when this timeout is 480 function An elisp function to call when this timeout is
452 processed. 481 processed.
453 object The object passed to that function. 482 object The object passed to that function.
454 */ 483 */
455 #ifdef USE_KKCC 484 #ifdef EVENT_DATA_AS_OBJECTS
456 struct lrecord_header lheader; 485 struct lrecord_header lheader;
457 #endif /* USE_KKCC */ 486 #endif /* EVENT_DATA_AS_OBJECTS */
458 int interval_id; 487 int interval_id;
459 int id_number; 488 int id_number;
460 Lisp_Object function; 489 Lisp_Object function;
461 Lisp_Object object; 490 Lisp_Object object;
462 }; 491 };
463 #ifdef USE_KKCC
464 typedef struct Lisp_Timeout_Data Lisp_Timeout_Data; 492 typedef struct Lisp_Timeout_Data Lisp_Timeout_Data;
465 493
494 #ifdef EVENT_DATA_AS_OBJECTS
466 DECLARE_LRECORD (timeout_data, Lisp_Timeout_Data); 495 DECLARE_LRECORD (timeout_data, Lisp_Timeout_Data);
467 #define XTIMEOUT_DATA(x) XRECORD (x, timeout_data, Lisp_Timeout_Data) 496 #define XTIMEOUT_DATA(x) XRECORD (x, timeout_data, Lisp_Timeout_Data)
468 #define wrap_timeout_data(p) wrap_record(p, timeout_data) 497 #define wrap_timeout_data(p) wrap_record(p, timeout_data)
469 #define TIMEOUT_DATAP(x) RECORDP (x, timeout_data) 498 #define TIMEOUT_DATAP(x) RECORDP (x, timeout_data)
470 #define CHECK_TIMEOUT_DATA(x) CHECK_RECORD (x, timeout_data) 499 #define CHECK_TIMEOUT_DATA(x) CHECK_RECORD (x, timeout_data)
471 #define CONCHECK_TIMEOUT_DATA(x) CONCHECK_RECORD (x, timeout_data) 500 #define CONCHECK_TIMEOUT_DATA(x) CONCHECK_RECORD (x, timeout_data)
472 501 #endif /* EVENT_DATA_AS_OBJECTS */
473 #define XTIMEOUT_DATA_INTERVAL_ID(d) XTIMEOUT_DATA (d)->interval_id 502
474 #define XTIMEOUT_DATA_ID_NUMBER(d) XTIMEOUT_DATA (d)->id_number 503 #define EVENT_TIMEOUT_INTERVAL_ID(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id)
475 #define XTIMEOUT_DATA_FUNCTION(d) XTIMEOUT_DATA (d)->function 504 #define XEVENT_TIMEOUT_INTERVAL_ID(e) EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e))
476 #define XTIMEOUT_DATA_OBJECT(d) XTIMEOUT_DATA (d)->object 505 #define SET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \
477 506 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, interval_id, val)
478 #define XSET_TIMEOUT_DATA_INTERVAL_ID(d, i) XTIMEOUT_DATA (d)->interval_id = (i) 507 #define XSET_EVENT_TIMEOUT_INTERVAL_ID(e, val) \
479 #define XSET_TIMEOUT_DATA_ID_NUMBER(d, n) XTIMEOUT_DATA (d)->id_number = (n) 508 SET_EVENT_TIMEOUT_INTERVAL_ID (XEVENT (e), val)
480 #define XSET_TIMEOUT_DATA_FUNCTION(d, f) XTIMEOUT_DATA (d)->function = f 509
481 #define XSET_TIMEOUT_DATA_OBJECT(d, o) XTIMEOUT_DATA (d)->object = o 510 #define EVENT_TIMEOUT_ID_NUMBER(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number)
482 #endif /* USE_KKCC */ 511 #define XEVENT_TIMEOUT_ID_NUMBER(e) EVENT_TIMEOUT_ID_NUMBER (XEVENT (e))
483 512 #define SET_EVENT_TIMEOUT_ID_NUMBER(e, val) \
484 #ifdef USE_KKCC 513 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, id_number, val)
514 #define XSET_EVENT_TIMEOUT_ID_NUMBER(e, val) \
515 SET_EVENT_TIMEOUT_ID_NUMBER (XEVENT (e), val)
516
517 #define EVENT_TIMEOUT_FUNCTION(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, function)
518 #define XEVENT_TIMEOUT_FUNCTION(e) EVENT_TIMEOUT_FUNCTION (XEVENT (e))
519 #define SET_EVENT_TIMEOUT_FUNCTION(e, val) \
520 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, function, val)
521 #define XSET_EVENT_TIMEOUT_FUNCTION(e, val) \
522 SET_EVENT_TIMEOUT_FUNCTION (XEVENT (e), val)
523
524 #define EVENT_TIMEOUT_OBJECT(e) EVENT_FOO_BAR (e, TIMEOUT, timeout, object)
525 #define XEVENT_TIMEOUT_OBJECT(e) EVENT_TIMEOUT_OBJECT (XEVENT (e))
526 #define SET_EVENT_TIMEOUT_OBJECT(e, val) \
527 SET_EVENT_FOO_BAR (e, TIMEOUT, timeout, object, val)
528 #define XSET_EVENT_TIMEOUT_OBJECT(e, val) \
529 SET_EVENT_TIMEOUT_OBJECT (XEVENT (e), val)
530
485 struct Lisp_Eval_Data 531 struct Lisp_Eval_Data
486 #else /* not USE_KKCC */
487 struct eval_data
488 #endif /* not USE_KKCC */
489 { 532 {
490 /* This kind of event is used internally; sometimes the window system 533 /* This kind of event is used internally; sometimes the window system
491 interface would like to inform XEmacs of some user action (such as 534 interface would like to inform XEmacs of some user action (such as
492 focusing on another frame) but needs that to happen synchronously 535 focusing on another frame) but needs that to happen synchronously
493 with the other user input, like keypresses. This is useful when 536 with the other user input, like keypresses. This is useful when
495 event stream. 538 event stream.
496 539
497 function An elisp function to call with this event object. 540 function An elisp function to call with this event object.
498 object Argument of function. 541 object Argument of function.
499 */ 542 */
500 #ifdef USE_KKCC 543 #ifdef EVENT_DATA_AS_OBJECTS
501 struct lrecord_header lheader; 544 struct lrecord_header lheader;
502 #endif /* USE_KKCC */ 545 #endif /* EVENT_DATA_AS_OBJECTS */
503 Lisp_Object function; 546 Lisp_Object function;
504 Lisp_Object object; 547 Lisp_Object object;
505 }; 548 };
506 #ifdef USE_KKCC
507 typedef struct Lisp_Eval_Data Lisp_Eval_Data; 549 typedef struct Lisp_Eval_Data Lisp_Eval_Data;
508 550
551 #ifdef EVENT_DATA_AS_OBJECTS
509 DECLARE_LRECORD (eval_data, Lisp_Eval_Data); 552 DECLARE_LRECORD (eval_data, Lisp_Eval_Data);
510 #define XEVAL_DATA(x) XRECORD (x, eval_data, Lisp_Eval_Data) 553 #define XEVAL_DATA(x) XRECORD (x, eval_data, Lisp_Eval_Data)
511 #define wrap_eval_data(p) wrap_record(p, eval_data) 554 #define wrap_eval_data(p) wrap_record(p, eval_data)
512 #define EVAL_DATAP(x) RECORDP (x, eval_data) 555 #define EVAL_DATAP(x) RECORDP (x, eval_data)
513 #define CHECK_EVAL_DATA(x) CHECK_RECORD (x, eval_data) 556 #define CHECK_EVAL_DATA(x) CHECK_RECORD (x, eval_data)
514 #define CONCHECK_EVAL_DATA(x) CONCHECK_RECORD (x, eval_data) 557 #define CONCHECK_EVAL_DATA(x) CONCHECK_RECORD (x, eval_data)
515 558 #endif /* EVENT_DATA_AS_OBJECTS */
516 #define XEVAL_DATA_FUNCTION(d) (XEVAL_DATA (d)->function) 559
517 #define XEVAL_DATA_OBJECT(d) (XEVAL_DATA (d)->object) 560 #define EVENT_EVAL_FUNCTION(e) EVENT_FOO_BAR (e, EVAL, eval, function)
518 561 #define XEVENT_EVAL_FUNCTION(e) EVENT_EVAL_FUNCTION (XEVENT (e))
519 #define XSET_EVAL_DATA_FUNCTION(d, f) (XEVAL_DATA (d)->function = f) 562 #define SET_EVENT_EVAL_FUNCTION(e, val) \
520 #define XSET_EVAL_DATA_OBJECT(d, o) (XEVAL_DATA (d)->object = o) 563 SET_EVENT_FOO_BAR (e, EVAL, eval, function, val)
521 #endif /* USE_KKCC */ 564 #define XSET_EVENT_EVAL_FUNCTION(e, val) \
522 565 SET_EVENT_EVAL_FUNCTION (XEVENT (e), val)
523 #ifdef USE_KKCC 566
567 #define EVENT_EVAL_OBJECT(e) EVENT_FOO_BAR (e, EVAL, eval, object)
568 #define XEVENT_EVAL_OBJECT(e) EVENT_EVAL_OBJECT (XEVENT (e))
569 #define SET_EVENT_EVAL_OBJECT(e, val) \
570 SET_EVENT_FOO_BAR (e, EVAL, eval, object, val)
571 #define XSET_EVENT_EVAL_OBJECT(e, val) \
572 SET_EVENT_EVAL_OBJECT (XEVENT (e), val)
573
524 struct Lisp_Misc_User_Data 574 struct Lisp_Misc_User_Data
525 #else /* not USE_KKCC */
526 struct misc_user_data
527 #endif /* not USE_KKCC */
528 { 575 {
529 /* #### The misc-user type is serious junk. It should be separated 576 /* #### The misc-user type is serious junk. It should be separated
530 out into different events. There's no reason to create 577 out into different events. There's no reason to create
531 sub-subtypes of events. 578 sub-subtypes of events.
532 579
544 are not the same as keypresses or misc_user_events. 591 are not the same as keypresses or misc_user_events.
545 The button, modifiers, x, and y parts are only used 592 The button, modifiers, x, and y parts are only used
546 by the XEmacs Drag'n'Drop system. Don't depend on their 593 by the XEmacs Drag'n'Drop system. Don't depend on their
547 values for other types of misc_user_events. 594 values for other types of misc_user_events.
548 */ 595 */
549 #ifdef USE_KKCC 596 #ifdef EVENT_DATA_AS_OBJECTS
550 struct lrecord_header lheader; 597 struct lrecord_header lheader;
551 #endif /* USE_KKCC */ 598 #endif /* EVENT_DATA_AS_OBJECTS */
552 Lisp_Object function; 599 Lisp_Object function;
553 Lisp_Object object; 600 Lisp_Object object;
554 int button; 601 int button;
555 int modifiers; 602 int modifiers;
556 int x, y; 603 int x, y;
557 }; 604 };
558 #ifdef USE_KKCC
559 typedef struct Lisp_Misc_User_Data Lisp_Misc_User_Data; 605 typedef struct Lisp_Misc_User_Data Lisp_Misc_User_Data;
560 606
607 #ifdef EVENT_DATA_AS_OBJECTS
561 DECLARE_LRECORD (misc_user_data, Lisp_Misc_User_Data); 608 DECLARE_LRECORD (misc_user_data, Lisp_Misc_User_Data);
562 #define XMISC_USER_DATA(x) XRECORD (x, misc_user_data, Lisp_Misc_User_Data) 609 #define XMISC_USER_DATA(x) XRECORD (x, misc_user_data, Lisp_Misc_User_Data)
563 #define wrap_misc_user_data(p) wrap_record(p, misc_user_data) 610 #define wrap_misc_user_data(p) wrap_record(p, misc_user_data)
564 #define MISC_USER_DATAP(x) RECORDP (x, misc_user_data) 611 #define MISC_USER_DATAP(x) RECORDP (x, misc_user_data)
565 #define CHECK_MISC_USER_DATA(x) CHECK_RECORD (x, misc_user_data) 612 #define CHECK_MISC_USER_DATA(x) CHECK_RECORD (x, misc_user_data)
566 #define CONCHECK_MISC_USER_DATA(x) CONCHECK_RECORD (x, misc_user_data) 613 #define CONCHECK_MISC_USER_DATA(x) CONCHECK_RECORD (x, misc_user_data)
567 614 #endif /* EVENT_DATA_AS_OBJECTS */
568 #define XMISC_USER_DATA_FUNCTION(d) (XMISC_USER_DATA (d)->function) 615
569 #define XMISC_USER_DATA_OBJECT(d) (XMISC_USER_DATA (d)->object) 616 #define EVENT_MISC_USER_FUNCTION(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, function)
570 #define XMISC_USER_DATA_BUTTON(d) (XMISC_USER_DATA (d)->button) 617 #define XEVENT_MISC_USER_FUNCTION(e) EVENT_MISC_USER_FUNCTION (XEVENT (e))
571 #define XMISC_USER_DATA_MODIFIERS(d) (XMISC_USER_DATA (d)->modifiers) 618 #define SET_EVENT_MISC_USER_FUNCTION(e, val) \
572 #define XMISC_USER_DATA_X(d) (XMISC_USER_DATA (d)->x) 619 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, function, val)
573 #define XMISC_USER_DATA_Y(d) (XMISC_USER_DATA (d)->y) 620 #define XSET_EVENT_MISC_USER_FUNCTION(e, val) \
574 621 SET_EVENT_MISC_USER_FUNCTION (XEVENT (e), val)
575 #define XSET_MISC_USER_DATA_FUNCTION(d, f) (XMISC_USER_DATA (d)->function = (f)) 622
576 #define XSET_MISC_USER_DATA_OBJECT(d, o) (XMISC_USER_DATA (d)->object = (o)) 623 #define EVENT_MISC_USER_OBJECT(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, object)
577 #define XSET_MISC_USER_DATA_BUTTON(d, b) (XMISC_USER_DATA (d)->button = (b)) 624 #define XEVENT_MISC_USER_OBJECT(e) EVENT_MISC_USER_OBJECT (XEVENT (e))
578 #define XSET_MISC_USER_DATA_MODIFIERS(d, m) (XMISC_USER_DATA (d)->modifiers = (m)) 625 #define SET_EVENT_MISC_USER_OBJECT(e, val) \
579 #define XSET_MISC_USER_DATA_X(d, new_x) (XMISC_USER_DATA (d)->x = (new_x)) 626 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, object, val)
580 #define XSET_MISC_USER_DATA_Y(d, new_y) (XMISC_USER_DATA (d)->y = (new_y)) 627 #define XSET_EVENT_MISC_USER_OBJECT(e, val) \
581 #endif /* USE_KKCC */ 628 SET_EVENT_MISC_USER_OBJECT (XEVENT (e), val)
582 629
583 #ifdef USE_KKCC 630 #define EVENT_MISC_USER_BUTTON(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, button)
584 typedef void (*lisp_obj_arg_fun) (Lisp_Object); 631 #define XEVENT_MISC_USER_BUTTON(e) EVENT_MISC_USER_BUTTON (XEVENT (e))
585 632 #define SET_EVENT_MISC_USER_BUTTON(e, val) \
633 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, button, val)
634 #define XSET_EVENT_MISC_USER_BUTTON(e, val) \
635 SET_EVENT_MISC_USER_BUTTON (XEVENT (e), val)
636
637 #define EVENT_MISC_USER_MODIFIERS(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers)
638 #define XEVENT_MISC_USER_MODIFIERS(e) EVENT_MISC_USER_MODIFIERS (XEVENT (e))
639 #define SET_EVENT_MISC_USER_MODIFIERS(e, val) \
640 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, modifiers, val)
641 #define XSET_EVENT_MISC_USER_MODIFIERS(e, val) \
642 SET_EVENT_MISC_USER_MODIFIERS (XEVENT (e), val)
643
644 #define EVENT_MISC_USER_X(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, x)
645 #define XEVENT_MISC_USER_X(e) EVENT_MISC_USER_X (XEVENT (e))
646 #define SET_EVENT_MISC_USER_X(e, val) \
647 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, x, val)
648 #define XSET_EVENT_MISC_USER_X(e, val) \
649 SET_EVENT_MISC_USER_X (XEVENT (e), val)
650
651 #define EVENT_MISC_USER_Y(e) EVENT_FOO_BAR (e, MISC_USER, misc_user, y)
652 #define XEVENT_MISC_USER_Y(e) EVENT_MISC_USER_Y (XEVENT (e))
653 #define SET_EVENT_MISC_USER_Y(e, val) \
654 SET_EVENT_FOO_BAR (e, MISC_USER, misc_user, y, val)
655 #define XSET_EVENT_MISC_USER_Y(e, val) \
656 SET_EVENT_MISC_USER_Y (XEVENT (e), val)
586 657
587 struct Lisp_Magic_Eval_Data 658 struct Lisp_Magic_Eval_Data
588 #else /* not USE_KKCC */
589 struct magic_eval_data
590 #endif /* not USE_KKCC */
591 { 659 {
592 /* This is like an eval event but its contents are not 660 /* This is like an eval event but its contents are not
593 Lisp-accessible. This allows for "internal eval events" that call 661 Lisp-accessible. This allows for "internal eval events" that call
594 non-Lisp-accessible functions. Externally, a magic_eval_event just 662 non-Lisp-accessible functions. Externally, a magic_eval_event just
595 appears as a magic_event; the Lisp programmer need not know 663 appears as a magic_event; the Lisp programmer need not know
600 functions. For a normal eval event, this field 668 functions. For a normal eval event, this field
601 will always be 0. 669 will always be 0.
602 object Argument of function. 670 object Argument of function.
603 671
604 */ 672 */
605 #ifdef USE_KKCC 673 #ifdef EVENT_DATA_AS_OBJECTS
606 struct lrecord_header lheader; 674 struct lrecord_header lheader;
607 #endif /* USE_KKCC */ 675 #endif /* EVENT_DATA_AS_OBJECTS */
608 void (*internal_function) (Lisp_Object); 676 void (*internal_function) (Lisp_Object);
609 Lisp_Object object; 677 Lisp_Object object;
610 }; 678 };
611 #ifdef USE_KKCC
612 typedef struct Lisp_Magic_Eval_Data Lisp_Magic_Eval_Data; 679 typedef struct Lisp_Magic_Eval_Data Lisp_Magic_Eval_Data;
613 680
681 #ifdef EVENT_DATA_AS_OBJECTS
614 DECLARE_LRECORD (magic_eval_data, Lisp_Magic_Eval_Data); 682 DECLARE_LRECORD (magic_eval_data, Lisp_Magic_Eval_Data);
615 #define XMAGIC_EVAL_DATA(x) XRECORD (x, magic_eval_data, Lisp_Magic_Eval_Data) 683 #define XMAGIC_EVAL_DATA(x) XRECORD (x, magic_eval_data, Lisp_Magic_Eval_Data)
616 #define wrap_magic_eval_data(p) wrap_record(p, magic_eval_data) 684 #define wrap_magic_eval_data(p) wrap_record(p, magic_eval_data)
617 #define MAGIC_EVAL_DATAP(x) RECORDP (x, magic_eval_data) 685 #define MAGIC_EVAL_DATAP(x) RECORDP (x, magic_eval_data)
618 #define CHECK_MAGIC_EVAL_DATA(x) CHECK_RECORD (x, magic_eval_data) 686 #define CHECK_MAGIC_EVAL_DATA(x) CHECK_RECORD (x, magic_eval_data)
619 #define CONCHECK_MAGIC_EVAL_DATA(x) CONCHECK_RECORD (x, magic_eval_data) 687 #define CONCHECK_MAGIC_EVAL_DATA(x) CONCHECK_RECORD (x, magic_eval_data)
620 688 #endif /* EVENT_DATA_AS_OBJECTS */
621 #define XMAGIC_EVAL_DATA_INTERNAL_FUNCTION(d) \ 689
622 XMAGIC_EVAL_DATA (d)->internal_function 690 #define EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function)
623 #define XMAGIC_EVAL_DATA_INTERNAL_FUNOBJ(d) (XMAGIC_EVAL_DATA (d)->internal_function) 691 #define XEVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e) EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e))
624 #define XMAGIC_EVAL_DATA_OBJECT(d) (XMAGIC_EVAL_DATA (d)->object) 692 #define SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \
625 693 SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, internal_function, val)
626 #define XSET_MAGIC_EVAL_DATA_INTERNAL_FUNCTION(d, f) \ 694 #define XSET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION(e, val) \
627 (XMAGIC_EVAL_DATA (d)->internal_function = f) 695 SET_EVENT_MAGIC_EVAL_INTERNAL_FUNCTION (XEVENT (e), val)
628 #define XSET_MAGIC_EVAL_DATA_INTERNAL_FUNOBJ(d, f) (XMAGIC_EVAL_DATA (d)->internal_function = (f)) 696
629 #define XSET_MAGIC_EVAL_DATA_OBJECT(d, o) (XMAGIC_EVAL_DATA (d)->object = (o)) 697 #define EVENT_MAGIC_EVAL_OBJECT(e) EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object)
630 #endif /* USE_KKCC */ 698 #define XEVENT_MAGIC_EVAL_OBJECT(e) EVENT_MAGIC_EVAL_OBJECT (XEVENT (e))
699 #define SET_EVENT_MAGIC_EVAL_OBJECT(e, val) \
700 SET_EVENT_FOO_BAR (e, MAGIC_EVAL, magic_eval, object, val)
701 #define XSET_EVENT_MAGIC_EVAL_OBJECT(e, val) \
702 SET_EVENT_MAGIC_EVAL_OBJECT (XEVENT (e), val)
631 703
632 #if defined (HAVE_X_WINDOWS) && defined(emacs) 704 #if defined (HAVE_X_WINDOWS) && defined(emacs)
633 # include <X11/Xlib.h> 705 # include <X11/Xlib.h>
634 #endif 706 #endif
635 707
636 #ifdef HAVE_GTK 708 #ifdef HAVE_GTK
637 #include <gdk/gdk.h> 709 #include <gdk/gdk.h>
638 #endif 710 #endif
639 711
640 712
641 #ifdef USE_KKCC
642 struct Lisp_Magic_Data 713 struct Lisp_Magic_Data
643 { 714 {
715 /* No user-serviceable parts within. This is for things like
716 KeymapNotify and ExposeRegion events and so on that XEmacs itself
717 doesn't care about, but which it must do something with for proper
718 interaction with the window system.
719
720 Magic_events are handled somewhat asynchronously, just like
721 subprocess filters. However, occasionally a magic_event needs to
722 be handled synchronously; in that case, the asynchronous handling
723 of the magic_event will push an eval_event back onto the queue,
724 which will be handled synchronously later. This is one of the
725 reasons why eval_events exist; I'm not entirely happy with this
726 aspect of this event model.
727 */
728
729 #ifdef EVENT_DATA_AS_OBJECTS
644 struct lrecord_header lheader; 730 struct lrecord_header lheader;
731 #endif /* EVENT_DATA_AS_OBJECTS */
645 732
646 union { 733 union {
647 #ifdef HAVE_GTK 734 #ifdef HAVE_GTK
648 GdkEvent gdk_event; 735 GdkEvent gdk_event;
649 #endif 736 #endif
656 } underlying; 743 } underlying;
657 }; 744 };
658 745
659 typedef struct Lisp_Magic_Data Lisp_Magic_Data; 746 typedef struct Lisp_Magic_Data Lisp_Magic_Data;
660 747
748 #ifdef EVENT_DATA_AS_OBJECTS
661 DECLARE_LRECORD (magic_data, Lisp_Magic_Data); 749 DECLARE_LRECORD (magic_data, Lisp_Magic_Data);
662 #define XMAGIC_DATA(x) XRECORD (x, magic_data, Lisp_Magic_Data) 750 #define XMAGIC_DATA(x) XRECORD (x, magic_data, Lisp_Magic_Data)
663 #define wrap_magic_data(p) wrap_record(p, magic_data) 751 #define wrap_magic_data(p) wrap_record(p, magic_data)
664 #define MAGIC_DATAP(x) RECORDP (x, magic_data) 752 #define MAGIC_DATAP(x) RECORDP (x, magic_data)
665 #define CHECK_MAGIC_DATA(x) CHECK_RECORD (x, magic_data) 753 #define CHECK_MAGIC_DATA(x) CHECK_RECORD (x, magic_data)
666 #define CONCHECK_MAGIC_DATA(x) CONCHECK_RECORD (x, magic_data) 754 #define CONCHECK_MAGIC_DATA(x) CONCHECK_RECORD (x, magic_data)
667 755 #endif /* EVENT_DATA_AS_OBJECTS */
668 #define XMAGIC_DATA_UNDERLYING(d) (XMAGIC_DATA (d)->underlying) 756
669 #define XSET_MAGIC_DATA_UNDERLYING(d, u) (XMAGIC_DATA (d)->underlying = (u)) 757 #define EVENT_MAGIC_UNDERLYING(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying)
758 #define XEVENT_MAGIC_UNDERLYING(e) EVENT_MAGIC_UNDERLYING (XEVENT (e))
759 #define SET_EVENT_MAGIC_UNDERLYING(e, val) \
760 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying, val)
761 #define XSET_EVENT_MAGIC_UNDERLYING(e, val) \
762 SET_EVENT_MAGIC_UNDERLYING (XEVENT (e), val)
670 763
671 #ifdef HAVE_GTK 764 #ifdef HAVE_GTK
672 #define XMAGIC_DATA_GDK_EVENT(d) (XMAGIC_DATA (d)->underlying.gdk_event) 765 #define EVENT_MAGIC_GDK_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event)
673 #define XSET_MAGIC_DATA_GDK_EVENT(d, e) (XMAGIC_DATA (d)->underlying.gdk_event = (e)) 766 #define XEVENT_MAGIC_GDK_EVENT(e) EVENT_MAGIC_GDK_EVENT (XEVENT (e))
674 #endif /*HAVE_GTK*/ 767 #define SET_EVENT_MAGIC_GDK_EVENT(e, val) \
768 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.gdk_event, val)
769 #define XSET_EVENT_MAGIC_GDK_EVENT(e, val) \
770 SET_EVENT_MAGIC_GDK_EVENT (XEVENT (e), val)
771 #endif
675 772
676 #ifdef HAVE_X_WINDOWS 773 #ifdef HAVE_X_WINDOWS
677 #define XMAGIC_DATA_X_EVENT(d) (XMAGIC_DATA (d)->underlying.x_event) 774 #define EVENT_MAGIC_X_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event)
678 #define XSET_MAGIC_DATA_X_EVENT(d, e) (XMAGIC_DATA (d)->underlying.x_event = (e)) 775 #define XEVENT_MAGIC_X_EVENT(e) EVENT_MAGIC_X_EVENT (XEVENT (e))
776 #define SET_EVENT_MAGIC_X_EVENT(e, val) \
777 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.x_event, val)
778 #define XSET_EVENT_MAGIC_X_EVENT(e, val) \
779 SET_EVENT_MAGIC_X_EVENT (XEVENT (e), val)
679 #endif 780 #endif
680 781
681 #ifdef HAVE_MS_WINDOWS 782 #ifdef HAVE_MS_WINDOWS
682 #define XMAGIC_DATA_MSWINDOWS_EVENT(d) (XMAGIC_DATA (d)->underlying.mswindows_event) 783 #define EVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event)
683 #define XSET_MAGIC_DATA_MSWINDOWS_EVENT(d, e) (XMAGIC_DATA (d)->underlying.mswindows_event = (e)) 784 #define XEVENT_MAGIC_MSWINDOWS_EVENT(e) EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e))
785 #define SET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \
786 SET_EVENT_FOO_BAR (e, MAGIC, magic, underlying.mswindows_event, val)
787 #define XSET_EVENT_MAGIC_MSWINDOWS_EVENT(e, val) \
788 SET_EVENT_MAGIC_MSWINDOWS_EVENT (XEVENT (e), val)
684 #endif 789 #endif
685
686 #else /* not USE_KKCC */
687 union magic_data
688 {
689 /* No user-serviceable parts within. This is for things like
690 KeymapNotify and ExposeRegion events and so on that XEmacs itself
691 doesn't care about, but which it must do something with for proper
692 interaction with the window system.
693
694 Magic_events are handled somewhat asynchronously, just like
695 subprocess filters. However, occasionally a magic_event needs to
696 be handled synchronously; in that case, the asynchronous handling
697 of the magic_event will push an eval_event back onto the queue,
698 which will be handled synchronously later. This is one of the
699 reasons why eval_events exist; I'm not entirely happy with this
700 aspect of this event model.
701 */
702
703 #ifdef HAVE_GTK
704 GdkEvent underlying_gdk_event;
705 #endif
706 #ifdef HAVE_X_WINDOWS
707 XEvent underlying_x_event;
708 #endif
709 #ifdef HAVE_MS_WINDOWS
710 int underlying_mswindows_event;
711 #endif
712 };
713 #endif /* not USE_KKCC */
714
715 790
716 struct Lisp_Timeout 791 struct Lisp_Timeout
717 { 792 {
718 struct lcrecord_header header; 793 struct lcrecord_header header;
719 int id; /* Id we use to identify the timeout over its lifetime */ 794 int id; /* Id we use to identify the timeout over its lifetime */
782 started. Currently they are raw server timestamps. (The X 857 started. Currently they are raw server timestamps. (The X
783 protocol doesn't provide any easy way of translating between 858 protocol doesn't provide any easy way of translating between
784 server time and real process time; yuck.) */ 859 server time and real process time; yuck.) */
785 unsigned int timestamp; 860 unsigned int timestamp;
786 861
787 #ifdef USE_KKCC 862 #ifdef EVENT_DATA_AS_OBJECTS
788 Lisp_Object event_data; 863 Lisp_Object event_data;
789 #else /* not USE_KKCC */ 864 #else /* not EVENT_DATA_AS_OBJECTS */
790 union 865 union
791 { 866 {
792 struct key_data key; 867 Lisp_Key_Data key;
793 struct button_data button; 868 Lisp_Button_Data button;
794 struct motion_data motion; 869 Lisp_Motion_Data motion;
795 struct process_data process; 870 Lisp_Process_Data process;
796 struct timeout_data timeout; 871 Lisp_Timeout_Data timeout;
797 struct eval_data eval; /* misc_user_event no longer uses this */ 872 Lisp_Eval_Data eval; /* misc_user_event no longer uses this */
798 struct misc_user_data misc; /* because it needs position information */ 873 Lisp_Misc_User_Data misc_user;/* because it needs position information */
799 union magic_data magic; 874 Lisp_Magic_Data magic;
800 struct magic_eval_data magic_eval; 875 Lisp_Magic_Eval_Data magic_eval;
801 } event; 876 } event;
802 #endif /* not USE_KKCC */ 877 #endif /* not EVENT_DATA_AS_OBJECTS */
803 }; 878 };
804 879
805 DECLARE_LRECORD (event, Lisp_Event); 880 DECLARE_LRECORD (event, Lisp_Event);
806 #define XEVENT(x) XRECORD (x, event, Lisp_Event) 881 #define XEVENT(x) XRECORD (x, event, Lisp_Event)
807 #define wrap_event(p) wrap_record (p, event) 882 #define wrap_event(p) wrap_record (p, event)
810 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event) 885 #define CONCHECK_EVENT(x) CONCHECK_RECORD (x, event)
811 886
812 DECLARE_LRECORD (command_builder, struct command_builder); 887 DECLARE_LRECORD (command_builder, struct command_builder);
813 888
814 #define EVENT_CHANNEL(a) ((a)->channel) 889 #define EVENT_CHANNEL(a) ((a)->channel)
890 #define XEVENT_CHANNEL(ev) (XEVENT (ev)->channel)
815 #define EVENT_TYPE(a) ((a)->event_type) 891 #define EVENT_TYPE(a) ((a)->event_type)
816 #define XEVENT_TYPE(a) (XEVENT (a)->event_type) 892 #define XEVENT_TYPE(a) (XEVENT (a)->event_type)
817 #define EVENT_NEXT(a) ((a)->next) 893 #define EVENT_NEXT(a) ((a)->next)
818 #define XEVENT_NEXT(e) (XEVENT (e)->next) 894 #define XEVENT_NEXT(e) (XEVENT (e)->next)
819 895 #define EVENT_TIMESTAMP(ev) ((ev)->timestamp)
820 #ifdef USE_KKCC 896 #define XEVENT_TIMESTAMP(ev) EVENT_TIMESTAMP (XEVENT (ev))
897
898 #ifdef EVENT_DATA_AS_OBJECTS
821 #define XEVENT_DATA(ev) (XEVENT (ev)->event_data) 899 #define XEVENT_DATA(ev) (XEVENT (ev)->event_data)
822 #define EVENT_DATA(ev) ((ev)->event_data) 900 #define EVENT_DATA(ev) ((ev)->event_data)
823 #define XEVENT_CHANNEL(ev) (XEVENT (ev)->channel) 901 #define SET_EVENT_DATA(ev, d) \
824 #define EVENT_TIMESTAMP(ev) \ 902 do { \
825 ((ev)->timestamp) 903 Lisp_Event *mac_event = (ev); \
826 #define XEVENT_TIMESTAMP(ev) EVENT_TIMESTAMP (XEVENT (ev)) 904 mac_event->event_data = (d); \
827 905 } while (0)
828 #define SET_EVENT_TIMESTAMP_ZERO(ev) \ 906 #define XSET_EVENT_DATA(ev, d) SET_EVENT_DATA (XEVENT (ev), d)
829 ((ev)->timestamp = 0) 907 #endif /* EVENT_DATA_AS_OBJECTS */
830 #define SET_EVENT_TIMESTAMP(ev, t) \ 908
831 (ev)->timestamp = (t) 909 #define SET_EVENT_TIMESTAMP_ZERO(ev) ((ev)->timestamp = 0)
910 #define SET_EVENT_TIMESTAMP(ev, t) ((ev)->timestamp = (t))
832 #define XSET_EVENT_TIMESTAMP(ev, t) SET_EVENT_TIMESTAMP (XEVENT (ev), t) 911 #define XSET_EVENT_TIMESTAMP(ev, t) SET_EVENT_TIMESTAMP (XEVENT (ev), t)
833
834 912
835 #define SET_EVENT_CHANNEL(ev, c) \ 913 #define SET_EVENT_CHANNEL(ev, c) \
836 do { \ 914 do { \
837 Lisp_Event *mac_event = (ev); \ 915 Lisp_Event *mac_event = (ev); \
838 mac_event->channel = (c); \ 916 mac_event->channel = (c); \
839 } while (0) 917 } while (0)
840 #define XSET_EVENT_CHANNEL(ev, c) SET_EVENT_CHANNEL (XEVENT (ev), c) 918 #define XSET_EVENT_CHANNEL(ev, c) SET_EVENT_CHANNEL (XEVENT (ev), c)
841 919
842 #define SET_EVENT_DATA(ev, d) \ 920 DECLARE_INLINE_HEADER (
843 do { \ 921 void
844 Lisp_Event *mac_event = (ev); \ 922 set_event_type (struct Lisp_Event *event, emacs_event_type t)
845 mac_event->event_data = (d); \ 923 )
846 } while (0) 924 {
847 #define XSET_EVENT_DATA(ev, d) SET_EVENT_DATA (XEVENT (ev), d) 925 #ifdef EVENT_DATA_AS_OBJECTS
848 926 switch (EVENT_TYPE (event))
849 INLINE_HEADER void set_event_type(struct Lisp_Event *event, emacs_event_type t); 927 {
850 INLINE_HEADER void 928 case key_press_event:
851 set_event_type(struct Lisp_Event *event, emacs_event_type t) 929 free_key_data (event->event_data);
852 { 930 break;
931 case button_press_event:
932 case button_release_event:
933 free_button_data (event->event_data);
934 break;
935 case pointer_motion_event:
936 free_motion_data (event->event_data);
937 break;
938 case process_event:
939 free_process_data (event->event_data);
940 break;
941 case timeout_event:
942 free_timeout_data (event->event_data);
943 break;
944 case magic_event:
945 free_magic_data (event->event_data);
946 break;
947 case magic_eval_event:
948 free_magic_eval_data (event->event_data);
949 break;
950 case eval_event:
951 free_eval_data (event->event_data);
952 break;
953 case misc_user_event:
954 free_misc_user_data (event->event_data);
955 break;
956 default:
957 break;
958 }
959 #endif /* EVENT_DATA_AS_OBJECTS */
960
853 event->event_type = t; 961 event->event_type = t;
854 962
855 switch (t) { 963 #ifdef EVENT_DATA_AS_OBJECTS
856 case key_press_event: 964 switch (t)
857 event->event_data = make_key_data (); 965 {
858 break; 966 case key_press_event:
859 case button_press_event: 967 event->event_data = make_key_data ();
860 case button_release_event: 968 break;
861 event->event_data = make_button_data (); 969 case button_press_event:
862 break; 970 case button_release_event:
863 case pointer_motion_event: 971 event->event_data = make_button_data ();
864 event->event_data = make_motion_data (); 972 break;
865 break; 973 case pointer_motion_event:
866 case process_event: 974 event->event_data = make_motion_data ();
867 event->event_data = make_process_data (); 975 break;
868 break; 976 case process_event:
869 case timeout_event: 977 event->event_data = make_process_data ();
870 event->event_data = make_timeout_data (); 978 break;
871 break; 979 case timeout_event:
872 case magic_event: 980 event->event_data = make_timeout_data ();
873 event->event_data = make_magic_data (); 981 break;
874 break; 982 case magic_event:
875 case magic_eval_event: 983 event->event_data = make_magic_data ();
876 event->event_data = make_magic_eval_data (); 984 break;
877 break; 985 case magic_eval_event:
878 case eval_event: 986 event->event_data = make_magic_eval_data ();
879 event->event_data = make_eval_data (); 987 break;
880 break; 988 case eval_event:
881 case misc_user_event: 989 event->event_data = make_eval_data ();
882 event->event_data = make_misc_user_data (); 990 break;
883 break; 991 case misc_user_event:
884 default: 992 event->event_data = make_misc_user_data ();
885 break; 993 break;
886 } 994 default:
995 event->event_data = Qnil;
996 break;
997 }
998 #endif /* EVENT_DATA_AS_OBJECTS */
887 } 999 }
1000
1001 #define SET_EVENT_NEXT(ev, n) do { (ev)->next = (n); } while (0)
1002 #define XSET_EVENT_NEXT(ev, n) SET_EVENT_NEXT (XEVENT (ev), n)
1003
888 #define XSET_EVENT_TYPE(ev, t) set_event_type (XEVENT (ev), t) 1004 #define XSET_EVENT_TYPE(ev, t) set_event_type (XEVENT (ev), t)
889 #define SET_EVENT_TYPE(ev, t) set_event_type (ev, t) 1005 #define SET_EVENT_TYPE(ev, t) set_event_type (ev, t)
890
891
892 #define SET_EVENT_NEXT(ev, n) \
893 do { \
894 Lisp_Event *mac_event = (ev); \
895 mac_event->next = (n); \
896 } while (0)
897 #define XSET_EVENT_NEXT(ev, n) SET_EVENT_NEXT (XEVENT (ev), n)
898
899 #else /* NOT USE_KKCC */
900 #define XSET_EVENT_NEXT(e, n) do { (XEVENT (e)->next = (n)); } while (0)
901 #endif
902 1006
903 #define EVENT_CHAIN_LOOP(event, chain) \ 1007 #define EVENT_CHAIN_LOOP(event, chain) \
904 for (event = chain; !NILP (event); event = XEVENT_NEXT (event)) 1008 for (event = chain; !NILP (event); event = XEVENT_NEXT (event))
905 1009
906 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event) 1010 #define EVENT_LIVE_P(a) (EVENT_TYPE (a) != dead_event)
954 1058
955 /* Maybe this should be trickier */ 1059 /* Maybe this should be trickier */
956 #define KEYSYM(x) (intern (x)) 1060 #define KEYSYM(x) (intern (x))
957 1061
958 /* from events.c */ 1062 /* from events.c */
959 #ifdef USE_KKCC
960 void format_event_object (Eistring *buf, Lisp_Object event, int brief); 1063 void format_event_object (Eistring *buf, Lisp_Object event, int brief);
961 #else /* not USE_KKCC */
962 void format_event_object (Eistring *buf, Lisp_Event *event, int brief);
963 #endif /* not USE_KKCC */
964 #ifdef USE_KKCC
965 //void format_event_data_object (Eistring *buf, Lisp_Object data, int brief); 1064 //void format_event_data_object (Eistring *buf, Lisp_Object data, int brief);
966 void copy_event_data (Lisp_Object dest, Lisp_Object src);
967 #endif /* USE_KKCC */
968 void character_to_event (Ichar c, Lisp_Event *event, 1065 void character_to_event (Ichar c, Lisp_Event *event,
969 struct console *con, 1066 struct console *con,
970 int use_console_meta_flag, 1067 int use_console_meta_flag,
971 int do_backspace_mapping); 1068 int do_backspace_mapping);
972 void zero_event (Lisp_Event *e); 1069 void zero_event (Lisp_Event *e);
1070
1071 #define MECR_DEALLOCATE_EVENT 1
1072
973 void deallocate_event_chain (Lisp_Object event); 1073 void deallocate_event_chain (Lisp_Object event);
974 Lisp_Object event_chain_tail (Lisp_Object event); 1074 Lisp_Object event_chain_tail (Lisp_Object event);
975 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail); 1075 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
976 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail); 1076 Lisp_Object dequeue_event (Lisp_Object *head, Lisp_Object *tail);
977 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head, 1077 void enqueue_event_chain (Lisp_Object event_chain, Lisp_Object *head,
978 Lisp_Object *tail); 1078 Lisp_Object *tail);
1079 int map_event_chain_remove (int (*fn) (Lisp_Object ev, void *user_data),
1080 Lisp_Object *head, Lisp_Object *tail,
1081 void *user_data, int flags);
979 int event_chain_count (Lisp_Object event_chain); 1082 int event_chain_count (Lisp_Object event_chain);
980 Lisp_Object transfer_event_chain_pointer (Lisp_Object pointer,
981 Lisp_Object old_chain,
982 Lisp_Object new_chain);
983 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event);
984 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
985 Lisp_Object event_chain_find_previous (Lisp_Object event_chain, 1083 Lisp_Object event_chain_find_previous (Lisp_Object event_chain,
986 Lisp_Object event); 1084 Lisp_Object event);
987 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n); 1085 Lisp_Object event_chain_nth (Lisp_Object event_chain, int n);
988 Lisp_Object copy_event_chain (Lisp_Object event_chain); 1086 Lisp_Object copy_event_chain (Lisp_Object event_chain);
1087 Lisp_Object transfer_event_chain_pointer (Lisp_Object pointer,
1088 Lisp_Object old_chain,
1089 Lisp_Object new_chain);
1090
1091
1092 void nth_of_key_sequence_as_event (Lisp_Object seq, int n, Lisp_Object event);
1093 Lisp_Object key_sequence_to_event_chain (Lisp_Object seq);
989 /* True if this is a non-internal event 1094 /* True if this is a non-internal event
990 (keyboard press, menu, scrollbar, mouse button) */ 1095 (keyboard press, menu, scrollbar, mouse button) */
991 int command_event_p (Lisp_Object event); 1096 int command_event_p (Lisp_Object event);
992 void define_self_inserting_symbol (Lisp_Object, Lisp_Object); 1097 void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
993 Ichar event_to_character (Lisp_Event *, int, int, int); 1098 Ichar event_to_character (Lisp_Object, int, int, int);
994 struct console *event_console_or_selected (Lisp_Object event); 1099 struct console *event_console_or_selected (Lisp_Object event);
1100 void upshift_event (Lisp_Object event);
1101 void downshift_event (Lisp_Object event);
1102 int event_upshifted_p (Lisp_Object event);
995 1103
996 /* from event-stream.c */ 1104 /* from event-stream.c */
1105 extern Lisp_Object dispatch_event_queue;
997 Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf); 1106 Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf);
1107 void enqueue_dispatch_event (Lisp_Object event);
1108 Lisp_Object dequeue_dispatch_event (void);
998 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object); 1109 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
999 void event_stream_handle_magic_event (Lisp_Event *event); 1110 void event_stream_handle_magic_event (Lisp_Event *event);
1000 void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream); 1111 void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream);
1001 int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2); 1112 int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2);
1002 Hashcode event_stream_hash_magic_event (Lisp_Event *e); 1113 Hashcode event_stream_hash_magic_event (Lisp_Event *e);
1071 /* Ceci n'est pas un pipe. */ 1182 /* Ceci n'est pas un pipe. */
1072 extern int signal_event_pipe[]; 1183 extern int signal_event_pipe[];
1073 1184
1074 void signal_fake_event (void); 1185 void signal_fake_event (void);
1075 void drain_signal_event_pipe (void); 1186 void drain_signal_event_pipe (void);
1187 void drain_tty_devices (void);
1076 1188
1077 extern int fake_event_occurred; 1189 extern int fake_event_occurred;
1078 1190
1079 int event_stream_unixoid_select_console (struct console *con); 1191 int event_stream_unixoid_select_console (struct console *con);
1080 int event_stream_unixoid_unselect_console (struct console *con); 1192 int event_stream_unixoid_unselect_console (struct console *con);
1081 void event_stream_unixoid_select_process (Lisp_Process *proc, int doin, 1193 void event_stream_unixoid_select_process (Lisp_Process *proc, int doin,
1082 int doerr, int *infd, int *errfd); 1194 int doerr, int *infd, int *errfd);
1083 void event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin, 1195 void event_stream_unixoid_unselect_process (Lisp_Process *proc, int doin,
1084 int doerr, int *infd, int *errfd); 1196 int doerr, int *infd, int *errfd);
1197 struct console *find_tty_or_stream_console_from_fd (int fd);
1085 int read_event_from_tty_or_stream_desc (Lisp_Event *event, 1198 int read_event_from_tty_or_stream_desc (Lisp_Event *event,
1086 struct console *con); 1199 struct console *con);
1087 void event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle, 1200 void event_stream_unixoid_create_io_streams (void* inhandle, void* outhandle,
1088 void *errhandle, 1201 void *errhandle,
1089 Lisp_Object* instream, 1202 Lisp_Object* instream,
1096 Lisp_Object outstream, 1209 Lisp_Object outstream,
1097 Lisp_Object errstream, 1210 Lisp_Object errstream,
1098 USID* in_usid, 1211 USID* in_usid,
1099 USID* err_usid); 1212 USID* err_usid);
1100 1213
1214 #endif /* HAVE_UNIXOID_EVENT_LOOP */
1215
1216 /* The following is not inside of HAVE_UNIXOID_EVENT_LOOP because of the
1217 possibility of combiling XEmacs with no-MSW, no-X, no-TTY --
1218 process-unix.c is still compiled. #### Should we still compile
1219 subprocesses with no event loops? */
1101 /* Beware: this evil macro evaluates its arg many times */ 1220 /* Beware: this evil macro evaluates its arg many times */
1102 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd))) 1221 #define FD_TO_USID(fd) ((fd)==0 ? (USID)999999 : ((fd)<0 ? USID_DONTHASH : (USID)(fd)))
1103
1104 #endif /* HAVE_UNIXOID_EVENT_LOOP */
1105 1222
1106 /* Define this if you want the tty event stream to be used when the 1223 /* Define this if you want the tty event stream to be used when the
1107 first console is tty, even if HAVE_X_WINDOWS is defined */ 1224 first console is tty, even if HAVE_X_WINDOWS is defined */
1108 /* #define DEBUG_TTY_EVENT_STREAM */ 1225 /* #define DEBUG_TTY_EVENT_STREAM */
1109 1226
1137 Any events in the chain after this one were read solely because 1254 Any events in the chain after this one were read solely because
1138 we're part of a possible function key. If we end up with 1255 we're part of a possible function key. If we end up with
1139 something that's not part of a possible function key, we have to 1256 something that's not part of a possible function key, we have to
1140 unread all of those events. */ 1257 unread all of those events. */
1141 Lisp_Object last_non_munged_event; 1258 Lisp_Object last_non_munged_event;
1142 /* One set of values for function-key-map, one for key-translation-map */ 1259 /* One value for function-key-map, one for key-translation-map:
1143 struct munging_key_translation 1260 First event that can begin a possible function key sequence
1144 { 1261 (to be translated according to function-key-map). Normally
1145 /* First event that can begin a possible function key sequence 1262 this is the first event in the chain. However, once we've
1146 (to be translated according to function-key-map). Normally 1263 translated a sequence through function-key-map, this will point
1147 this is the first event in the chain. However, once we've 1264 to the first event after the translated sequence: we don't ever
1148 translated a sequence through function-key-map, this will point 1265 want to translate any events twice through function-key-map, or
1149 to the first event after the translated sequence: we don't ever 1266 things could get really screwed up (e.g. if the user created a
1150 want to translate any events twice through function-key-map, or 1267 translation loop). If this is nil, then the next-read event is
1151 things could get really screwed up (e.g. if the user created a 1268 the first that can begin a function key sequence. */
1152 translation loop). If this is nil, then the next-read event is 1269 Lisp_Object first_mungeable_event[2];
1153 the first that can begin a function key sequence. */
1154 Lisp_Object first_mungeable_event;
1155 } munge_me[2];
1156 Ibyte *echo_buf; 1270 Ibyte *echo_buf;
1157 1271
1158 Bytecount echo_buf_length; /* size of echo_buf */ 1272 Bytecount echo_buf_length; /* size of echo_buf */
1159 Bytecount echo_buf_index; /* index into echo_buf 1273 Bytecount echo_buf_index; /* index into echo_buf
1160 * -1 before doing echoing for new cmd */ 1274 * -1 before doing echoing for new cmd */