Mercurial > hg > xemacs-beta
comparison src/event-Xt.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 | 184461bc8de4 |
children | fffe735e63ee |
comparison
equal
deleted
inserted
replaced
1203:5f2f8dcbfb3e | 1204:e22b0213b713 |
---|---|
293 #else | 293 #else |
294 return make_char (code + 0x80); | 294 return make_char (code + 0x80); |
295 #endif | 295 #endif |
296 } | 296 } |
297 | 297 |
298 /* #### The way that keysym correspondence to characters should work: | 298 /* See comment near character_to_event(). |
299 - a Lisp_Event should contain a keysym AND a character slot. | |
300 - keybindings are tried with the keysym. If no binding can be found, | |
301 and there is a corresponding character, call self-insert-command. | |
302 | |
303 #### Nuke x-iso8859-1.el. | |
304 #### Nuke the Qascii_character property. | |
305 #### Nuke Vcharacter_set_property. | |
306 */ | 299 */ |
307 static void | 300 static void |
308 maybe_define_x_key_as_self_inserting_character (KeySym keysym, Lisp_Object symbol) | 301 maybe_define_x_key_as_self_inserting_character (KeySym keysym, Lisp_Object symbol) |
309 { | 302 { |
310 Lisp_Object character = x_keysym_to_character (keysym); | 303 Lisp_Object character = x_keysym_to_character (keysym); |
1073 { | 1066 { |
1074 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1067 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1075 Lisp_Event *ev = XEVENT (emacs_event); | 1068 Lisp_Event *ev = XEVENT (emacs_event); |
1076 ev->channel = DEVICE_CONSOLE (d); | 1069 ev->channel = DEVICE_CONSOLE (d); |
1077 ev->timestamp = event->time; | 1070 ev->timestamp = event->time; |
1078 ev->event_type = key_press_event; | |
1079 #ifdef USE_KKCC | |
1080 XSET_EVENT_TYPE (emacs_event, key_press_event); | 1071 XSET_EVENT_TYPE (emacs_event, key_press_event); |
1081 XSET_KEY_DATA_MODIFIERS (XEVENT_DATA (emacs_event), 0); | 1072 XSET_EVENT_KEY_MODIFIERS (emacs_event, 0); |
1082 XSET_KEY_DATA_KEYSYM (XEVENT_DATA (emacs_event), make_char (ch)); | 1073 XSET_EVENT_KEY_KEYSYM (emacs_event, make_char (ch)); |
1083 #else | 1074 enqueue_dispatch_event (emacs_event); |
1084 ev->event.key.modifiers = 0; | |
1085 ev->event.key.keysym = make_char (ch); | |
1086 #endif | |
1087 enqueue_Xt_dispatch_event (emacs_event); | |
1088 } | 1075 } |
1089 Lstream_close (istr); | 1076 Lstream_close (istr); |
1090 UNGCPRO; | 1077 UNGCPRO; |
1091 Lstream_delete (istr); | 1078 Lstream_delete (istr); |
1092 Lstream_delete (XLSTREAM (fb_instream)); | 1079 Lstream_delete (XLSTREAM (fb_instream)); |
1217 { | 1204 { |
1218 Lisp_Object keysym; | 1205 Lisp_Object keysym; |
1219 XKeyEvent *ev = &x_event->xkey; | 1206 XKeyEvent *ev = &x_event->xkey; |
1220 /* This used to compute the frame from the given X window and | 1207 /* This used to compute the frame from the given X window and |
1221 store it here, but we really don't care about the frame. */ | 1208 store it here, but we really don't care about the frame. */ |
1222 #ifdef USE_KKCC | |
1223 SET_EVENT_CHANNEL (emacs_event, DEVICE_CONSOLE (d)); | 1209 SET_EVENT_CHANNEL (emacs_event, DEVICE_CONSOLE (d)); |
1224 #else /* not USE_KKCC */ | |
1225 emacs_event->channel = DEVICE_CONSOLE (d); | |
1226 #endif /* not USE_KKCC */ | |
1227 keysym = x_to_emacs_keysym (&x_event->xkey, 0); | 1210 keysym = x_to_emacs_keysym (&x_event->xkey, 0); |
1228 | 1211 |
1229 /* If the emacs keysym is nil, then that means that the X | 1212 /* If the emacs keysym is nil, then that means that the X |
1230 keysym was either a Modifier or NoSymbol, which | 1213 keysym was either a Modifier or NoSymbol, which |
1231 probably means that we're in the midst of reading a | 1214 probably means that we're in the midst of reading a |
1265 KeySym bot = XLookupKeysym (ev, Mode_switch_p ? 2 : 0); | 1248 KeySym bot = XLookupKeysym (ev, Mode_switch_p ? 2 : 0); |
1266 KeySym top = XLookupKeysym (ev, Mode_switch_p ? 3 : 1); | 1249 KeySym top = XLookupKeysym (ev, Mode_switch_p ? 3 : 1); |
1267 if (top && bot && top != bot) | 1250 if (top && bot && top != bot) |
1268 modifiers &= ~XEMACS_MOD_SHIFT; | 1251 modifiers &= ~XEMACS_MOD_SHIFT; |
1269 } | 1252 } |
1270 #ifdef USE_KKCC | |
1271 set_event_type (emacs_event, key_press_event); | 1253 set_event_type (emacs_event, key_press_event); |
1272 SET_EVENT_TIMESTAMP (emacs_event, ev->time); | 1254 SET_EVENT_TIMESTAMP (emacs_event, ev->time); |
1273 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (emacs_event), modifiers); | 1255 SET_EVENT_KEY_MODIFIERS (emacs_event, modifiers); |
1274 XSET_KEY_DATA_KEYSYM (EVENT_DATA (emacs_event), keysym); | 1256 SET_EVENT_KEY_KEYSYM (emacs_event, keysym); |
1275 #else /* not USE_KKCC */ | |
1276 emacs_event->event_type = key_press_event; | |
1277 emacs_event->timestamp = ev->time; | |
1278 emacs_event->event.key.modifiers = modifiers; | |
1279 emacs_event->event.key.keysym = keysym; | |
1280 #endif /* not USE_KKCC */ | |
1281 } | 1257 } |
1282 else /* Mouse press/release event */ | 1258 else /* Mouse press/release event */ |
1283 { | 1259 { |
1284 XButtonEvent *ev = &x_event->xbutton; | 1260 XButtonEvent *ev = &x_event->xbutton; |
1285 struct frame *frame = x_window_to_frame (d, ev->window); | 1261 struct frame *frame = x_window_to_frame (d, ev->window); |
1286 | 1262 |
1287 if (! frame) | 1263 if (! frame) |
1288 return 0; /* not for us */ | 1264 return 0; /* not for us */ |
1289 #ifdef USE_KKCC | |
1290 set_event_type (emacs_event, (x_event->type == ButtonPress) ? | 1265 set_event_type (emacs_event, (x_event->type == ButtonPress) ? |
1291 button_press_event : button_release_event); | 1266 button_press_event : button_release_event); |
1292 SET_EVENT_CHANNEL (emacs_event, wrap_frame(frame)); | 1267 SET_EVENT_CHANNEL (emacs_event, wrap_frame (frame)); |
1293 | 1268 |
1294 XSET_BUTTON_DATA_MODIFIERS (EVENT_DATA (emacs_event), modifiers); | 1269 SET_EVENT_BUTTON_MODIFIERS (emacs_event, modifiers); |
1295 SET_EVENT_TIMESTAMP (emacs_event, ev->time); | 1270 SET_EVENT_TIMESTAMP (emacs_event, ev->time); |
1296 XSET_BUTTON_DATA_BUTTON (EVENT_DATA (emacs_event), ev->button); | 1271 SET_EVENT_BUTTON_BUTTON (emacs_event, ev->button); |
1297 XSET_BUTTON_DATA_X (EVENT_DATA (emacs_event), ev->x); | 1272 SET_EVENT_BUTTON_X (emacs_event, ev->x); |
1298 XSET_BUTTON_DATA_Y (EVENT_DATA (emacs_event), ev->y); | 1273 SET_EVENT_BUTTON_Y (emacs_event, ev->y); |
1299 #else /* not USE_KKCC */ | |
1300 emacs_event->channel = wrap_frame (frame); | |
1301 emacs_event->event_type = (x_event->type == ButtonPress) ? | |
1302 button_press_event : button_release_event; | |
1303 | |
1304 emacs_event->event.button.modifiers = modifiers; | |
1305 emacs_event->timestamp = ev->time; | |
1306 emacs_event->event.button.button = ev->button; | |
1307 emacs_event->event.button.x = ev->x; | |
1308 emacs_event->event.button.y = ev->y; | |
1309 #endif /* not USE_KKCC */ | |
1310 /* because we don't seem to get a FocusIn event for button clicks | 1274 /* because we don't seem to get a FocusIn event for button clicks |
1311 when a widget-glyph is selected we will assume that we want the | 1275 when a widget-glyph is selected we will assume that we want the |
1312 focus if a button gets pressed. */ | 1276 focus if a button gets pressed. */ |
1313 if (x_event->type == ButtonPress) | 1277 if (x_event->type == ButtonPress) |
1314 handle_focus_event_1 (frame, 1); | 1278 handle_focus_event_1 (frame, 1); |
1341 &event2.x, &event2.y, | 1305 &event2.x, &event2.y, |
1342 &event2.state)) | 1306 &event2.state)) |
1343 ev = &event2; /* only one structure copy */ | 1307 ev = &event2; /* only one structure copy */ |
1344 | 1308 |
1345 DEVICE_X_MOUSE_TIMESTAMP (d) = ev->time; | 1309 DEVICE_X_MOUSE_TIMESTAMP (d) = ev->time; |
1346 #ifdef USE_KKCC | 1310 SET_EVENT_CHANNEL (emacs_event, wrap_frame (frame)); |
1347 SET_EVENT_CHANNEL (emacs_event, wrap_frame(frame)); | |
1348 set_event_type (emacs_event, pointer_motion_event); | 1311 set_event_type (emacs_event, pointer_motion_event); |
1349 SET_EVENT_TIMESTAMP (emacs_event, ev->time); | 1312 SET_EVENT_TIMESTAMP (emacs_event, ev->time); |
1350 XSET_MOTION_DATA_X (EVENT_DATA (emacs_event), ev->x); | 1313 SET_EVENT_MOTION_X (emacs_event, ev->x); |
1351 XSET_MOTION_DATA_Y (EVENT_DATA (emacs_event), ev->y); | 1314 SET_EVENT_MOTION_Y (emacs_event, ev->y); |
1352 #else /* not USE_KKCC */ | |
1353 emacs_event->channel = wrap_frame (frame); | |
1354 emacs_event->event_type = pointer_motion_event; | |
1355 emacs_event->timestamp = ev->time; | |
1356 emacs_event->event.motion.x = ev->x; | |
1357 emacs_event->event.motion.y = ev->y; | |
1358 #endif /* not USE_KKCC */ | |
1359 if (ev->state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; | 1315 if (ev->state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; |
1360 if (ev->state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; | 1316 if (ev->state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; |
1361 if (ev->state & xd->MetaMask) modifiers |= XEMACS_MOD_META; | 1317 if (ev->state & xd->MetaMask) modifiers |= XEMACS_MOD_META; |
1362 if (ev->state & xd->SuperMask) modifiers |= XEMACS_MOD_SUPER; | 1318 if (ev->state & xd->SuperMask) modifiers |= XEMACS_MOD_SUPER; |
1363 if (ev->state & xd->HyperMask) modifiers |= XEMACS_MOD_HYPER; | 1319 if (ev->state & xd->HyperMask) modifiers |= XEMACS_MOD_HYPER; |
1367 if (ev->state & Button3Mask) modifiers |= XEMACS_MOD_BUTTON3; | 1323 if (ev->state & Button3Mask) modifiers |= XEMACS_MOD_BUTTON3; |
1368 if (ev->state & Button4Mask) modifiers |= XEMACS_MOD_BUTTON4; | 1324 if (ev->state & Button4Mask) modifiers |= XEMACS_MOD_BUTTON4; |
1369 if (ev->state & Button5Mask) modifiers |= XEMACS_MOD_BUTTON5; | 1325 if (ev->state & Button5Mask) modifiers |= XEMACS_MOD_BUTTON5; |
1370 /* Currently ignores Shift_Lock but probably shouldn't | 1326 /* Currently ignores Shift_Lock but probably shouldn't |
1371 (but it definitely should ignore Caps_Lock). */ | 1327 (but it definitely should ignore Caps_Lock). */ |
1372 #ifdef USE_KKCC | 1328 SET_EVENT_MOTION_MODIFIERS (emacs_event, modifiers); |
1373 XSET_MOTION_DATA_MODIFIERS (EVENT_DATA (emacs_event), modifiers); | |
1374 #else /* not USE_KKCC */ | |
1375 emacs_event->event.motion.modifiers = modifiers; | |
1376 #endif /* not USE_KKCC */ | |
1377 } | 1329 } |
1378 break; | 1330 break; |
1379 | 1331 |
1380 case ClientMessage: | 1332 case ClientMessage: |
1381 { | 1333 { |
1398 | 1350 |
1399 if (! frame) | 1351 if (! frame) |
1400 return 0; /* not for us */ | 1352 return 0; /* not for us */ |
1401 | 1353 |
1402 GCPRO4 (l_type, l_data, l_dndlist, l_item); | 1354 GCPRO4 (l_type, l_data, l_dndlist, l_item); |
1403 #ifdef USE_KKCC | |
1404 set_event_type (emacs_event, misc_user_event); | 1355 set_event_type (emacs_event, misc_user_event); |
1405 SET_EVENT_CHANNEL (emacs_event, wrap_frame(frame)); | 1356 SET_EVENT_CHANNEL (emacs_event, wrap_frame (frame)); |
1406 SET_EVENT_TIMESTAMP (emacs_event, DEVICE_X_LAST_SERVER_TIMESTAMP (d)); | 1357 SET_EVENT_TIMESTAMP (emacs_event, DEVICE_X_LAST_SERVER_TIMESTAMP (d)); |
1407 #else /* not USE_KKCC */ | 1358 state=DndDragButtons (x_event); |
1408 emacs_event->channel = wrap_frame (frame); | |
1409 emacs_event->event_type = misc_user_event; | |
1410 emacs_event->timestamp = DEVICE_X_LAST_SERVER_TIMESTAMP (d); | |
1411 #endif /* not USE_KKCC */ | |
1412 state=DndDragButtons(x_event); | |
1413 | 1359 |
1414 if (state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; | 1360 if (state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; |
1415 if (state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; | 1361 if (state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; |
1416 if (state & xd->MetaMask) modifiers |= XEMACS_MOD_META; | 1362 if (state & xd->MetaMask) modifiers |= XEMACS_MOD_META; |
1417 if (state & xd->SuperMask) modifiers |= XEMACS_MOD_SUPER; | 1363 if (state & xd->SuperMask) modifiers |= XEMACS_MOD_SUPER; |
1427 if (state & Button4Mask) button = Button4; | 1373 if (state & Button4Mask) button = Button4; |
1428 if (state & Button3Mask) button = Button3; | 1374 if (state & Button3Mask) button = Button3; |
1429 if (state & Button2Mask) button = Button2; | 1375 if (state & Button2Mask) button = Button2; |
1430 if (state & Button1Mask) button = Button1; | 1376 if (state & Button1Mask) button = Button1; |
1431 | 1377 |
1432 #ifdef USE_KKCC | 1378 SET_EVENT_MISC_USER_MODIFIERS (emacs_event, modifiers); |
1433 XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (emacs_event), modifiers); | 1379 SET_EVENT_MISC_USER_BUTTON (emacs_event, button); |
1434 XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (emacs_event), button); | 1380 |
1435 | 1381 DndDropCoordinates (FRAME_X_TEXT_WIDGET (frame), x_event, |
1436 DndDropCoordinates(FRAME_X_TEXT_WIDGET(frame), x_event, | 1382 &(EVENT_MISC_USER_X (emacs_event)), |
1437 &(XMISC_USER_DATA_X (EVENT_DATA (emacs_event))), | 1383 &(EVENT_MISC_USER_Y (emacs_event))); |
1438 &(XMISC_USER_DATA_Y (EVENT_DATA (emacs_event))) ); | 1384 DndGetData (x_event,&data,&size); |
1439 #else /* not USE_KKCC */ | 1385 |
1440 emacs_event->event.misc.modifiers = modifiers; | 1386 dtype=DndDataType (x_event); |
1441 emacs_event->event.misc.button = button; | |
1442 | |
1443 DndDropCoordinates(FRAME_X_TEXT_WIDGET(frame), x_event, | |
1444 &(emacs_event->event.misc.x), | |
1445 &(emacs_event->event.misc.y) ); | |
1446 #endif /* not USE_KKCC */ | |
1447 DndGetData(x_event,&data,&size); | |
1448 | |
1449 dtype=DndDataType(x_event); | |
1450 switch (dtype) | 1387 switch (dtype) |
1451 { | 1388 { |
1452 case DndFiles: /* null terminated strings, end null */ | 1389 case DndFiles: /* null terminated strings, end null */ |
1453 { | 1390 { |
1454 int len; | 1391 int len; |
1517 Qbinary) ) ); | 1454 Qbinary) ) ); |
1518 l_type = Qdragdrop_MIME; | 1455 l_type = Qdragdrop_MIME; |
1519 break; | 1456 break; |
1520 } | 1457 } |
1521 | 1458 |
1522 #ifdef USE_KKCC | 1459 SET_EVENT_MISC_USER_FUNCTION (emacs_event, Qdragdrop_drop_dispatch); |
1523 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (emacs_event), Qdragdrop_drop_dispatch); | 1460 SET_EVENT_MISC_USER_OBJECT (emacs_event, Fcons (l_type, l_dndlist)); |
1524 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (emacs_event), Fcons (l_type, l_dndlist)); | |
1525 #else /* not USE_KKCC */ | |
1526 emacs_event->event.misc.function = Qdragdrop_drop_dispatch; | |
1527 emacs_event->event.misc.object = Fcons (l_type, l_dndlist); | |
1528 #endif /* not USE_KKCC */ | |
1529 | 1461 |
1530 UNGCPRO; | 1462 UNGCPRO; |
1531 | 1463 |
1532 break; | 1464 break; |
1533 } | 1465 } |
1543 | 1475 |
1544 default: /* it's a magic event */ | 1476 default: /* it's a magic event */ |
1545 { | 1477 { |
1546 struct frame *frame; | 1478 struct frame *frame; |
1547 Window w; | 1479 Window w; |
1548 #ifdef USE_KKCC | |
1549 XEvent *x_event_copy; | 1480 XEvent *x_event_copy; |
1550 SET_EVENT_TYPE (emacs_event, magic_event); | 1481 SET_EVENT_TYPE (emacs_event, magic_event); |
1551 x_event_copy = &XMAGIC_DATA_X_EVENT (EVENT_DATA (emacs_event)); | 1482 x_event_copy = &EVENT_MAGIC_X_EVENT (emacs_event); |
1552 #else /* not USE_KKCC */ | |
1553 XEvent *x_event_copy = &emacs_event->event.magic.underlying_x_event; | |
1554 #endif /* not USE_KKCC */ | |
1555 | 1483 |
1556 #define FROB(event_member, window_member) \ | 1484 #define FROB(event_member, window_member) \ |
1557 x_event_copy->event_member = x_event->event_member; \ | 1485 x_event_copy->event_member = x_event->event_member; \ |
1558 w = x_event->event_member.window_member | 1486 w = x_event->event_member.window_member |
1559 | 1487 |
1584 frame = x_any_window_to_frame (d, w); | 1512 frame = x_any_window_to_frame (d, w); |
1585 | 1513 |
1586 if (!frame) | 1514 if (!frame) |
1587 return 0; | 1515 return 0; |
1588 | 1516 |
1589 #ifdef USE_KKCC | 1517 SET_EVENT_CHANNEL (emacs_event, wrap_frame (frame)); |
1590 SET_EVENT_TYPE (emacs_event, magic_event); | 1518 SET_EVENT_MAGIC_X_EVENT (emacs_event, *x_event_copy); |
1591 SET_EVENT_CHANNEL (emacs_event, wrap_frame(frame)); | |
1592 XSET_MAGIC_DATA_X_EVENT (EVENT_DATA(emacs_event), *x_event_copy); | |
1593 #else /* not USE_KKCC */ | |
1594 emacs_event->event_type = magic_event; | |
1595 emacs_event->channel = wrap_frame (frame); | |
1596 #endif /* not USE_KKCC */ | |
1597 break; | 1519 break; |
1598 } | 1520 } |
1599 } | 1521 } |
1600 return 1; | 1522 return 1; |
1601 } | 1523 } |
1691 { | 1613 { |
1692 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1614 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1693 Lisp_Event *ev = XEVENT (emacs_event); | 1615 Lisp_Event *ev = XEVENT (emacs_event); |
1694 XEvent *x_event; | 1616 XEvent *x_event; |
1695 | 1617 |
1696 ev->event_type = magic_event; | |
1697 | |
1698 #ifdef USE_KKCC | |
1699 XSET_EVENT_TYPE (emacs_event, magic_event); | 1618 XSET_EVENT_TYPE (emacs_event, magic_event); |
1700 x_event = &XMAGIC_DATA_X_EVENT (EVENT_DATA (ev)); | 1619 x_event = &EVENT_MAGIC_X_EVENT (ev); |
1701 #else /* not USE_KKCC */ | |
1702 x_event = &ev->event.magic.underlying_x_event; | |
1703 #endif /* not USE_KKCC */ | |
1704 | 1620 |
1705 x_event->type = in_p ? FocusIn : FocusOut; | 1621 x_event->type = in_p ? FocusIn : FocusOut; |
1706 x_event->xfocus.window = XtWindow (wants_it); | 1622 x_event->xfocus.window = XtWindow (wants_it); |
1707 | 1623 |
1708 #ifdef USE_KKCC | |
1709 SET_EVENT_CHANNEL (ev, frame); | 1624 SET_EVENT_CHANNEL (ev, frame); |
1710 #else /* not USE_KKCC */ | 1625 |
1711 ev->channel = frame; | 1626 enqueue_dispatch_event (emacs_event); |
1712 #endif /* not USE_KKCC */ | |
1713 | |
1714 enqueue_Xt_dispatch_event (emacs_event); | |
1715 } | 1627 } |
1716 | 1628 |
1717 /* The idea here is that when a widget glyph gets unmapped we don't | 1629 /* The idea here is that when a widget glyph gets unmapped we don't |
1718 want the focus to stay with it if it has focus - because it may | 1630 want the focus to stay with it if it has focus - because it may |
1719 well just get deleted next and then we have lost the focus until the | 1631 well just get deleted next and then we have lost the focus until the |
1946 emacs_Xt_next_event () - this is normal event processing, almost | 1858 emacs_Xt_next_event () - this is normal event processing, almost |
1947 any non-X event will take precedence and this means that we | 1859 any non-X event will take precedence and this means that we |
1948 cannot rely on it to do the right thing at the right time for | 1860 cannot rely on it to do the right thing at the right time for |
1949 widget display. | 1861 widget display. |
1950 | 1862 |
1951 drain_X_queue () - this happens when SIGIO gets tripped, | 1863 emacs_Xt_drain_queue () - this happens when SIGIO gets tripped, |
1952 processing the event queue allows C-g to be checked for. It gets | 1864 processing the event queue allows C-g to be checked for. It gets |
1953 called from emacs_Xt_event_pending_p (). | 1865 called from emacs_Xt_event_pending_p (). #### Update this comment. |
1954 | 1866 |
1955 In order to solve this I have tried introducing a list primitive - | 1867 In order to solve this I have tried introducing a list primitive - |
1956 dispatch-non-command-events - which forces processing of X events | 1868 dispatch-non-command-events - which forces processing of X events |
1957 related to display. Unfortunately this has a number of problems, | 1869 related to display. Unfortunately this has a number of problems, |
1958 one is that it is possible for event_stream_event_pending_p to | 1870 one is that it is possible for event_stream_event_pending_p to |
1988 emacs_Xt_format_magic_event (Lisp_Event *event, Lisp_Object pstream) | 1900 emacs_Xt_format_magic_event (Lisp_Event *event, Lisp_Object pstream) |
1989 { | 1901 { |
1990 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event)); | 1902 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event)); |
1991 if (CONSOLE_X_P (XCONSOLE (console))) | 1903 if (CONSOLE_X_P (XCONSOLE (console))) |
1992 write_c_string | 1904 write_c_string |
1993 #ifdef USE_KKCC | 1905 (pstream, x_event_name ((EVENT_MAGIC_X_EVENT (event)).type)); |
1994 (pstream, x_event_name ((XMAGIC_DATA_X_EVENT (EVENT_DATA(event))).type)); | |
1995 #else /* not USE_KKCC */ | |
1996 (pstream, x_event_name (event->event.magic.underlying_x_event.type)); | |
1997 #endif /* not USE_KKCC */ | |
1998 } | 1906 } |
1999 | 1907 |
2000 static int | 1908 static int |
2001 emacs_Xt_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) | 1909 emacs_Xt_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) |
2002 { | 1910 { |
2003 if (CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) && | 1911 if (CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) && |
2004 CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) | 1912 CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) |
2005 #ifdef USE_KKCC | 1913 return ((EVENT_MAGIC_X_EVENT (e1)).xany.serial == |
2006 return ((XMAGIC_DATA_X_EVENT (EVENT_DATA(e1))).xany.serial == | 1914 (EVENT_MAGIC_X_EVENT (e2)).xany.serial); |
2007 (XMAGIC_DATA_X_EVENT (EVENT_DATA(e2))).xany.serial); | |
2008 #else /* not USE_KKCC */ | |
2009 return (e1->event.magic.underlying_x_event.xany.serial == | |
2010 e2->event.magic.underlying_x_event.xany.serial); | |
2011 #endif /* not USE_KKCC */ | |
2012 if (CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) || | 1915 if (CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) || |
2013 CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) | 1916 CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) |
2014 return 0; | 1917 return 0; |
2015 return 1; | 1918 return 1; |
2016 } | 1919 } |
2018 static Hashcode | 1921 static Hashcode |
2019 emacs_Xt_hash_magic_event (Lisp_Event *e) | 1922 emacs_Xt_hash_magic_event (Lisp_Event *e) |
2020 { | 1923 { |
2021 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (e)); | 1924 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (e)); |
2022 if (CONSOLE_X_P (XCONSOLE (console))) | 1925 if (CONSOLE_X_P (XCONSOLE (console))) |
2023 #ifdef USE_KKCC | 1926 return (EVENT_MAGIC_X_EVENT (e)).xany.serial; |
2024 return (XMAGIC_DATA_X_EVENT (EVENT_DATA(e))).xany.serial; | |
2025 #else /* not USE_KKCC */ | |
2026 return e->event.magic.underlying_x_event.xany.serial; | |
2027 #endif /* not USE_KKCC */ | |
2028 return 0; | 1927 return 0; |
2029 } | 1928 } |
2030 | 1929 |
2031 static void | 1930 static void |
2032 emacs_Xt_handle_magic_event (Lisp_Event *emacs_event) | 1931 emacs_Xt_handle_magic_event (Lisp_Event *emacs_event) |
2033 { | 1932 { |
2034 /* This function can GC */ | 1933 /* This function can GC */ |
2035 #ifdef USE_KKCC | 1934 XEvent *event = &EVENT_MAGIC_X_EVENT (emacs_event); |
2036 XEvent *event = &XMAGIC_DATA_X_EVENT (EVENT_DATA(emacs_event)); | |
2037 #else /* not USE_KKCC */ | |
2038 XEvent *event = &emacs_event->event.magic.underlying_x_event; | |
2039 #endif /* not USE_KKCC */ | |
2040 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); | 1935 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); |
2041 | 1936 |
2042 if (!FRAME_LIVE_P (f) || DEVICE_X_BEING_DELETED (XDEVICE (FRAME_DEVICE (f)))) | 1937 if (!FRAME_LIVE_P (f) || DEVICE_X_BEING_DELETED (XDEVICE (FRAME_DEVICE (f)))) |
2043 return; | 1938 return; |
2044 | 1939 |
2284 { | 2179 { |
2285 struct Xt_timeout *timeout = completed_timeouts; | 2180 struct Xt_timeout *timeout = completed_timeouts; |
2286 assert (timeout); | 2181 assert (timeout); |
2287 completed_timeouts = completed_timeouts->next; | 2182 completed_timeouts = completed_timeouts->next; |
2288 /* timeout events have nil as channel */ | 2183 /* timeout events have nil as channel */ |
2289 #ifdef USE_KKCC | 2184 set_event_type (emacs_event, timeout_event); |
2290 set_event_type(emacs_event, timeout_event); | |
2291 SET_EVENT_TIMESTAMP_ZERO (emacs_event); /* #### wrong!! */ | 2185 SET_EVENT_TIMESTAMP_ZERO (emacs_event); /* #### wrong!! */ |
2292 XSET_TIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (emacs_event), timeout->id); | 2186 SET_EVENT_TIMEOUT_INTERVAL_ID (emacs_event, timeout->id); |
2293 XSET_TIMEOUT_DATA_FUNCTION (EVENT_DATA (emacs_event), Qnil); | 2187 SET_EVENT_TIMEOUT_FUNCTION (emacs_event, Qnil); |
2294 XSET_TIMEOUT_DATA_OBJECT (EVENT_DATA (emacs_event), Qnil); | 2188 SET_EVENT_TIMEOUT_OBJECT (emacs_event, Qnil); |
2295 #else /* not USE_KKCC */ | |
2296 emacs_event->event_type = timeout_event; | |
2297 emacs_event->timestamp = 0; /* #### wrong!! */ | |
2298 emacs_event->event.timeout.interval_id = timeout->id; | |
2299 emacs_event->event.timeout.function = Qnil; | |
2300 emacs_event->event.timeout.object = Qnil; | |
2301 #endif /* not USE_KKCC */ | |
2302 Blocktype_free (the_Xt_timeout_blocktype, timeout); | 2189 Blocktype_free (the_Xt_timeout_blocktype, timeout); |
2303 } | 2190 } |
2304 | 2191 |
2305 | 2192 |
2306 /************************************************************************/ | 2193 /************************************************************************/ |
2550 if (PROCESSP (process)) | 2437 if (PROCESSP (process)) |
2551 { | 2438 { |
2552 filedesc_with_input[i] = Qnil; | 2439 filedesc_with_input[i] = Qnil; |
2553 process_events_occurred--; | 2440 process_events_occurred--; |
2554 /* process events have nil as channel */ | 2441 /* process events have nil as channel */ |
2555 #ifdef USE_KKCC | |
2556 set_event_type (emacs_event, process_event); | 2442 set_event_type (emacs_event, process_event); |
2557 SET_EVENT_TIMESTAMP_ZERO (emacs_event); /* #### */ | 2443 SET_EVENT_TIMESTAMP_ZERO (emacs_event); /* #### */ |
2558 XSET_PROCESS_DATA_PROCESS (EVENT_DATA (emacs_event), process); | 2444 SET_EVENT_PROCESS_PROCESS (emacs_event, process); |
2559 #else /* not USE_KKCC */ | |
2560 emacs_event->event_type = process_event; | |
2561 emacs_event->timestamp = 0; /* #### */ | |
2562 emacs_event->event.process.process = process; | |
2563 #endif /* not USE_KKCC */ | |
2564 return; | 2445 return; |
2565 } | 2446 } |
2566 } | 2447 } |
2567 abort (); | 2448 abort (); |
2568 } | 2449 } |
2855 | 2736 |
2856 /************************************************************************/ | 2737 /************************************************************************/ |
2857 /* get the next event from Xt */ | 2738 /* get the next event from Xt */ |
2858 /************************************************************************/ | 2739 /************************************************************************/ |
2859 | 2740 |
2860 static Lisp_Object dispatch_event_queue, dispatch_event_queue_tail; | |
2861 | |
2862 void | |
2863 enqueue_Xt_dispatch_event (Lisp_Object event) | |
2864 { | |
2865 enqueue_event (event, &dispatch_event_queue, &dispatch_event_queue_tail); | |
2866 } | |
2867 | |
2868 static Lisp_Object | |
2869 dequeue_Xt_dispatch_event (void) | |
2870 { | |
2871 return dequeue_event (&dispatch_event_queue, &dispatch_event_queue_tail); | |
2872 } | |
2873 | |
2874 /* This business exists because menu events "happen" when | 2741 /* This business exists because menu events "happen" when |
2875 menubar_selection_callback() is called from somewhere deep | 2742 menubar_selection_callback() is called from somewhere deep |
2876 within XtAppProcessEvent in emacs_Xt_next_event(). The | 2743 within XtAppProcessEvent in emacs_Xt_next_event(). The |
2877 callback needs to terminate the modal loop in that function | 2744 callback needs to terminate the modal loop in that function |
2878 or else it will continue waiting until another event is | 2745 or else it will continue waiting until another event is |
2884 signal_special_Xt_user_event (Lisp_Object channel, Lisp_Object function, | 2751 signal_special_Xt_user_event (Lisp_Object channel, Lisp_Object function, |
2885 Lisp_Object object) | 2752 Lisp_Object object) |
2886 { | 2753 { |
2887 Lisp_Object event = Fmake_event (Qnil, Qnil); | 2754 Lisp_Object event = Fmake_event (Qnil, Qnil); |
2888 | 2755 |
2889 #ifdef USE_KKCC | |
2890 XSET_EVENT_TYPE (event, misc_user_event); | 2756 XSET_EVENT_TYPE (event, misc_user_event); |
2891 XSET_EVENT_CHANNEL (event, channel); | 2757 XSET_EVENT_CHANNEL (event, channel); |
2892 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), function); | 2758 XSET_EVENT_MISC_USER_FUNCTION (event, function); |
2893 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event), object); | 2759 XSET_EVENT_MISC_USER_OBJECT (event, object); |
2894 #else /* not USE_KKCC */ | 2760 enqueue_dispatch_event (event); |
2895 XEVENT (event)->event_type = misc_user_event; | |
2896 XEVENT (event)->channel = channel; | |
2897 XEVENT (event)->event.eval.function = function; | |
2898 XEVENT (event)->event.eval.object = object; | |
2899 #endif /* not USE_KKCC */ | |
2900 enqueue_Xt_dispatch_event (event); | |
2901 } | 2761 } |
2902 | 2762 |
2903 static void | 2763 static void |
2904 emacs_Xt_next_event (Lisp_Event *emacs_event) | 2764 emacs_Xt_next_event (Lisp_Event *emacs_event) |
2905 { | 2765 { |
2949 | 2809 |
2950 if (!NILP (dispatch_event_queue)) | 2810 if (!NILP (dispatch_event_queue)) |
2951 { | 2811 { |
2952 Lisp_Object event, event2; | 2812 Lisp_Object event, event2; |
2953 event2 = wrap_event (emacs_event); | 2813 event2 = wrap_event (emacs_event); |
2954 event = dequeue_Xt_dispatch_event (); | 2814 event = dequeue_dispatch_event (); |
2955 Fcopy_event (event, event2); | 2815 Fcopy_event (event, event2); |
2956 Fdeallocate_event (event); | 2816 Fdeallocate_event (event); |
2957 } | 2817 } |
2958 else if (tty_events_occurred) | 2818 else if (tty_events_occurred) |
2959 { | 2819 { |
2965 else if (fake_event_occurred) | 2825 else if (fake_event_occurred) |
2966 { | 2826 { |
2967 /* A dummy event, so that a cycle of the command loop will occur. */ | 2827 /* A dummy event, so that a cycle of the command loop will occur. */ |
2968 fake_event_occurred = 0; | 2828 fake_event_occurred = 0; |
2969 /* eval events have nil as channel */ | 2829 /* eval events have nil as channel */ |
2970 #ifdef USE_KKCC | |
2971 set_event_type (emacs_event, eval_event); | 2830 set_event_type (emacs_event, eval_event); |
2972 XSET_EVAL_DATA_FUNCTION (EVENT_DATA (emacs_event), Qidentity); | 2831 SET_EVENT_EVAL_FUNCTION (emacs_event, Qidentity); |
2973 XSET_EVAL_DATA_OBJECT (EVENT_DATA (emacs_event), Qnil); | 2832 SET_EVENT_EVAL_OBJECT (emacs_event, Qnil); |
2974 #else /* not USE_KKCC */ | |
2975 emacs_event->event_type = eval_event; | |
2976 emacs_event->event.eval.function = Qidentity; | |
2977 emacs_event->event.eval.object = Qnil; | |
2978 #endif /* not USE_KKCC */ | |
2979 } | 2833 } |
2980 else /* if (process_events_occurred) */ | 2834 else /* if (process_events_occurred) */ |
2981 Xt_process_to_emacs_event (emacs_event); | 2835 Xt_process_to_emacs_event (emacs_event); |
2982 | 2836 |
2983 /* No need to call XFilterEvent; Xt does it for us */ | 2837 /* No need to call XFilterEvent; Xt does it for us */ |
2994 #ifdef DEBUG_XEMACS | 2848 #ifdef DEBUG_XEMACS |
2995 if (debug_x_events > 0) | 2849 if (debug_x_events > 0) |
2996 describe_event (event, Qexternal_debugging_output); | 2850 describe_event (event, Qexternal_debugging_output); |
2997 #endif /* DEBUG_XEMACS */ | 2851 #endif /* DEBUG_XEMACS */ |
2998 if (x_event_to_emacs_event (event, XEVENT (emacs_event))) | 2852 if (x_event_to_emacs_event (event, XEVENT (emacs_event))) |
2999 enqueue_Xt_dispatch_event (emacs_event); | 2853 enqueue_dispatch_event (emacs_event); |
3000 else | 2854 else |
3001 Fdeallocate_event (emacs_event); | 2855 Fdeallocate_event (emacs_event); |
3002 } | 2856 } |
3003 | 2857 |
3004 | 2858 |
3005 /************************************************************************/ | 2859 /************************************************************************/ |
3006 /* input pending / C-g checking */ | 2860 /* input pending */ |
3007 /************************************************************************/ | 2861 /************************************************************************/ |
3008 | 2862 |
3009 static Bool | 2863 static void |
3010 quit_char_predicate (Display *display, XEvent *event, XPointer data) | 2864 emacs_Xt_drain_queue (void) |
3011 { | |
3012 struct device *d = get_device_from_display (display); | |
3013 struct x_device *xd = DEVICE_X_DATA (d); | |
3014 char c, quit_char; | |
3015 Bool *critical = (Bool *) data; | |
3016 Lisp_Object keysym; | |
3017 | |
3018 if (critical) | |
3019 *critical = False; | |
3020 if ((event->type != KeyPress) || | |
3021 (! x_any_window_to_frame (d, event->xany.window)) || | |
3022 (event->xkey.state | |
3023 & (xd->MetaMask | xd->HyperMask | xd->SuperMask | xd->AltMask))) | |
3024 return 0; | |
3025 | |
3026 /* This duplicates some code that exists elsewhere, but it's relatively | |
3027 fast and doesn't cons. */ | |
3028 keysym = x_to_emacs_keysym (&event->xkey, 1); | |
3029 if (NILP (keysym)) return 0; | |
3030 if (CHAR_OR_CHAR_INTP (keysym)) | |
3031 c = XCHAR_OR_CHAR_INT (keysym); | |
3032 /* Highly doubtful that these are the quit character, but... */ | |
3033 else if (EQ (keysym, QKbackspace)) c = '\b'; | |
3034 else if (EQ (keysym, QKtab)) c = '\t'; | |
3035 else if (EQ (keysym, QKlinefeed)) c = '\n'; | |
3036 else if (EQ (keysym, QKreturn)) c = '\r'; | |
3037 else if (EQ (keysym, QKescape)) c = 27; | |
3038 else if (EQ (keysym, QKspace)) c = ' '; | |
3039 else if (EQ (keysym, QKdelete)) c = 127; | |
3040 else return 0; | |
3041 | |
3042 if (event->xkey.state & xd->MetaMask) c |= 0x80; | |
3043 if ((event->xkey.state & ControlMask) && !(c >= 'A' && c <= 'Z')) | |
3044 c &= 0x1F; /* unshifted control characters */ | |
3045 quit_char = CONSOLE_QUIT_CHAR (XCONSOLE (DEVICE_CONSOLE (d))); | |
3046 if (c == quit_char) | |
3047 return True; | |
3048 /* If we've got Control-Shift-G instead of Control-G, that means | |
3049 we have a critical_quit. Caps_Lock is its own modifier, so it | |
3050 won't cause ^G to act differently than before. */ | |
3051 if (event->xkey.state & ControlMask) c &= 0x1F; | |
3052 if (c == quit_char) | |
3053 { | |
3054 if (critical) *critical = True; | |
3055 return True; | |
3056 } | |
3057 return False; | |
3058 } | |
3059 | |
3060 /* This scans the X input queue for a KeyPress event that matches the | |
3061 quit character, and sets Vquit_flag. This is called from the | |
3062 QUIT macro to determine whether we should quit. | |
3063 | |
3064 In a SIGIO world, this won't be called unless a SIGIO has happened | |
3065 since the last time we checked. | |
3066 | |
3067 In a non-SIGIO world, this is called from emacs_Xt_event_pending_p | |
3068 (which is called from input_pending_p). | |
3069 */ | |
3070 static void | |
3071 x_check_for_quit_char (Display *display) | |
3072 { | |
3073 XEvent event; | |
3074 int queued; | |
3075 Bool critical_quit = False; | |
3076 XEventsQueued (display, QueuedAfterReading); | |
3077 queued = XCheckIfEvent (display, &event, | |
3078 quit_char_predicate, | |
3079 (char *) &critical_quit); | |
3080 if (queued) | |
3081 { | |
3082 Vquit_flag = (critical_quit ? Qcritical : Qt); | |
3083 /* don't put the event back onto the queue. Those functions that | |
3084 wanted to read a ^G directly have arranged to do this. */ | |
3085 } | |
3086 } | |
3087 | |
3088 static void | |
3089 check_for_tty_quit_char (struct device *d) | |
3090 { | |
3091 SELECT_TYPE temp_mask; | |
3092 int infd = DEVICE_INFD (d); | |
3093 struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); | |
3094 Ichar quit_char = CONSOLE_QUIT_CHAR (con); | |
3095 | |
3096 FD_ZERO (&temp_mask); | |
3097 FD_SET (infd, &temp_mask); | |
3098 | |
3099 while (1) | |
3100 { | |
3101 Lisp_Object event; | |
3102 Ichar the_char; | |
3103 | |
3104 if (!poll_fds_for_input (temp_mask)) | |
3105 return; | |
3106 | |
3107 event = Fmake_event (Qnil, Qnil); | |
3108 if (!read_event_from_tty_or_stream_desc (XEVENT (event), con)) | |
3109 /* EOF, or something ... */ | |
3110 return; | |
3111 /* #### bogus. quit-char should be allowed to be any sort | |
3112 of event. */ | |
3113 the_char = event_to_character (XEVENT (event), 1, 0, 0); | |
3114 if (the_char >= 0 && the_char == quit_char) | |
3115 { | |
3116 Vquit_flag = Qt; | |
3117 /* do not queue the C-g. See above. */ | |
3118 return; | |
3119 } | |
3120 | |
3121 /* queue the read event to be read for real later. */ | |
3122 enqueue_Xt_dispatch_event (event); | |
3123 } | |
3124 } | |
3125 | |
3126 static void | |
3127 emacs_Xt_quit_p (void) | |
3128 { | 2865 { |
3129 Lisp_Object devcons, concons; | 2866 Lisp_Object devcons, concons; |
3130 CONSOLE_LOOP (concons) | 2867 CONSOLE_LOOP (concons) |
3131 { | 2868 { |
3132 struct console *con = XCONSOLE (XCAR (concons)); | 2869 struct console *con = XCONSOLE (XCAR (concons)); |
3134 continue; | 2871 continue; |
3135 | 2872 |
3136 CONSOLE_DEVICE_LOOP (devcons, con) | 2873 CONSOLE_DEVICE_LOOP (devcons, con) |
3137 { | 2874 { |
3138 struct device *d; | 2875 struct device *d; |
2876 Display *display; | |
3139 d = XDEVICE (XCAR (devcons)); | 2877 d = XDEVICE (XCAR (devcons)); |
3140 | |
3141 if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d)) | 2878 if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d)) |
3142 /* emacs may be exiting */ | 2879 { |
3143 x_check_for_quit_char (DEVICE_X_DISPLAY (d)); | 2880 display = DEVICE_X_DISPLAY (d); |
3144 else if (DEVICE_TTY_P (d)) | 2881 while (XEventsQueued (display, QueuedAfterReading)) |
3145 check_for_tty_quit_char (d); | 2882 XtAppProcessEvent (Xt_app_con, XtIMXEvent); |
2883 } | |
3146 } | 2884 } |
3147 } | 2885 } |
3148 } | |
3149 | |
3150 static void | |
3151 drain_X_queue (void) | |
3152 { | |
3153 Lisp_Object devcons, concons; | |
3154 CONSOLE_LOOP (concons) | |
3155 { | |
3156 struct console *con = XCONSOLE (XCAR (concons)); | |
3157 if (!con->input_enabled) | |
3158 continue; | |
3159 | |
3160 CONSOLE_DEVICE_LOOP (devcons, con) | |
3161 { | |
3162 struct device* d; | |
3163 Display* display; | |
3164 d = XDEVICE (XCAR (devcons)); | |
3165 if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d)) { | |
3166 display = DEVICE_X_DISPLAY (d); | |
3167 while (XEventsQueued (display, QueuedAfterReading)) | |
3168 XtAppProcessEvent (Xt_app_con, XtIMXEvent); | |
3169 } | |
3170 } | |
3171 } | |
3172 /* | 2886 /* |
3173 while (XtAppPending (Xt_app_con) & XtIMXEvent) | 2887 while (XtAppPending (Xt_app_con) & XtIMXEvent) |
3174 XtAppProcessEvent (Xt_app_con, XtIMXEvent); | 2888 XtAppProcessEvent (Xt_app_con, XtIMXEvent); |
3175 */ | 2889 */ |
2890 | |
2891 drain_tty_devices (); | |
3176 } | 2892 } |
3177 | 2893 |
3178 static int | 2894 static int |
3179 emacs_Xt_event_pending_p (int user_p) | 2895 emacs_Xt_event_pending_p (int user_p) |
3180 { | 2896 { |
3201 Its only advantage is that it may possibly make C-g response | 2917 Its only advantage is that it may possibly make C-g response |
3202 a bit faster. The C-g will be noticed within 0.25 second, anyway, | 2918 a bit faster. The C-g will be noticed within 0.25 second, anyway, |
3203 even without this. */ | 2919 even without this. */ |
3204 #ifndef SIGIO | 2920 #ifndef SIGIO |
3205 /* First check for C-g if necessary */ | 2921 /* First check for C-g if necessary */ |
3206 emacs_Xt_quit_p (); | 2922 event_stream_quit_p (); |
3207 #endif | 2923 #endif |
3208 #endif | 2924 #endif |
3209 | 2925 |
3210 /* This function used to simply check whether there were any X | 2926 /* This function used to simply check whether there were any X |
3211 events (or if user_p was 1, it iterated over all the pending | 2927 events (or if user_p was 1, it iterated over all the pending |
3286 | 3002 |
3287 /* We need to drain the entire queue now -- if we only | 3003 /* We need to drain the entire queue now -- if we only |
3288 drain part of it, we may later on end up with events | 3004 drain part of it, we may later on end up with events |
3289 actually pending but detect_input_pending() returning | 3005 actually pending but detect_input_pending() returning |
3290 false because there wasn't another SIGIO. */ | 3006 false because there wasn't another SIGIO. */ |
3291 drain_X_queue (); | 3007 emacs_Xt_drain_queue (); |
3292 | 3008 |
3293 EVENT_CHAIN_LOOP (event, dispatch_event_queue) | 3009 EVENT_CHAIN_LOOP (event, dispatch_event_queue) |
3294 if (!user_p || command_event_p (event)) | 3010 if (!user_p || command_event_p (event)) |
3295 return 1; | 3011 return 1; |
3296 } | 3012 } |
3013 | |
3014 return 0; | |
3015 } | |
3016 | |
3017 int | |
3018 check_if_pending_expose_event (struct device *dev) | |
3019 { | |
3020 Display *d = DEVICE_X_DISPLAY (dev); | |
3021 Lisp_Object event; | |
3022 | |
3023 emacs_Xt_drain_queue (); | |
3024 | |
3025 EVENT_CHAIN_LOOP (event, dispatch_event_queue) | |
3026 if (XEVENT_TYPE (event) == magic_event) | |
3027 { | |
3028 XEvent *xev = &XEVENT_MAGIC_X_EVENT (event); | |
3029 if (xev->type == Expose && | |
3030 xev->xexpose.display == d) | |
3031 return 1; | |
3032 } | |
3297 | 3033 |
3298 return 0; | 3034 return 0; |
3299 } | 3035 } |
3300 | 3036 |
3301 static int | 3037 static int |
3522 } | 3258 } |
3523 | 3259 |
3524 void | 3260 void |
3525 reinit_vars_of_event_Xt (void) | 3261 reinit_vars_of_event_Xt (void) |
3526 { | 3262 { |
3527 Xt_event_stream = xnew (struct event_stream); | 3263 Xt_event_stream = xnew_and_zero (struct event_stream); |
3528 Xt_event_stream->event_pending_p = emacs_Xt_event_pending_p; | 3264 Xt_event_stream->event_pending_p = emacs_Xt_event_pending_p; |
3529 Xt_event_stream->force_event_pending = emacs_Xt_force_event_pending; | 3265 Xt_event_stream->force_event_pending_cb= emacs_Xt_force_event_pending; |
3530 Xt_event_stream->next_event_cb = emacs_Xt_next_event; | 3266 Xt_event_stream->next_event_cb = emacs_Xt_next_event; |
3531 Xt_event_stream->handle_magic_event_cb = emacs_Xt_handle_magic_event; | 3267 Xt_event_stream->handle_magic_event_cb = emacs_Xt_handle_magic_event; |
3532 Xt_event_stream->format_magic_event_cb = emacs_Xt_format_magic_event; | 3268 Xt_event_stream->format_magic_event_cb = emacs_Xt_format_magic_event; |
3533 Xt_event_stream->compare_magic_event_cb= emacs_Xt_compare_magic_event; | 3269 Xt_event_stream->compare_magic_event_cb= emacs_Xt_compare_magic_event; |
3534 Xt_event_stream->hash_magic_event_cb = emacs_Xt_hash_magic_event; | 3270 Xt_event_stream->hash_magic_event_cb = emacs_Xt_hash_magic_event; |
3536 Xt_event_stream->remove_timeout_cb = emacs_Xt_remove_timeout; | 3272 Xt_event_stream->remove_timeout_cb = emacs_Xt_remove_timeout; |
3537 Xt_event_stream->select_console_cb = emacs_Xt_select_console; | 3273 Xt_event_stream->select_console_cb = emacs_Xt_select_console; |
3538 Xt_event_stream->unselect_console_cb = emacs_Xt_unselect_console; | 3274 Xt_event_stream->unselect_console_cb = emacs_Xt_unselect_console; |
3539 Xt_event_stream->select_process_cb = emacs_Xt_select_process; | 3275 Xt_event_stream->select_process_cb = emacs_Xt_select_process; |
3540 Xt_event_stream->unselect_process_cb = emacs_Xt_unselect_process; | 3276 Xt_event_stream->unselect_process_cb = emacs_Xt_unselect_process; |
3541 Xt_event_stream->quit_p_cb = emacs_Xt_quit_p; | 3277 Xt_event_stream->drain_queue_cb = emacs_Xt_drain_queue; |
3542 Xt_event_stream->create_io_streams_cb = emacs_Xt_create_io_streams; | 3278 Xt_event_stream->create_io_streams_cb = emacs_Xt_create_io_streams; |
3543 Xt_event_stream->delete_io_streams_cb = emacs_Xt_delete_io_streams; | 3279 Xt_event_stream->delete_io_streams_cb = emacs_Xt_delete_io_streams; |
3544 Xt_event_stream->current_event_timestamp_cb = | 3280 Xt_event_stream->current_event_timestamp_cb = |
3545 emacs_Xt_current_event_timestamp; | 3281 emacs_Xt_current_event_timestamp; |
3546 | 3282 |
3554 | 3290 |
3555 void | 3291 void |
3556 vars_of_event_Xt (void) | 3292 vars_of_event_Xt (void) |
3557 { | 3293 { |
3558 reinit_vars_of_event_Xt (); | 3294 reinit_vars_of_event_Xt (); |
3559 | |
3560 dispatch_event_queue = Qnil; | |
3561 staticpro (&dispatch_event_queue); | |
3562 dispatch_event_queue_tail = Qnil; | |
3563 dump_add_root_object (&dispatch_event_queue_tail); | |
3564 | 3295 |
3565 DEFVAR_BOOL ("x-allow-sendevents", &x_allow_sendevents /* | 3296 DEFVAR_BOOL ("x-allow-sendevents", &x_allow_sendevents /* |
3566 *Non-nil means to allow synthetic events. Nil means they are ignored. | 3297 *Non-nil means to allow synthetic events. Nil means they are ignored. |
3567 Beware: allowing emacs to process SendEvents opens a big security hole. | 3298 Beware: allowing emacs to process SendEvents opens a big security hole. |
3568 */ ); | 3299 */ ); |