Mercurial > hg > xemacs-beta
comparison src/event-msw.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 | f0af455e89d9 |
comparison
equal
deleted
inserted
replaced
1203:5f2f8dcbfb3e | 1204:e22b0213b713 |
---|---|
71 #include "process.h" | 71 #include "process.h" |
72 #include "redisplay.h" | 72 #include "redisplay.h" |
73 #include "sysdep.h" | 73 #include "sysdep.h" |
74 #include "window.h" | 74 #include "window.h" |
75 | 75 |
76 #include "console-stream-impl.h" | |
76 #include "console-msw-impl.h" | 77 #include "console-msw-impl.h" |
77 #include "objects-msw-impl.h" | 78 #include "objects-msw-impl.h" |
78 | 79 |
79 #ifdef HAVE_SCROLLBARS | 80 #ifdef HAVE_SCROLLBARS |
80 # include "scrollbar-msw.h" | 81 # include "scrollbar-msw.h" |
91 | 92 |
92 #include "sysfile.h" | 93 #include "sysfile.h" |
93 #include "sysproc.h" | 94 #include "sysproc.h" |
94 #include "systime.h" | 95 #include "systime.h" |
95 #include "syswait.h" | 96 #include "syswait.h" |
96 | |
97 #ifdef CYGWIN | |
98 #include "console-tty.h" | |
99 #endif | |
100 | 97 |
101 #ifdef HAVE_MENUBARS | 98 #ifdef HAVE_MENUBARS |
102 #define ADJR_MENUFLAG TRUE | 99 #define ADJR_MENUFLAG TRUE |
103 #else | 100 #else |
104 #define ADJR_MENUFLAG FALSE | 101 #define ADJR_MENUFLAG FALSE |
105 #endif | 102 #endif |
106 | |
107 /* Fake key modifier which is attached to a quit char event. | |
108 Removed upon dequeueing an event */ | |
109 #define FAKE_MOD_QUIT (1 << 20) | |
110 #define FAKE_MOD_QUIT_CRITICAL (1 << 21) | |
111 | 103 |
112 /* Timer ID used for button2 emulation */ | 104 /* Timer ID used for button2 emulation */ |
113 #define BUTTON_2_TIMER_ID 1 | 105 #define BUTTON_2_TIMER_ID 1 |
114 | 106 |
115 static Lisp_Object mswindows_find_console (HWND hwnd); | 107 static Lisp_Object mswindows_find_console (HWND hwnd); |
145 static int mswindows_waitable_count = 0; | 137 static int mswindows_waitable_count = 0; |
146 | 138 |
147 #endif | 139 #endif |
148 | 140 |
149 /* | 141 /* |
150 * Two separate queues, for efficiency, one (_u_) for user events, and | 142 * We use an additional queue, as well as the normal dispatch queue, for |
151 * another (_s_) for non-user ones. We always return events out of the | 143 * efficiency, the normal one for user events, and another (_s_) for non-user |
152 * first one until it is empty and only then proceed with the second | 144 * ones. We always return events out of the first one until it is empty and |
153 * one. | 145 * only then proceed with the second one. |
154 */ | 146 */ |
155 static Lisp_Object mswindows_u_dispatch_event_queue, mswindows_u_dispatch_event_queue_tail; | 147 static Lisp_Object mswindows_s_dispatch_event_queue; |
156 static Lisp_Object mswindows_s_dispatch_event_queue, mswindows_s_dispatch_event_queue_tail; | 148 static Lisp_Object mswindows_s_dispatch_event_queue_tail; |
157 | 149 |
158 /* Brush for painting widgets */ | 150 /* Brush for painting widgets */ |
159 static HBRUSH widget_brush = 0; | 151 static HBRUSH widget_brush = 0; |
160 static LONG last_widget_brushed = 0; | 152 static LONG last_widget_brushed = 0; |
161 | |
162 /* Count of quit chars currently in the queue */ | |
163 /* Incremented in WM_[SYS]KEYDOWN handler in the mswindows_wnd_proc() | |
164 Decremented in mswindows_dequeue_dispatch_event() */ | |
165 int mswindows_quit_chars_count = 0; | |
166 | 153 |
167 /* These are Lisp integers; see DEFVARS in this file for description. */ | 154 /* These are Lisp integers; see DEFVARS in this file for description. */ |
168 int mswindows_dynamic_frame_resize; | 155 int mswindows_dynamic_frame_resize; |
169 int mswindows_alt_by_itself_activates_menu; | 156 int mswindows_alt_by_itself_activates_menu; |
170 Fixnum mswindows_num_mouse_buttons; | 157 Fixnum mswindows_num_mouse_buttons; |
688 LPARAM user_data; /* Any user data stored in the stream object */ | 675 LPARAM user_data; /* Any user data stored in the stream object */ |
689 SOCKET s; /* Socket handle (which is a Win32 handle) */ | 676 SOCKET s; /* Socket handle (which is a Win32 handle) */ |
690 OVERLAPPED ov; /* Overlapped I/O structure */ | 677 OVERLAPPED ov; /* Overlapped I/O structure */ |
691 void *buffer; /* Buffer. */ | 678 void *buffer; /* Buffer. */ |
692 DWORD bufsize; /* Number of bytes last read */ | 679 DWORD bufsize; /* Number of bytes last read */ |
693 DWORD charbpos; /* Position in buffer for next fetch */ | 680 DWORD charbpos; /* Position in buffer for next fetch */ |
694 unsigned int error_p :1; /* I/O Error seen */ | 681 unsigned int error_p :1; /* I/O Error seen */ |
695 unsigned int eof_p :1; /* EOF Error seen */ | 682 unsigned int eof_p :1; /* EOF Error seen */ |
696 unsigned int pending_p :1; /* There is a pending I/O operation */ | 683 unsigned int pending_p :1; /* There is a pending I/O operation */ |
697 unsigned int blocking_p :1; /* Last write attempt would block */ | 684 unsigned int blocking_p :1; /* Last write attempt would block */ |
698 }; | 685 }; |
735 errno = EAGAIN; | 722 errno = EAGAIN; |
736 return -1; | 723 return -1; |
737 } | 724 } |
738 else | 725 else |
739 { | 726 { |
740 if (!GetOverlappedResult ((HANDLE)str->s, &str->ov, &str->bufsize, TRUE)) | 727 if (!GetOverlappedResult ((HANDLE)str->s, &str->ov, &str->bufsize, |
728 TRUE)) | |
741 { | 729 { |
742 if (GetLastError() == ERROR_HANDLE_EOF) | 730 if (GetLastError() == ERROR_HANDLE_EOF) |
743 str->bufsize = 0; | 731 str->bufsize = 0; |
744 else | 732 else |
745 str->error_p = 1; | 733 str->error_p = 1; |
781 return -1; | 769 return -1; |
782 } | 770 } |
783 else | 771 else |
784 { | 772 { |
785 DWORD dw_unused; | 773 DWORD dw_unused; |
786 if (!GetOverlappedResult ((HANDLE)str->s, &str->ov, &dw_unused, TRUE)) | 774 if (!GetOverlappedResult ((HANDLE)str->s, &str->ov, &dw_unused, |
775 TRUE)) | |
787 str->error_p = 1; | 776 str->error_p = 1; |
788 str->pending_p = 0; | 777 str->pending_p = 0; |
789 } | 778 } |
790 } | 779 } |
791 | 780 |
925 * Add an emacs event to the proper dispatch queue | 914 * Add an emacs event to the proper dispatch queue |
926 */ | 915 */ |
927 void | 916 void |
928 mswindows_enqueue_dispatch_event (Lisp_Object event) | 917 mswindows_enqueue_dispatch_event (Lisp_Object event) |
929 { | 918 { |
930 int user_p = mswindows_user_event_p (XEVENT(event)); | 919 int user_p = mswindows_user_event_p (XEVENT (event)); |
931 enqueue_event (event, | 920 if (user_p) |
932 user_p ? &mswindows_u_dispatch_event_queue : | 921 enqueue_dispatch_event (event); |
933 &mswindows_s_dispatch_event_queue, | 922 else |
934 user_p ? &mswindows_u_dispatch_event_queue_tail : | 923 enqueue_event (event, &mswindows_s_dispatch_event_queue, |
935 &mswindows_s_dispatch_event_queue_tail); | 924 &mswindows_s_dispatch_event_queue_tail); |
936 | 925 |
937 /* Avoid blocking on WaitMessage */ | 926 /* Avoid blocking on WaitMessage */ |
938 qxePostMessage (NULL, XM_BUMPQUEUE, 0, 0); | 927 qxePostMessage (NULL, XM_BUMPQUEUE, 0, 0); |
939 } | 928 } |
940 | 929 |
941 /* | 930 /* |
942 * Add a misc-user event to the dispatch queue. | 931 * Add a misc-user event to the dispatch queue. |
943 * | |
944 * Stuff it into our own dispatch queue, so we have something | |
945 * to return from next_event callback. | |
946 */ | 932 */ |
947 void | 933 void |
948 mswindows_enqueue_misc_user_event (Lisp_Object channel, Lisp_Object function, | 934 mswindows_enqueue_misc_user_event (Lisp_Object channel, Lisp_Object function, |
949 Lisp_Object object) | 935 Lisp_Object object) |
950 { | 936 { |
951 Lisp_Object event = Fmake_event (Qnil, Qnil); | 937 Lisp_Object event = Fmake_event (Qnil, Qnil); |
952 | 938 |
953 #ifdef USE_KKCC | |
954 | |
955 XSET_EVENT_TYPE (event, misc_user_event); | 939 XSET_EVENT_TYPE (event, misc_user_event); |
956 XSET_EVENT_CHANNEL (event, channel); | 940 XSET_EVENT_CHANNEL (event, channel); |
957 XSET_EVENT_TIMESTAMP (event, GetTickCount()); | 941 XSET_EVENT_TIMESTAMP (event, GetTickCount()); |
958 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), function); | 942 XSET_EVENT_MISC_USER_FUNCTION (event, function); |
959 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event), object); | 943 XSET_EVENT_MISC_USER_OBJECT (event, object); |
960 #else /* not USE_KKCC */ | |
961 Lisp_Event *e = XEVENT (event); | |
962 | |
963 e->event_type = misc_user_event; | |
964 e->channel = channel; | |
965 e->timestamp = GetTickCount (); | |
966 e->event.misc.function = function; | |
967 e->event.misc.object = object; | |
968 #endif /* not USE_KKCC */ | |
969 | 944 |
970 mswindows_enqueue_dispatch_event (event); | 945 mswindows_enqueue_dispatch_event (event); |
971 } | 946 } |
972 | 947 |
973 void | 948 void |
974 mswindows_enqueue_magic_event (HWND hwnd, UINT msg) | 949 mswindows_enqueue_magic_event (HWND hwnd, UINT msg) |
975 { | 950 { |
976 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 951 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
977 | 952 |
978 #ifdef USE_KKCC | 953 XSET_EVENT_CHANNEL (emacs_event, hwnd ? mswindows_find_frame (hwnd) : Qnil); |
979 XSET_EVENT_CHANNEL (emacs_event, (hwnd ? mswindows_find_frame (hwnd) : Qnil)); | |
980 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime ()); | 954 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime ()); |
981 XSET_EVENT_TYPE (emacs_event, magic_event); | 955 XSET_EVENT_TYPE (emacs_event, magic_event); |
982 XSET_MAGIC_DATA_MSWINDOWS_EVENT (XEVENT_DATA(emacs_event), msg); | 956 XSET_EVENT_MAGIC_MSWINDOWS_EVENT (emacs_event, msg); |
983 #else /* not USE_KKCC */ | |
984 Lisp_Event *event = XEVENT (emacs_event); | |
985 | |
986 event->channel = hwnd ? mswindows_find_frame (hwnd) : Qnil; | |
987 event->timestamp = GetMessageTime(); | |
988 event->event_type = magic_event; | |
989 EVENT_MSWINDOWS_MAGIC_TYPE (event) = msg; | |
990 #endif /* not USE_KKCC */ | |
991 | 957 |
992 mswindows_enqueue_dispatch_event (emacs_event); | 958 mswindows_enqueue_dispatch_event (emacs_event); |
993 } | 959 } |
994 | 960 |
995 static void | 961 static void |
996 mswindows_enqueue_process_event (Lisp_Process *p) | 962 mswindows_enqueue_process_event (Lisp_Process *p) |
997 { | 963 { |
998 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 964 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
999 Lisp_Event *event = XEVENT (emacs_event); | |
1000 Lisp_Object process = wrap_process (p); | 965 Lisp_Object process = wrap_process (p); |
1001 | 966 |
1002 | |
1003 #ifdef USE_KKCC | |
1004 XSET_EVENT_TYPE (emacs_event, process_event); | 967 XSET_EVENT_TYPE (emacs_event, process_event); |
1005 XSET_EVENT_TIMESTAMP (emacs_event, GetTickCount()); | 968 XSET_EVENT_TIMESTAMP (emacs_event, GetTickCount ()); |
1006 XSET_PROCESS_DATA_PROCESS (XEVENT_DATA (emacs_event), process); | 969 XSET_EVENT_PROCESS_PROCESS (emacs_event, process); |
1007 #else /* not USE_KKCC */ | |
1008 event->event_type = process_event; | |
1009 event->timestamp = GetTickCount (); | |
1010 event->event.process.process = process; | |
1011 #endif /* not USE_KKCC */ | |
1012 | 970 |
1013 mswindows_enqueue_dispatch_event (emacs_event); | 971 mswindows_enqueue_dispatch_event (emacs_event); |
1014 } | 972 } |
1015 | 973 |
1016 static void | 974 static void |
1023 /* We always use last message time, because mouse button | 981 /* We always use last message time, because mouse button |
1024 events may get delayed, and XEmacs double click | 982 events may get delayed, and XEmacs double click |
1025 recognition will fail */ | 983 recognition will fail */ |
1026 | 984 |
1027 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 985 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1028 Lisp_Event *event = XEVENT (emacs_event); | |
1029 | 986 |
1030 mswindows_handle_sticky_modifiers (0, 0, downp, 0); | 987 mswindows_handle_sticky_modifiers (0, 0, downp, 0); |
1031 | 988 |
1032 if (downp) | 989 if (downp) |
1033 { | 990 { |
1034 #ifdef USE_KKCC | |
1035 XSET_EVENT_TYPE (emacs_event, button_press_event); | 991 XSET_EVENT_TYPE (emacs_event, button_press_event); |
1036 #else /* not USE_KKCC */ | |
1037 event->event_type = button_press_event; | |
1038 #endif /* not USE_KKCC */ | |
1039 } | 992 } |
1040 else | 993 else |
1041 { | 994 { |
1042 #ifdef USE_KKCC | |
1043 XSET_EVENT_TYPE (emacs_event, button_release_event); | 995 XSET_EVENT_TYPE (emacs_event, button_release_event); |
1044 #else /* not USE_KKCC */ | |
1045 event->event_type = button_release_event; | |
1046 #endif /* not USE_KKCC */ | |
1047 } | 996 } |
1048 | 997 |
1049 #ifdef USE_KKCC | |
1050 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame (hwnd)); | 998 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame (hwnd)); |
1051 XSET_EVENT_TIMESTAMP (emacs_event, when); | 999 XSET_EVENT_TIMESTAMP (emacs_event, when); |
1052 XSET_BUTTON_DATA_BUTTON (XEVENT_DATA (emacs_event), | 1000 XSET_EVENT_BUTTON_BUTTON (emacs_event, |
1053 (msg==WM_LBUTTONDOWN || msg==WM_LBUTTONUP) ? 1 : | 1001 (msg==WM_LBUTTONDOWN || msg==WM_LBUTTONUP) ? 1 : |
1054 ((msg==WM_RBUTTONDOWN || msg==WM_RBUTTONUP) ? 3 : 2)); | 1002 ((msg==WM_RBUTTONDOWN || msg==WM_RBUTTONUP) ? 3 : 2)); |
1055 XSET_BUTTON_DATA_X (XEVENT_DATA (emacs_event), where.x); | 1003 XSET_EVENT_BUTTON_X (emacs_event, where.x); |
1056 XSET_BUTTON_DATA_Y (XEVENT_DATA (emacs_event), where.y); | 1004 XSET_EVENT_BUTTON_Y (emacs_event, where.y); |
1057 XSET_BUTTON_DATA_MODIFIERS (XEVENT_DATA (emacs_event), | 1005 XSET_EVENT_BUTTON_MODIFIERS (emacs_event, |
1058 mswindows_modifier_state (NULL, mods, 0)); | 1006 mswindows_modifier_state (NULL, mods, 0)); |
1059 #else /* not USE_KKCC */ | |
1060 event->channel = mswindows_find_frame (hwnd); | |
1061 event->timestamp = when; | |
1062 event->event.button.button = | |
1063 (msg==WM_LBUTTONDOWN || msg==WM_LBUTTONUP) ? 1 : | |
1064 ((msg==WM_RBUTTONDOWN || msg==WM_RBUTTONUP) ? 3 : 2); | |
1065 event->event.button.x = where.x; | |
1066 event->event.button.y = where.y; | |
1067 event->event.button.modifiers = mswindows_modifier_state (NULL, mods, 0); | |
1068 #endif /* not USE_KKCC */ | |
1069 | 1007 |
1070 if (downp) | 1008 if (downp) |
1071 { | 1009 { |
1072 SetCapture (hwnd); | 1010 SetCapture (hwnd); |
1073 /* we need this to make sure the main window regains the focus | 1011 /* we need this to make sure the main window regains the focus |
1089 static Lisp_Object | 1027 static Lisp_Object |
1090 mswindows_enqueue_keypress_event (HWND hwnd, Lisp_Object keysym, int mods) | 1028 mswindows_enqueue_keypress_event (HWND hwnd, Lisp_Object keysym, int mods) |
1091 { | 1029 { |
1092 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1030 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1093 | 1031 |
1094 #ifdef USE_KKCC | |
1095 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_console(hwnd)); | 1032 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_console(hwnd)); |
1096 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); | 1033 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); |
1097 XSET_EVENT_TYPE (emacs_event, key_press_event); | 1034 XSET_EVENT_TYPE (emacs_event, key_press_event); |
1098 XSET_KEY_DATA_KEYSYM (XEVENT_DATA (emacs_event), keysym); | 1035 XSET_EVENT_KEY_KEYSYM (emacs_event, keysym); |
1099 XSET_KEY_DATA_MODIFIERS (XEVENT_DATA (emacs_event), mods); | 1036 XSET_EVENT_KEY_MODIFIERS (emacs_event, mods); |
1100 #else /* not USE_KKCC */ | |
1101 Lisp_Event *event = XEVENT(emacs_event); | |
1102 | |
1103 event->channel = mswindows_find_console(hwnd); | |
1104 event->timestamp = GetMessageTime(); | |
1105 event->event_type = key_press_event; | |
1106 event->event.key.keysym = keysym; | |
1107 event->event.key.modifiers = mods; | |
1108 #endif /* not USE_KKCC */ | |
1109 mswindows_enqueue_dispatch_event (emacs_event); | 1037 mswindows_enqueue_dispatch_event (emacs_event); |
1110 return emacs_event; | 1038 return emacs_event; |
1111 } | 1039 } |
1112 | 1040 |
1113 /* | 1041 /* |
1115 * Give a preference to user events over non-user ones. | 1043 * Give a preference to user events over non-user ones. |
1116 */ | 1044 */ |
1117 static Lisp_Object | 1045 static Lisp_Object |
1118 mswindows_dequeue_dispatch_event (void) | 1046 mswindows_dequeue_dispatch_event (void) |
1119 { | 1047 { |
1120 Lisp_Object event; | 1048 assert (!NILP (dispatch_event_queue) || |
1121 Lisp_Event *sevt; | 1049 !NILP (mswindows_s_dispatch_event_queue)); |
1122 | 1050 |
1123 assert (!NILP(mswindows_u_dispatch_event_queue) || | 1051 if (!NILP (dispatch_event_queue)) |
1124 !NILP(mswindows_s_dispatch_event_queue)); | 1052 return dequeue_dispatch_event (); |
1125 | 1053 else |
1126 event = dequeue_event ( | 1054 return dequeue_event (&mswindows_s_dispatch_event_queue, |
1127 NILP(mswindows_u_dispatch_event_queue) ? | 1055 &mswindows_s_dispatch_event_queue_tail); |
1128 &mswindows_s_dispatch_event_queue : | |
1129 &mswindows_u_dispatch_event_queue, | |
1130 NILP(mswindows_u_dispatch_event_queue) ? | |
1131 &mswindows_s_dispatch_event_queue_tail : | |
1132 &mswindows_u_dispatch_event_queue_tail); | |
1133 | |
1134 #ifdef USE_KKCC | |
1135 if (XEVENT_TYPE (event) == key_press_event | |
1136 && (XKEY_DATA_MODIFIERS (XEVENT_DATA(event)) & FAKE_MOD_QUIT)) | |
1137 XSET_KEY_DATA_MODIFIERS (XEVENT_DATA (event), | |
1138 XKEY_DATA_MODIFIERS (XEVENT_DATA (event)) & | |
1139 ~(FAKE_MOD_QUIT | FAKE_MOD_QUIT_CRITICAL)); | |
1140 #else /* not USE_KKCC */ | |
1141 sevt = XEVENT (event); | |
1142 if (sevt->event_type == key_press_event | |
1143 && (sevt->event.key.modifiers & FAKE_MOD_QUIT)) | |
1144 sevt->event.key.modifiers &= | |
1145 ~(FAKE_MOD_QUIT | FAKE_MOD_QUIT_CRITICAL); | |
1146 #endif /* not USE_KKCC */ | |
1147 | |
1148 return event; | |
1149 } | |
1150 | |
1151 /* | |
1152 * Remove and return the first emacs event on the dispatch queue that matches | |
1153 * the supplied event. | |
1154 * Timeout event matches if interval_id is equal to that of the given event. | |
1155 * Keypress event matches if logical AND between modifiers bitmask of the | |
1156 * event in the queue and that of the given event is non-zero. | |
1157 * For all other event types, this function aborts. | |
1158 */ | |
1159 | |
1160 Lisp_Object | |
1161 mswindows_cancel_dispatch_event (Lisp_Event *match) | |
1162 { | |
1163 Lisp_Object event; | |
1164 Lisp_Object previous_event = Qnil; | |
1165 int user_p = mswindows_user_event_p (match); | |
1166 Lisp_Object *head = user_p ? &mswindows_u_dispatch_event_queue : | |
1167 &mswindows_s_dispatch_event_queue; | |
1168 Lisp_Object *tail = user_p ? &mswindows_u_dispatch_event_queue_tail : | |
1169 &mswindows_s_dispatch_event_queue_tail; | |
1170 | |
1171 assert (match->event_type == timeout_event | |
1172 || match->event_type == key_press_event); | |
1173 | |
1174 EVENT_CHAIN_LOOP (event, *head) | |
1175 { | |
1176 Lisp_Event *e = XEVENT (event); | |
1177 #ifdef USE_KKCC | |
1178 if ((EVENT_TYPE (e) == EVENT_TYPE (match)) && | |
1179 ((EVENT_TYPE (e) == timeout_event) ? | |
1180 (XTIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (e)) == | |
1181 XTIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (match))) : | |
1182 ((XKEY_DATA_MODIFIERS (EVENT_DATA (e)) & | |
1183 XKEY_DATA_MODIFIERS (EVENT_DATA (match))) != 0))) | |
1184 #else /* not USE_KKCC */ | |
1185 if ((e->event_type == match->event_type) && | |
1186 ((e->event_type == timeout_event) ? | |
1187 (e->event.timeout.interval_id == match->event.timeout.interval_id) : | |
1188 /* Must be key_press_event */ | |
1189 ((e->event.key.modifiers & match->event.key.modifiers) != 0))) | |
1190 #endif /* not USE_KKCC */ | |
1191 { | |
1192 if (NILP (previous_event)) | |
1193 dequeue_event (head, tail); | |
1194 else | |
1195 { | |
1196 XSET_EVENT_NEXT (previous_event, XEVENT_NEXT (event)); | |
1197 if (EQ (*tail, event)) | |
1198 *tail = previous_event; | |
1199 } | |
1200 | |
1201 return event; | |
1202 } | |
1203 previous_event = event; | |
1204 } | |
1205 return Qnil; | |
1206 } | 1056 } |
1207 | 1057 |
1208 #ifndef CYGWIN | 1058 #ifndef CYGWIN |
1209 /************************************************************************/ | 1059 /************************************************************************/ |
1210 /* Waitable handles manipulation */ | 1060 /* Waitable handles manipulation */ |
1456 qxeDispatchMessage (&msg); | 1306 qxeDispatchMessage (&msg); |
1457 mswindows_unmodalize_signal_maybe (); | 1307 mswindows_unmodalize_signal_maybe (); |
1458 } | 1308 } |
1459 } | 1309 } |
1460 | 1310 |
1311 static void | |
1312 emacs_mswindows_drain_queue (void) | |
1313 { | |
1314 mswindows_drain_windows_queue (); | |
1315 #ifdef HAVE_TTY | |
1316 drain_tty_devices (); | |
1317 #endif | |
1318 } | |
1319 | |
1320 static int | |
1321 emacs_mswindows_quit_check_disallowed_p (void) | |
1322 { | |
1323 /* Quit cannot happen in modal loop: all program | |
1324 input is dedicated to Windows. */ | |
1325 return mswindows_in_modal_loop; | |
1326 } | |
1327 | |
1461 /* | 1328 /* |
1462 * This is a special flavor of the mswindows_need_event function, | 1329 * This is a special flavor of the mswindows_need_event function, |
1463 * used while in event pump. Actually, there is only kind of events | 1330 * used while in event pump. Actually, there is only kind of events |
1464 * allowed while in event pump: a timer. An attempt to fetch any | 1331 * allowed while in event pump: a timer. An attempt to fetch any |
1465 * other event leads to a deadlock, as there's no source of user input | 1332 * other event leads to a deadlock, as there's no source of user input |
1479 mswindows_need_event_in_modal_loop (int badly_p) | 1346 mswindows_need_event_in_modal_loop (int badly_p) |
1480 { | 1347 { |
1481 MSG msg; | 1348 MSG msg; |
1482 | 1349 |
1483 /* Check if already have one */ | 1350 /* Check if already have one */ |
1484 if (!NILP (mswindows_u_dispatch_event_queue) | 1351 if (!NILP (dispatch_event_queue) |
1485 || !NILP (mswindows_s_dispatch_event_queue)) | 1352 || !NILP (mswindows_s_dispatch_event_queue)) |
1486 return; | 1353 return; |
1487 | 1354 |
1488 /* No event is ok */ | 1355 /* No event is ok */ |
1489 if (!badly_p) | 1356 if (!badly_p) |
1490 return; | 1357 return; |
1491 | 1358 |
1492 /* We do not check the _u_ queue, because timers go to _s_ */ | 1359 /* We do not check the user queue, because timers go to _s_ */ |
1493 while (NILP (mswindows_s_dispatch_event_queue)) | 1360 while (NILP (mswindows_s_dispatch_event_queue)) |
1494 { | 1361 { |
1495 /* We'll deadlock if go waiting */ | 1362 /* We'll deadlock if go waiting */ |
1496 if (mswindows_pending_timers_count == 0) | 1363 if (mswindows_pending_timers_count == 0) |
1497 invalid_operation ("Deadlock due to an attempt to call next-event in a wrong context", Qunbound); | 1364 invalid_operation |
1365 ("Deadlock due to an attempt to call next-event in a wrong context", | |
1366 Qunbound); | |
1498 | 1367 |
1499 /* Fetch and dispatch any pending timers */ | 1368 /* Fetch and dispatch any pending timers */ |
1500 if (qxeGetMessage (&msg, NULL, WM_TIMER, WM_TIMER) > 0) | 1369 if (qxeGetMessage (&msg, NULL, WM_TIMER, WM_TIMER) > 0) |
1501 qxeDispatchMessage (&msg); | 1370 qxeDispatchMessage (&msg); |
1502 } | 1371 } |
1510 * Used by emacs_mswindows_event_pending_p and emacs_mswindows_next_event | 1379 * Used by emacs_mswindows_event_pending_p and emacs_mswindows_next_event |
1511 */ | 1380 */ |
1512 static void | 1381 static void |
1513 mswindows_need_event (int badly_p) | 1382 mswindows_need_event (int badly_p) |
1514 { | 1383 { |
1515 while (NILP (mswindows_u_dispatch_event_queue) | 1384 while (NILP (dispatch_event_queue) |
1516 && NILP (mswindows_s_dispatch_event_queue)) | 1385 && NILP (mswindows_s_dispatch_event_queue)) |
1517 { | 1386 { |
1518 #ifdef CYGWIN | 1387 #ifdef CYGWIN |
1519 int i; | 1388 int i; |
1520 int active; | 1389 int active; |
1553 } | 1422 } |
1554 else | 1423 else |
1555 { | 1424 { |
1556 #ifdef HAVE_TTY | 1425 #ifdef HAVE_TTY |
1557 /* Look for a TTY event */ | 1426 /* Look for a TTY event */ |
1558 for (i = 0; i < MAXDESC-1; i++) | 1427 for (i = 0; i < MAXDESC; i++) |
1559 { | 1428 { |
1560 /* To avoid race conditions (among other things, an infinite | 1429 /* To avoid race conditions (among other things, an infinite |
1561 loop when called from Fdiscard_input()), we must return | 1430 loop when called from Fdiscard_input()), we must return |
1562 user events ahead of process events. */ | 1431 user events ahead of process events. */ |
1563 if (FD_ISSET (i, &temp_mask) && FD_ISSET (i, &tty_only_mask)) | 1432 if (FD_ISSET (i, &temp_mask) && FD_ISSET (i, &tty_only_mask)) |
1564 { | 1433 { |
1565 struct console *c = tty_find_console_from_fd (i); | 1434 struct console *c = |
1435 find_tty_or_stream_console_from_fd (i); | |
1566 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1436 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1567 Lisp_Event *event = XEVENT (emacs_event); | 1437 Lisp_Event *event = XEVENT (emacs_event); |
1568 | 1438 |
1569 assert (c); | 1439 assert (c); |
1570 if (read_event_from_tty_or_stream_desc (event, c)) | 1440 if (read_event_from_tty_or_stream_desc (event, c)) |
1574 } | 1444 } |
1575 } | 1445 } |
1576 } | 1446 } |
1577 #endif | 1447 #endif |
1578 /* Look for a process event */ | 1448 /* Look for a process event */ |
1579 for (i = 0; i < MAXDESC-1; i++) | 1449 for (i = 0; i < MAXDESC; i++) |
1580 { | 1450 { |
1581 if (FD_ISSET (i, &temp_mask)) | 1451 if (FD_ISSET (i, &temp_mask)) |
1582 { | 1452 { |
1583 if (FD_ISSET (i, &process_only_mask)) | 1453 if (FD_ISSET (i, &process_only_mask)) |
1584 { | 1454 { |
1585 Lisp_Process *p = | 1455 Lisp_Process *p = |
1586 get_process_from_usid (FD_TO_USID(i)); | 1456 get_process_from_usid (FD_TO_USID (i)); |
1587 | 1457 |
1588 mswindows_enqueue_process_event (p); | 1458 mswindows_enqueue_process_event (p); |
1589 } | 1459 } |
1590 else | 1460 else |
1591 { | 1461 { |
1603 else if (active == -1) | 1473 else if (active == -1) |
1604 { | 1474 { |
1605 if (errno != EINTR) | 1475 if (errno != EINTR) |
1606 { | 1476 { |
1607 /* something bad happened */ | 1477 /* something bad happened */ |
1608 assert(0); | 1478 assert (0); |
1609 } | 1479 } |
1610 } | 1480 } |
1611 else | 1481 else |
1612 { | 1482 { |
1613 assert(0); | 1483 assert (0); |
1614 } | 1484 } |
1615 #else /* not CYGWIN */ | 1485 #else /* not CYGWIN */ |
1616 /* Now try getting a message or process event */ | 1486 /* Now try getting a message or process event */ |
1617 DWORD active; | 1487 DWORD active; |
1618 DWORD what_events; | 1488 DWORD what_events; |
1745 mswindows_drain_windows_queue (); | 1615 mswindows_drain_windows_queue (); |
1746 } | 1616 } |
1747 else | 1617 else |
1748 { | 1618 { |
1749 int ix = active - WAIT_OBJECT_0; | 1619 int ix = active - WAIT_OBJECT_0; |
1750 /* First, try to find which process' output has signaled */ | 1620 |
1751 Lisp_Process *p = | 1621 /* look for a stream console event; see |
1752 get_process_from_usid (HANDLE_TO_USID | 1622 emacs_mswindows_select_console below. */ |
1753 (mswindows_waitable_handles[ix])); | 1623 LIST_LOOP_3 (porca_troia, Vconsole_list, vcontail) |
1754 if (p != NULL) | |
1755 { | 1624 { |
1756 /* Found a signaled process input handle */ | 1625 struct console *con = XCONSOLE (porca_troia); |
1757 mswindows_enqueue_process_event (p); | 1626 |
1627 if (CONSOLE_STREAM_P (con)) | |
1628 { | |
1629 Lisp_Object instr = CONSOLE_STREAM_DATA (con)->instream; | |
1630 if (!NILP (instr) && !UNBOUNDP (instr) && | |
1631 get_ntpipe_input_stream_waitable (XLSTREAM (instr)) == | |
1632 mswindows_waitable_handles [ix]) | |
1633 { | |
1634 Ichar ch = Lstream_get_ichar (XLSTREAM (instr)); | |
1635 if (ch < 0) | |
1636 { | |
1637 /* deleting the console might not be safe right now | |
1638 ... */ | |
1639 enqueue_magic_eval_event (io_error_delete_console, | |
1640 porca_troia); | |
1641 /* but we definitely need to unselect it to avoid | |
1642 infinite loops reading EOF's */ | |
1643 Fconsole_disable_input (porca_troia); | |
1644 mswindows_enqueue_magic_event (NULL, XM_BUMPQUEUE); | |
1645 } | |
1646 else | |
1647 { | |
1648 Lisp_Object event = Fmake_event (Qnil, Qnil); | |
1649 /* Here we really do want to set the | |
1650 use_console_meta_flag because the char is from the | |
1651 TTY. */ | |
1652 character_to_event (ch, XEVENT (event), con, 1, 1); | |
1653 XSET_EVENT_CHANNEL (event, porca_troia); | |
1654 enqueue_dispatch_event (event); | |
1655 } | |
1656 break; | |
1657 } | |
1658 } | |
1758 } | 1659 } |
1759 else | 1660 |
1760 { | 1661 if (NILP (vcontail)) |
1761 /* None. This means that the process handle itself has signaled. | 1662 { /* no stream console event, look for process event */ |
1762 Remove the handle from the wait vector, and make status_notify | 1663 /* First, try to find which process' output has signaled */ |
1763 note the exited process. First find the process object if | 1664 Lisp_Process *p = |
1764 possible. */ | 1665 get_process_from_usid (HANDLE_TO_USID |
1765 LIST_LOOP_3 (vaffanculo, Vprocess_list, vproctail) | 1666 (mswindows_waitable_handles[ix])); |
1766 if (get_nt_process_handle (XPROCESS (vaffanculo)) == | 1667 if (p != NULL) |
1767 mswindows_waitable_handles [ix]) | 1668 /* Found a signaled process input handle */ |
1768 break; | 1669 mswindows_enqueue_process_event (p); |
1769 mswindows_waitable_handles [ix] = | |
1770 mswindows_waitable_handles [--mswindows_waitable_count]; | |
1771 kick_status_notify (); | |
1772 /* We need to return a process event here so that | |
1773 (1) accept-process-output will return when called on this | |
1774 process, and (2) status notifications will happen in | |
1775 accept-process-output, sleep-for, and sit-for. */ | |
1776 if (!NILP (vproctail)) | |
1777 mswindows_enqueue_process_event (XPROCESS (vaffanculo)); | |
1778 else | 1670 else |
1779 { | 1671 { |
1780 /* abort (); */ | 1672 /* None. This means that the process handle itself has |
1781 /* #### FUCKME! When can this happen? I hit this abort() | 1673 signaled. Remove the handle from the wait vector, and |
1782 when I tried enabling it. */ | 1674 make status_notify note the exited process. First |
1783 /* Have to return something: there may be no accompanying | 1675 find the process object if possible. */ |
1784 process event */ | 1676 LIST_LOOP_3 (vaffanculo, Vprocess_list, vproctail) |
1785 mswindows_enqueue_magic_event (NULL, XM_BUMPQUEUE); | 1677 if (get_nt_process_handle (XPROCESS (vaffanculo)) == |
1678 mswindows_waitable_handles [ix]) | |
1679 break; | |
1680 mswindows_waitable_handles [ix] = | |
1681 mswindows_waitable_handles [--mswindows_waitable_count]; | |
1682 kick_status_notify (); | |
1683 /* We need to return a process event here so that (1) | |
1684 accept-process-output will return when called on this | |
1685 process, and (2) status notifications will happen in | |
1686 accept-process-output, sleep-for, and sit-for. */ | |
1687 if (!NILP (vproctail)) | |
1688 mswindows_enqueue_process_event (XPROCESS (vaffanculo)); | |
1689 else | |
1690 { | |
1691 /* abort (); */ | |
1692 /* #### FUCKME! When can this happen? I hit this | |
1693 abort() when I tried enabling it. */ | |
1694 /* Have to return something: there may be no | |
1695 accompanying process event */ | |
1696 mswindows_enqueue_magic_event (NULL, XM_BUMPQUEUE); | |
1697 } | |
1786 } | 1698 } |
1787 } | 1699 } |
1788 } | 1700 } |
1789 #endif /* not CYGWIN */ | 1701 #endif /* not CYGWIN */ |
1790 } /* while */ | 1702 } /* while */ |
1799 */ | 1711 */ |
1800 static void CALLBACK | 1712 static void CALLBACK |
1801 mswindows_wm_timer_callback (HWND hwnd, UINT umsg, UINT id_timer, DWORD dwtime) | 1713 mswindows_wm_timer_callback (HWND hwnd, UINT umsg, UINT id_timer, DWORD dwtime) |
1802 { | 1714 { |
1803 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1715 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1804 Lisp_Event *event = XEVENT (emacs_event); | |
1805 | 1716 |
1806 if (KillTimer (NULL, id_timer)) | 1717 if (KillTimer (NULL, id_timer)) |
1807 --mswindows_pending_timers_count; | 1718 --mswindows_pending_timers_count; |
1808 | 1719 |
1809 #ifdef USE_KKCC | |
1810 XSET_EVENT_CHANNEL (emacs_event, Qnil); | 1720 XSET_EVENT_CHANNEL (emacs_event, Qnil); |
1811 XSET_EVENT_TIMESTAMP (emacs_event, dwtime); | 1721 XSET_EVENT_TIMESTAMP (emacs_event, dwtime); |
1812 XSET_EVENT_TYPE (emacs_event, timeout_event); | 1722 XSET_EVENT_TYPE (emacs_event, timeout_event); |
1813 XSET_TIMEOUT_DATA_INTERVAL_ID (XEVENT_DATA(emacs_event), id_timer); | 1723 XSET_EVENT_TIMEOUT_INTERVAL_ID (emacs_event, id_timer); |
1814 XSET_TIMEOUT_DATA_FUNCTION (XEVENT_DATA(emacs_event), Qnil); | 1724 XSET_EVENT_TIMEOUT_FUNCTION (emacs_event, Qnil); |
1815 XSET_TIMEOUT_DATA_OBJECT (XEVENT_DATA(emacs_event), Qnil); | 1725 XSET_EVENT_TIMEOUT_OBJECT (emacs_event, Qnil); |
1816 #else /* not USE_KKCC */ | |
1817 event->channel = Qnil; | |
1818 event->timestamp = dwtime; | |
1819 event->event_type = timeout_event; | |
1820 event->event.timeout.interval_id = id_timer; | |
1821 event->event.timeout.function = Qnil; | |
1822 event->event.timeout.object = Qnil; | |
1823 #endif /* not USE_KKCC */ | |
1824 | 1726 |
1825 mswindows_enqueue_dispatch_event (emacs_event); | 1727 mswindows_enqueue_dispatch_event (emacs_event); |
1826 } | 1728 } |
1827 | 1729 |
1828 /* | 1730 /* |
1899 return Qnil; | 1801 return Qnil; |
1900 | 1802 |
1901 GCPRO1 (obj); | 1803 GCPRO1 (obj); |
1902 obj = Feval (XCAR (obj)); | 1804 obj = Feval (XCAR (obj)); |
1903 | 1805 |
1904 RETURN_UNGCPRO(obj); | 1806 RETURN_UNGCPRO (obj); |
1905 } | 1807 } |
1906 | 1808 |
1907 /* Evaluate the supplied string as a sequence of Lisp forms, wrapped in | 1809 /* Evaluate the supplied string as a sequence of Lisp forms, wrapped in |
1908 * a progn. Catch any evaluation errors. Set the evaluation status and | 1810 * a progn. Catch any evaluation errors. Set the evaluation status and |
1909 * result variables. | 1811 * result variables. |
1964 XEUNICODE_P ? CP_WINUNICODE : CP_WINANSI); | 1866 XEUNICODE_P ? CP_WINUNICODE : CP_WINANSI); |
1965 | 1867 |
1966 Fput(token, QHSZ, make_float ((int)hsz)); | 1868 Fput(token, QHSZ, make_float ((int)hsz)); |
1967 Vdde_advise_items = Fcons (token, Vdde_advise_items); | 1869 Vdde_advise_items = Fcons (token, Vdde_advise_items); |
1968 | 1870 |
1969 RETURN_UNGCPRO(token); | 1871 RETURN_UNGCPRO (token); |
1970 } | 1872 } |
1971 | 1873 |
1972 DEFUN("dde-free-advise-item", Fdde_free_advise_item, 1, 1, 0, /* | 1874 DEFUN("dde-free-advise-item", Fdde_free_advise_item, 1, 1, 0, /* |
1973 Free the resources associated with advise item ITEM. | 1875 Free the resources associated with advise item ITEM. |
1974 | 1876 |
2260 if (FRAME_TYPE_P (XFRAME (frame), mswindows)) | 2162 if (FRAME_TYPE_P (XFRAME (frame), mswindows)) |
2261 event->channel = frame; | 2163 event->channel = frame; |
2262 }; | 2164 }; |
2263 assert (!NILP (event->channel)); | 2165 assert (!NILP (event->channel)); |
2264 | 2166 |
2265 #ifdef USE_KKCC | |
2266 SET_EVENT_TIMESTAMP (event, GetTickCount()); | 2167 SET_EVENT_TIMESTAMP (event, GetTickCount()); |
2267 SET_EVENT_TYPE (event, misc_user_event); | 2168 SET_EVENT_TYPE (event, misc_user_event); |
2268 XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (event), 1); | 2169 SET_EVENT_MISC_USER_BUTTON (event, 1); |
2269 XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (event), 0); | 2170 SET_EVENT_MISC_USER_MODIFIERS (event, 0); |
2270 XSET_MISC_USER_DATA_X (EVENT_DATA (event), -1); | 2171 SET_EVENT_MISC_USER_X (event, -1); |
2271 XSET_MISC_USER_DATA_Y (EVENT_DATA (event), -1); | 2172 SET_EVENT_MISC_USER_Y (event, -1); |
2272 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (event), | 2173 SET_EVENT_MISC_USER_FUNCTION (event, |
2273 Qdragdrop_drop_dispatch); | 2174 Qdragdrop_drop_dispatch); |
2274 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (event), | 2175 SET_EVENT_MISC_USER_OBJECT (event, |
2275 Fcons (Qdragdrop_URL, | 2176 Fcons (Qdragdrop_URL, |
2276 Fcons (l_dndlist, Qnil))); | 2177 Fcons (l_dndlist, Qnil))); |
2277 #else /* not USE_KKCC */ | |
2278 event->timestamp = GetTickCount(); | |
2279 event->event_type = misc_user_event; | |
2280 event->event.misc.button = 1; | |
2281 event->event.misc.modifiers = 0; | |
2282 event->event.misc.x = -1; | |
2283 event->event.misc.y = -1; | |
2284 event->event.misc.function = Qdragdrop_drop_dispatch; | |
2285 event->event.misc.object = Fcons (Qdragdrop_URL, | |
2286 Fcons (l_dndlist, Qnil)); | |
2287 #endif /* not USE_KKCC */ | |
2288 mswindows_enqueue_dispatch_event (emacs_event); | 2178 mswindows_enqueue_dispatch_event (emacs_event); |
2289 UNGCPRO; | 2179 UNGCPRO; |
2290 return (HDDEDATA) DDE_FACK; | 2180 return (HDDEDATA) DDE_FACK; |
2291 } | 2181 } |
2292 DdeFreeDataHandle (hdata); | 2182 DdeFreeDataHandle (hdata); |
2628 * The windows procedure for the window class XEMACS_CLASS | 2518 * The windows procedure for the window class XEMACS_CLASS |
2629 */ | 2519 */ |
2630 LRESULT WINAPI | 2520 LRESULT WINAPI |
2631 mswindows_wnd_proc (HWND hwnd, UINT message_, WPARAM wParam, LPARAM lParam) | 2521 mswindows_wnd_proc (HWND hwnd, UINT message_, WPARAM wParam, LPARAM lParam) |
2632 { | 2522 { |
2633 /* Note: Remember to initialize emacs_event and event before use. | 2523 /* Note: Remember to initialize emacs_event and event before use. This |
2634 This code calls code that can GC. You must GCPRO before calling such code. */ | 2524 code calls code that can GC. You must GCPRO before calling such |
2525 code. */ | |
2635 Lisp_Object emacs_event = Qnil; | 2526 Lisp_Object emacs_event = Qnil; |
2636 Lisp_Object fobj = Qnil; | 2527 Lisp_Object fobj = Qnil; |
2637 | 2528 |
2638 Lisp_Event *event; | 2529 Lisp_Event *event; |
2639 struct frame *frame; | 2530 struct frame *frame; |
2799 if (sticky_changed) | 2690 if (sticky_changed) |
2800 SetKeyboardState (keymap_orig); | 2691 SetKeyboardState (keymap_orig); |
2801 } | 2692 } |
2802 else /* Normal keys & modifiers */ | 2693 else /* Normal keys & modifiers */ |
2803 { | 2694 { |
2804 Ichar quit_ch = | |
2805 CONSOLE_QUIT_CHAR (XCONSOLE (mswindows_find_console (hwnd))); | |
2806 POINT pnt = { LOWORD (GetMessagePos()), HIWORD (GetMessagePos()) }; | 2695 POINT pnt = { LOWORD (GetMessagePos()), HIWORD (GetMessagePos()) }; |
2807 MSG msg, tranmsg; | 2696 MSG msg, tranmsg; |
2697 #ifdef HAVE_MENUBARS | |
2808 int potential_accelerator = 0; | 2698 int potential_accelerator = 0; |
2699 #endif | |
2809 int got_accelerator = 0; | 2700 int got_accelerator = 0; |
2810 /* No need to gcpro because the event is already on a | 2701 /* No need to gcpro because the event is already on a |
2811 queue when we retrieve it. */ | 2702 queue when we retrieve it. */ |
2812 Lisp_Object lastev = Qnil; | 2703 Lisp_Object lastev = Qnil; |
2813 | 2704 |
2899 tranmsg.wParam, | 2790 tranmsg.wParam, |
2900 tranmsg.lParam); | 2791 tranmsg.lParam); |
2901 } | 2792 } |
2902 #endif /* DEBUG_XEMACS */ | 2793 #endif /* DEBUG_XEMACS */ |
2903 | 2794 |
2904 /* If a quit char with no modifiers other than control and | |
2905 shift, then mark it with a fake modifier, which is removed | |
2906 upon dequeueing the event */ | |
2907 if (((quit_ch < ' ' && (mods & XEMACS_MOD_CONTROL) | |
2908 && DOWNCASE (0, quit_ch + 'a' - 1) == | |
2909 DOWNCASE (0, ch)) | |
2910 || (quit_ch >= ' ' && !(mods & XEMACS_MOD_CONTROL) | |
2911 && DOWNCASE (0, quit_ch) == | |
2912 DOWNCASE (0, ch))) | |
2913 && ((mods_with_shift & | |
2914 ~(XEMACS_MOD_CONTROL | XEMACS_MOD_SHIFT)) | |
2915 == 0)) | |
2916 { | |
2917 mods_with_quit |= FAKE_MOD_QUIT; | |
2918 if (mods_with_shift & XEMACS_MOD_SHIFT) | |
2919 mods_with_quit |= FAKE_MOD_QUIT_CRITICAL; | |
2920 mswindows_quit_chars_count++; | |
2921 } | |
2922 #ifdef HAVE_MENUBARS | 2795 #ifdef HAVE_MENUBARS |
2923 else if (potential_accelerator && !got_accelerator && | 2796 if (potential_accelerator && !got_accelerator && |
2924 mswindows_char_is_accelerator (frame, ch)) | 2797 mswindows_char_is_accelerator (frame, ch)) |
2925 { | 2798 { |
2926 got_accelerator = 1; | 2799 got_accelerator = 1; |
2927 break; | 2800 break; |
2928 } | 2801 } |
2929 #endif /* HAVE_MENUBARS */ | 2802 #endif /* HAVE_MENUBARS */ |
3010 TO_INTERNAL_FORMAT | 2883 TO_INTERNAL_FORMAT |
3011 (DATA, | 2884 (DATA, |
3012 (received_keys + (tounret - 1) * 2, 2), | 2885 (received_keys + (tounret - 1) * 2, 2), |
3013 C_STRING_ALLOCA, intchar, | 2886 C_STRING_ALLOCA, intchar, |
3014 Qmswindows_unicode); | 2887 Qmswindows_unicode); |
3015 XEVENT (lastev)->event.key.alt_keychars[i] = | 2888 XSET_EVENT_KEY_ALT_KEYCHARS |
3016 itext_ichar (intchar); | 2889 (lastev, i, itext_ichar (intchar)); |
3017 } | 2890 } |
3018 } | 2891 } |
3019 else | 2892 else |
3020 { | 2893 { |
3021 WORD received_keys[32]; | 2894 WORD received_keys[32]; |
3048 intchar = convert_multibyte_to_internal_malloc | 2921 intchar = convert_multibyte_to_internal_malloc |
3049 (mbstuff, mblength, | 2922 (mbstuff, mblength, |
3050 mswindows_locale_to_code_page (lcid), | 2923 mswindows_locale_to_code_page (lcid), |
3051 NULL); | 2924 NULL); |
3052 | 2925 |
3053 XEVENT (lastev)->event.key.alt_keychars[i] = | 2926 XSET_EVENT_KEY_ALT_KEYCHARS |
3054 itext_ichar (intchar); | 2927 (lastev, i, itext_ichar (intchar)); |
3055 xfree (intchar); | 2928 xfree (intchar); |
3056 } | 2929 } |
3057 } | 2930 } |
3058 } | 2931 } |
3059 else | 2932 else |
3065 virtual_key + (mods_with_shift & XEMACS_MOD_SHIFT ? | 2938 virtual_key + (mods_with_shift & XEMACS_MOD_SHIFT ? |
3066 'a' - 'A' : 0); | 2939 'a' - 'A' : 0); |
3067 else | 2940 else |
3068 altch = 0; | 2941 altch = 0; |
3069 | 2942 |
3070 XEVENT (lastev)->event.key.alt_keychars[i] = altch; | 2943 XSET_EVENT_KEY_ALT_KEYCHARS (lastev, i, altch); |
3071 } | 2944 } |
3072 } | 2945 } |
3073 } | 2946 } |
3074 #endif /* MULE */ | 2947 #endif /* MULE */ |
3075 | 2948 |
3317 } | 3190 } |
3318 | 3191 |
3319 emacs_event = Fmake_event (Qnil, Qnil); | 3192 emacs_event = Fmake_event (Qnil, Qnil); |
3320 event = XEVENT(emacs_event); | 3193 event = XEVENT(emacs_event); |
3321 | 3194 |
3322 #ifdef USE_KKCC | |
3323 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame(hwnd)); | 3195 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame(hwnd)); |
3324 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); | 3196 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); |
3325 XSET_EVENT_TYPE (emacs_event, pointer_motion_event); | 3197 XSET_EVENT_TYPE (emacs_event, pointer_motion_event); |
3326 XSET_MOTION_DATA_X (XEVENT_DATA (emacs_event),MAKEPOINTS (lParam).x); | 3198 XSET_EVENT_MOTION_X (emacs_event,MAKEPOINTS (lParam).x); |
3327 XSET_MOTION_DATA_Y (XEVENT_DATA (emacs_event),MAKEPOINTS (lParam).y); | 3199 XSET_EVENT_MOTION_Y (emacs_event,MAKEPOINTS (lParam).y); |
3328 XSET_MOTION_DATA_MODIFIERS (XEVENT_DATA(emacs_event), | 3200 XSET_EVENT_MOTION_MODIFIERS (emacs_event, |
3329 mswindows_modifier_state (NULL, wParam, 0)); | 3201 mswindows_modifier_state (NULL, wParam, 0)); |
3330 #else /* not USE_KKCC */ | |
3331 event->channel = mswindows_find_frame (hwnd); | |
3332 event->timestamp = GetMessageTime (); | |
3333 event->event_type = pointer_motion_event; | |
3334 event->event.motion.x = MAKEPOINTS (lParam).x; | |
3335 event->event.motion.y = MAKEPOINTS (lParam).y; | |
3336 event->event.motion.modifiers = | |
3337 mswindows_modifier_state (NULL, wParam, 0); | |
3338 #endif /* not USE_KKCC */ | |
3339 | 3202 |
3340 mswindows_enqueue_dispatch_event (emacs_event); | 3203 mswindows_enqueue_dispatch_event (emacs_event); |
3341 } | 3204 } |
3342 break; | 3205 break; |
3343 | 3206 |
3854 GCPRO3 (emacs_event, l_dndlist, l_item); | 3717 GCPRO3 (emacs_event, l_dndlist, l_item); |
3855 | 3718 |
3856 if (!DragQueryPoint ((HDROP) wParam, &point)) | 3719 if (!DragQueryPoint ((HDROP) wParam, &point)) |
3857 point.x = point.y = -1; /* outside client area */ | 3720 point.x = point.y = -1; /* outside client area */ |
3858 | 3721 |
3859 #ifdef USE_KKCC | |
3860 XSET_EVENT_TYPE (emacs_event, misc_user_event); | 3722 XSET_EVENT_TYPE (emacs_event, misc_user_event); |
3861 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame(hwnd)); | 3723 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame(hwnd)); |
3862 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); | 3724 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); |
3863 XSET_MISC_USER_DATA_BUTTON (XEVENT_DATA (emacs_event), 1); | 3725 XSET_EVENT_MISC_USER_BUTTON (emacs_event, 1); |
3864 XSET_MISC_USER_DATA_MODIFIERS (XEVENT_DATA (emacs_event), | 3726 XSET_EVENT_MISC_USER_MODIFIERS (emacs_event, |
3865 mswindows_modifier_state (NULL, (DWORD) -1, 0)); | 3727 mswindows_modifier_state (NULL, (DWORD) -1, 0)); |
3866 XSET_MISC_USER_DATA_X (XEVENT_DATA (emacs_event), point.x); | 3728 XSET_EVENT_MISC_USER_X (emacs_event, point.x); |
3867 XSET_MISC_USER_DATA_Y (XEVENT_DATA (emacs_event), point.y); | 3729 XSET_EVENT_MISC_USER_Y (emacs_event, point.y); |
3868 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (emacs_event), | 3730 XSET_EVENT_MISC_USER_FUNCTION (emacs_event, |
3869 Qdragdrop_drop_dispatch); | 3731 Qdragdrop_drop_dispatch); |
3870 #else /* not USE_KKCC */ | |
3871 event->event_type = misc_user_event; | |
3872 event->channel = mswindows_find_frame (hwnd); | |
3873 event->timestamp = GetMessageTime(); | |
3874 event->event.misc.button = 1; /* #### Should try harder */ | |
3875 event->event.misc.modifiers = mswindows_modifier_state (NULL, | |
3876 (DWORD) -1, 0); | |
3877 event->event.misc.x = point.x; | |
3878 event->event.misc.y = point.y; | |
3879 event->event.misc.function = Qdragdrop_drop_dispatch; | |
3880 #endif /* not USE_KKCC */ | |
3881 | 3732 |
3882 filecount = qxeDragQueryFile ((HDROP) wParam, 0xffffffff, NULL, 0); | 3733 filecount = qxeDragQueryFile ((HDROP) wParam, 0xffffffff, NULL, 0); |
3883 for (i = 0; i < filecount; i++) | 3734 for (i = 0; i < filecount; i++) |
3884 { | 3735 { |
3885 Ibyte *fname; | 3736 Ibyte *fname; |
4051 } | 3902 } |
4052 } | 3903 } |
4053 | 3904 |
4054 DragFinish ((HDROP) wParam); | 3905 DragFinish ((HDROP) wParam); |
4055 | 3906 |
4056 #ifdef USE_KKCC | 3907 SET_EVENT_MISC_USER_OBJECT (event, |
4057 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (event), | |
4058 Fcons (Qdragdrop_URL, l_dndlist)); | 3908 Fcons (Qdragdrop_URL, l_dndlist)); |
4059 #else /* not USE_KKCC */ | |
4060 event->event.misc.object = Fcons (Qdragdrop_URL, l_dndlist); | |
4061 #endif /* not USE_KKCC */ | |
4062 mswindows_enqueue_dispatch_event (emacs_event); | 3909 mswindows_enqueue_dispatch_event (emacs_event); |
4063 UNGCPRO; | 3910 UNGCPRO; |
4064 } | 3911 } |
4065 break; | 3912 break; |
4066 #endif /* HAVE_DRAGNDROP */ | 3913 #endif /* HAVE_DRAGNDROP */ |
4499 ++mswindows_pending_timers_count; | 4346 ++mswindows_pending_timers_count; |
4500 return SetTimer (NULL, 0, milliseconds, | 4347 return SetTimer (NULL, 0, milliseconds, |
4501 (TIMERPROC) mswindows_wm_timer_callback); | 4348 (TIMERPROC) mswindows_wm_timer_callback); |
4502 } | 4349 } |
4503 | 4350 |
4351 static int | |
4352 remove_timeout_mapper (Lisp_Object ev, void *data) | |
4353 { | |
4354 if (XEVENT_TYPE (ev) == timeout_event) | |
4355 { | |
4356 if ((int) data == XEVENT_TIMEOUT_INTERVAL_ID (ev)) | |
4357 return 1; | |
4358 } | |
4359 | |
4360 return 0; | |
4361 } | |
4362 | |
4504 static void | 4363 static void |
4505 emacs_mswindows_remove_timeout (int id) | 4364 emacs_mswindows_remove_timeout (int id) |
4506 { | 4365 { |
4507 Lisp_Event match_against; | |
4508 Lisp_Object emacs_event; | |
4509 | |
4510 if (KillTimer (NULL, id)) | 4366 if (KillTimer (NULL, id)) |
4511 --mswindows_pending_timers_count; | 4367 --mswindows_pending_timers_count; |
4512 | 4368 |
4513 /* If there is a dispatch event generated by this | 4369 /* If there is a dispatch event generated by this |
4514 timeout in the queue, we have to remove it too. */ | 4370 timeout in the queue, we have to remove it too. */ |
4515 #ifdef USE_KKCC | 4371 map_event_chain_remove (remove_timeout_mapper, |
4516 SET_EVENT_TYPE(&match_against, timeout_event); | 4372 &mswindows_s_dispatch_event_queue, |
4517 XSET_TIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (&match_against), id); | 4373 &mswindows_s_dispatch_event_queue_tail, |
4518 #else /* not USE_KKCC */ | 4374 (void *) id, MECR_DEALLOCATE_EVENT); |
4519 match_against.event_type = timeout_event; | |
4520 match_against.event.timeout.interval_id = id; | |
4521 #endif /* not USE_KKCC */ | |
4522 emacs_event = mswindows_cancel_dispatch_event (&match_against); | |
4523 if (!NILP (emacs_event)) | |
4524 Fdeallocate_event(emacs_event); | |
4525 } | 4375 } |
4526 | 4376 |
4527 /* If `user_p' is false, then return whether there are any win32, timeout, | 4377 /* If `user_p' is false, then return whether there are any win32, timeout, |
4528 * or subprocess events pending (that is, whether | 4378 * or subprocess events pending (that is, whether |
4529 * emacs_mswindows_next_event() would return immediately without blocking). | 4379 * emacs_mswindows_next_event() would return immediately without blocking). |
4535 */ | 4385 */ |
4536 static int | 4386 static int |
4537 emacs_mswindows_event_pending_p (int user_p) | 4387 emacs_mswindows_event_pending_p (int user_p) |
4538 { | 4388 { |
4539 mswindows_need_event (0); | 4389 mswindows_need_event (0); |
4540 return (!NILP (mswindows_u_dispatch_event_queue) | 4390 return (!NILP (dispatch_event_queue) |
4541 || (!user_p && !NILP (mswindows_s_dispatch_event_queue))); | 4391 || (!user_p && !NILP (mswindows_s_dispatch_event_queue))); |
4542 } | 4392 } |
4543 | 4393 |
4544 /* | 4394 /* |
4545 * Return the next event | 4395 * Return the next event |
4561 emacs_mswindows_format_magic_event (Lisp_Event *emacs_event, | 4411 emacs_mswindows_format_magic_event (Lisp_Event *emacs_event, |
4562 Lisp_Object pstream) | 4412 Lisp_Object pstream) |
4563 { | 4413 { |
4564 #define FROB(msg) case msg: write_c_string (pstream, "type=" #msg); break | 4414 #define FROB(msg) case msg: write_c_string (pstream, "type=" #msg); break |
4565 | 4415 |
4566 #ifdef USE_KKCC | 4416 switch (EVENT_MAGIC_MSWINDOWS_EVENT (emacs_event)) |
4567 switch (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA(emacs_event))) | |
4568 #else /* not USE_KKCC */ | |
4569 switch (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event)) | |
4570 #endif /* not USE_KKCC */ | |
4571 { | 4417 { |
4572 FROB (XM_BUMPQUEUE); | 4418 FROB (XM_BUMPQUEUE); |
4573 FROB (WM_PAINT); | 4419 FROB (WM_PAINT); |
4574 FROB (WM_SETFOCUS); | 4420 FROB (WM_SETFOCUS); |
4575 FROB (WM_KILLFOCUS); | 4421 FROB (WM_KILLFOCUS); |
4588 } | 4434 } |
4589 | 4435 |
4590 static int | 4436 static int |
4591 emacs_mswindows_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) | 4437 emacs_mswindows_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) |
4592 { | 4438 { |
4593 #ifdef USE_KKCC | 4439 return (EVENT_MAGIC_MSWINDOWS_EVENT (e1) == |
4594 return (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e1)) == | 4440 EVENT_MAGIC_MSWINDOWS_EVENT (e2)); |
4595 XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e2))); | |
4596 #else /* not USE_KKCC */ | |
4597 return (e1->event.magic.underlying_mswindows_event == | |
4598 e2->event.magic.underlying_mswindows_event); | |
4599 #endif /* not USE_KKCC */ | |
4600 } | 4441 } |
4601 | 4442 |
4602 static Hashcode | 4443 static Hashcode |
4603 emacs_mswindows_hash_magic_event (Lisp_Event *e) | 4444 emacs_mswindows_hash_magic_event (Lisp_Event *e) |
4604 { | 4445 { |
4605 #ifdef USE_KKCC | 4446 return (EVENT_MAGIC_MSWINDOWS_EVENT (e)); |
4606 return (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e))); | |
4607 #else /* not USE_KKCC */ | |
4608 return e->event.magic.underlying_mswindows_event; | |
4609 #endif /* not USE_KKCC */ | |
4610 } | 4447 } |
4611 | 4448 |
4612 /* | 4449 /* |
4613 * Handle a magic event off the dispatch queue. | 4450 * Handle a magic event off the dispatch queue. |
4614 */ | 4451 */ |
4615 static void | 4452 static void |
4616 emacs_mswindows_handle_magic_event (Lisp_Event *emacs_event) | 4453 emacs_mswindows_handle_magic_event (Lisp_Event *emacs_event) |
4617 { | 4454 { |
4618 #ifdef USE_KKCC | 4455 switch (EVENT_MAGIC_MSWINDOWS_EVENT (emacs_event)) |
4619 switch (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA(emacs_event))) | |
4620 #else /* not USE_KKCC */ | |
4621 switch (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event)) | |
4622 #endif /* not USE_KKCC */ | |
4623 { | 4456 { |
4624 case XM_BUMPQUEUE: | 4457 case XM_BUMPQUEUE: |
4625 break; | 4458 break; |
4626 | 4459 |
4627 case WM_PAINT: | 4460 case WM_PAINT: |
4635 case WM_SETFOCUS: | 4468 case WM_SETFOCUS: |
4636 case WM_KILLFOCUS: | 4469 case WM_KILLFOCUS: |
4637 { | 4470 { |
4638 Lisp_Object frame = EVENT_CHANNEL (emacs_event); | 4471 Lisp_Object frame = EVENT_CHANNEL (emacs_event); |
4639 struct frame *f = XFRAME (frame); | 4472 struct frame *f = XFRAME (frame); |
4640 #ifdef USE_KKCC | 4473 int in_p = (EVENT_MAGIC_MSWINDOWS_EVENT (emacs_event) |
4641 int in_p = (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA(emacs_event)) | |
4642 == WM_SETFOCUS); | 4474 == WM_SETFOCUS); |
4643 #else /* not USE_KKCC */ | |
4644 int in_p = (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event) == WM_SETFOCUS); | |
4645 #endif /* not USE_KKCC */ | |
4646 Lisp_Object conser; | 4475 Lisp_Object conser; |
4647 struct gcpro gcpro1; | 4476 struct gcpro gcpro1; |
4648 | 4477 |
4649 /* On focus change, clear all memory of sticky modifiers | 4478 /* On focus change, clear all memory of sticky modifiers |
4650 to avoid non-intuitive behavior. */ | 4479 to avoid non-intuitive behavior. */ |
4663 | 4492 |
4664 case XM_MAPFRAME: | 4493 case XM_MAPFRAME: |
4665 case XM_UNMAPFRAME: | 4494 case XM_UNMAPFRAME: |
4666 { | 4495 { |
4667 Lisp_Object frame = EVENT_CHANNEL (emacs_event); | 4496 Lisp_Object frame = EVENT_CHANNEL (emacs_event); |
4668 #ifdef USE_KKCC | 4497 va_run_hook_with_args (EVENT_MAGIC_MSWINDOWS_EVENT (emacs_event) |
4669 va_run_hook_with_args (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA(emacs_event)) | |
4670 #else /* not USE_KKCC */ | |
4671 va_run_hook_with_args (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event) | |
4672 #endif /* not USE_KKCC */ | |
4673 == XM_MAPFRAME ? | 4498 == XM_MAPFRAME ? |
4674 Qmap_frame_hook : Qunmap_frame_hook, | 4499 Qmap_frame_hook : Qunmap_frame_hook, |
4675 1, frame); | 4500 1, frame); |
4676 } | 4501 } |
4677 break; | 4502 break; |
4804 #ifdef CYGWIN | 4629 #ifdef CYGWIN |
4805 if (CONSOLE_MSWINDOWS_P (con)) | 4630 if (CONSOLE_MSWINDOWS_P (con)) |
4806 return; /* mswindows consoles are automatically selected */ | 4631 return; /* mswindows consoles are automatically selected */ |
4807 | 4632 |
4808 event_stream_unixoid_select_console (con); | 4633 event_stream_unixoid_select_console (con); |
4634 #else | |
4635 #if 0 | |
4636 /* This is an attempt to get `xemacs -batch -l dunnet' to work. | |
4637 Doesn't currently work and fucks other things up. */ | |
4638 if (CONSOLE_STREAM_P (con) && | |
4639 !UNBOUNDP (CONSOLE_STREAM_DATA (con)->instream)) | |
4640 { | |
4641 HANDLE h = | |
4642 (HANDLE) _get_osfhandle (fileno (CONSOLE_STREAM_DATA (con)->in)); | |
4643 if (PeekNamedPipe (h, 0, 0, 0, 0, 0)) | |
4644 { | |
4645 Lisp_Object lstr = make_ntpipe_input_stream (h, 0); | |
4646 HANDLE hwait = get_ntpipe_input_stream_waitable (XLSTREAM (lstr)); | |
4647 | |
4648 if (!add_waitable_handle (hwait)) | |
4649 invalid_operation ("Too many active processes", | |
4650 wrap_console (con)); | |
4651 CONSOLE_STREAM_DATA (con)->instream = lstr; | |
4652 } | |
4653 else | |
4654 /* Unable to select on this stream */ | |
4655 CONSOLE_STREAM_DATA (con)->instream = Qunbound; | |
4656 } | |
4657 #endif /* 0 */ | |
4809 #endif | 4658 #endif |
4810 } | 4659 } |
4811 | 4660 |
4812 static void | 4661 static void |
4813 emacs_mswindows_unselect_console (struct console *con) | 4662 emacs_mswindows_unselect_console (struct console *con) |
4815 #ifdef CYGWIN | 4664 #ifdef CYGWIN |
4816 if (CONSOLE_MSWINDOWS_P (con)) | 4665 if (CONSOLE_MSWINDOWS_P (con)) |
4817 return; /* mswindows consoles are automatically selected */ | 4666 return; /* mswindows consoles are automatically selected */ |
4818 | 4667 |
4819 event_stream_unixoid_unselect_console (con); | 4668 event_stream_unixoid_unselect_console (con); |
4669 #else | |
4670 #if 0 /* see above */ | |
4671 if (CONSOLE_STREAM_P (con) && | |
4672 !UNBOUNDP (CONSOLE_STREAM_DATA (con)->instream)) | |
4673 { | |
4674 Lisp_Object instr = CONSOLE_STREAM_DATA (con)->instream; | |
4675 HANDLE hwait; | |
4676 | |
4677 assert (!NILP (instr)); | |
4678 hwait = get_ntpipe_input_stream_waitable (XLSTREAM (instr)); | |
4679 | |
4680 remove_waitable_handle (hwait); | |
4681 } | |
4682 #endif /* 0 */ | |
4820 #endif | 4683 #endif |
4821 } | |
4822 | |
4823 static void | |
4824 emacs_mswindows_quit_p (void) | |
4825 { | |
4826 /* Quit cannot happen in modal loop: all program | |
4827 input is dedicated to Windows. */ | |
4828 if (mswindows_in_modal_loop) | |
4829 return; | |
4830 | |
4831 mswindows_quit_chars_count = 0; | |
4832 /* Drain windows queue. This sets up number of quit characters in | |
4833 the queue. */ | |
4834 mswindows_drain_windows_queue (); | |
4835 | |
4836 if (mswindows_quit_chars_count > 0) | |
4837 { | |
4838 /* Yes there's a hidden one... Throw it away */ | |
4839 Lisp_Event match_against; | |
4840 Lisp_Object emacs_event; | |
4841 int critical_p = 0; | |
4842 | |
4843 #ifdef USE_KKCC | |
4844 SET_EVENT_TYPE (&match_against, key_press_event); | |
4845 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (&match_against), FAKE_MOD_QUIT); | |
4846 #else /* not USE_KKCC */ | |
4847 match_against.event_type = key_press_event; | |
4848 match_against.event.key.modifiers = FAKE_MOD_QUIT; | |
4849 #endif /* not USE_KKCC */ | |
4850 | |
4851 while (mswindows_quit_chars_count > 0) | |
4852 { | |
4853 emacs_event = mswindows_cancel_dispatch_event (&match_against); | |
4854 assert (!NILP (emacs_event)); | |
4855 | |
4856 #ifdef USE_KKCC | |
4857 if (XKEY_DATA_MODIFIERS (XEVENT_DATA(emacs_event)) & | |
4858 #else /* not USE_KKCC */ | |
4859 if (XEVENT (emacs_event)->event.key.modifiers & | |
4860 #endif /* not USE_KKCC */ | |
4861 FAKE_MOD_QUIT_CRITICAL) | |
4862 critical_p = 1; | |
4863 | |
4864 Fdeallocate_event (emacs_event); | |
4865 mswindows_quit_chars_count--; | |
4866 } | |
4867 | |
4868 Vquit_flag = critical_p ? Qcritical : Qt; | |
4869 } | |
4870 } | 4684 } |
4871 | 4685 |
4872 static void | 4686 static void |
4873 emacs_mswindows_create_io_streams (void *inhandle, void *outhandle, | 4687 emacs_mswindows_create_io_streams (void *inhandle, void *outhandle, |
4874 void *errhandle, Lisp_Object *instream, | 4688 void *errhandle, Lisp_Object *instream, |
5332 reinit_vars_of_event_mswindows (void) | 5146 reinit_vars_of_event_mswindows (void) |
5333 { | 5147 { |
5334 mswindows_in_modal_loop = 0; | 5148 mswindows_in_modal_loop = 0; |
5335 mswindows_pending_timers_count = 0; | 5149 mswindows_pending_timers_count = 0; |
5336 | 5150 |
5337 mswindows_event_stream = xnew (struct event_stream); | 5151 mswindows_event_stream = xnew_and_zero (struct event_stream); |
5338 | 5152 |
5339 mswindows_event_stream->event_pending_p = emacs_mswindows_event_pending_p; | 5153 mswindows_event_stream->event_pending_p = emacs_mswindows_event_pending_p; |
5340 mswindows_event_stream->force_event_pending = 0; | |
5341 mswindows_event_stream->next_event_cb = emacs_mswindows_next_event; | 5154 mswindows_event_stream->next_event_cb = emacs_mswindows_next_event; |
5342 mswindows_event_stream->handle_magic_event_cb = emacs_mswindows_handle_magic_event; | 5155 mswindows_event_stream->handle_magic_event_cb = emacs_mswindows_handle_magic_event; |
5343 mswindows_event_stream->format_magic_event_cb = emacs_mswindows_format_magic_event; | 5156 mswindows_event_stream->format_magic_event_cb = emacs_mswindows_format_magic_event; |
5344 mswindows_event_stream->compare_magic_event_cb= emacs_mswindows_compare_magic_event; | 5157 mswindows_event_stream->compare_magic_event_cb= emacs_mswindows_compare_magic_event; |
5345 mswindows_event_stream->hash_magic_event_cb = emacs_mswindows_hash_magic_event; | 5158 mswindows_event_stream->hash_magic_event_cb = emacs_mswindows_hash_magic_event; |
5346 mswindows_event_stream->add_timeout_cb = emacs_mswindows_add_timeout; | 5159 mswindows_event_stream->add_timeout_cb = emacs_mswindows_add_timeout; |
5347 mswindows_event_stream->remove_timeout_cb = emacs_mswindows_remove_timeout; | 5160 mswindows_event_stream->remove_timeout_cb = emacs_mswindows_remove_timeout; |
5348 mswindows_event_stream->quit_p_cb = emacs_mswindows_quit_p; | 5161 mswindows_event_stream->drain_queue_cb = emacs_mswindows_drain_queue; |
5162 mswindows_event_stream->quit_check_disallowed_p_cb = emacs_mswindows_quit_check_disallowed_p; | |
5349 mswindows_event_stream->select_console_cb = emacs_mswindows_select_console; | 5163 mswindows_event_stream->select_console_cb = emacs_mswindows_select_console; |
5350 mswindows_event_stream->unselect_console_cb = emacs_mswindows_unselect_console; | 5164 mswindows_event_stream->unselect_console_cb = emacs_mswindows_unselect_console; |
5351 mswindows_event_stream->select_process_cb = emacs_mswindows_select_process; | 5165 mswindows_event_stream->select_process_cb = emacs_mswindows_select_process; |
5352 mswindows_event_stream->unselect_process_cb = emacs_mswindows_unselect_process; | 5166 mswindows_event_stream->unselect_process_cb = emacs_mswindows_unselect_process; |
5353 mswindows_event_stream->create_io_streams_cb = emacs_mswindows_create_io_streams; | 5167 mswindows_event_stream->create_io_streams_cb = emacs_mswindows_create_io_streams; |
5361 void | 5175 void |
5362 vars_of_event_mswindows (void) | 5176 vars_of_event_mswindows (void) |
5363 { | 5177 { |
5364 reinit_vars_of_event_mswindows (); | 5178 reinit_vars_of_event_mswindows (); |
5365 | 5179 |
5366 mswindows_u_dispatch_event_queue = Qnil; | |
5367 staticpro (&mswindows_u_dispatch_event_queue); | |
5368 mswindows_u_dispatch_event_queue_tail = Qnil; | |
5369 dump_add_root_object (&mswindows_u_dispatch_event_queue_tail); | |
5370 | |
5371 mswindows_s_dispatch_event_queue = Qnil; | 5180 mswindows_s_dispatch_event_queue = Qnil; |
5372 staticpro (&mswindows_s_dispatch_event_queue); | 5181 staticpro (&mswindows_s_dispatch_event_queue); |
5373 mswindows_s_dispatch_event_queue_tail = Qnil; | 5182 mswindows_s_dispatch_event_queue_tail = Qnil; |
5374 dump_add_root_object (&mswindows_s_dispatch_event_queue_tail); | 5183 dump_add_root_lisp_object (&mswindows_s_dispatch_event_queue_tail); |
5375 | 5184 |
5376 mswindows_error_caught_in_modal_loop = 0; | 5185 mswindows_error_caught_in_modal_loop = 0; |
5377 | 5186 |
5378 #ifdef HAVE_DRAGNDROP | 5187 #ifdef HAVE_DRAGNDROP |
5379 Fprovide (Qdde); | 5188 Fprovide (Qdde); |