comparison src/event-gtk.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 890f3cafe600
children fffe735e63ee
comparison
equal deleted inserted replaced
1203:5f2f8dcbfb3e 1204:e22b0213b713
86 static int last_quit_check_signal_tick_count; 86 static int last_quit_check_signal_tick_count;
87 87
88 Lisp_Object Qkey_mapping; 88 Lisp_Object Qkey_mapping;
89 Lisp_Object Qsans_modifiers; 89 Lisp_Object Qsans_modifiers;
90 90
91 static void enqueue_gtk_dispatch_event (Lisp_Object event);
92
93 #define IS_MODIFIER_KEY(keysym) \ 91 #define IS_MODIFIER_KEY(keysym) \
94 ((((keysym) >= GDK_Shift_L) && ((keysym) <= GDK_Hyper_R)) \ 92 ((((keysym) >= GDK_Shift_L) && ((keysym) <= GDK_Hyper_R)) \
95 || ((keysym) == GDK_Mode_switch) \ 93 || ((keysym) == GDK_Mode_switch) \
96 || ((keysym) == GDK_Num_Lock)) 94 || ((keysym) == GDK_Num_Lock))
97 95
211 { 209 {
212 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (emacs_event)); 210 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (emacs_event));
213 if (CONSOLE_GTK_P (XCONSOLE (console))) 211 if (CONSOLE_GTK_P (XCONSOLE (console)))
214 write_c_string 212 write_c_string
215 (pstream, 213 (pstream,
216 gtk_event_name (emacs_event->event.magic.underlying_gdk_event.type)); 214 gtk_event_name (EVENT_MAGIC_GDK_EVENT (emacs_event).type));
217 } 215 }
218 216
219 static int 217 static int
220 emacs_gtk_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) 218 emacs_gtk_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2)
221 { 219 {
222 if (CONSOLE_GTK_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) && 220 if (CONSOLE_GTK_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) &&
223 CONSOLE_GTK_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) 221 CONSOLE_GTK_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2)))))
224 return (!memcmp (&e1->event.magic.underlying_gdk_event, 222 return (!memcmp (&EVENT_MAGIC_GDK_EVENT (e1),
225 &e2->event.magic.underlying_gdk_event, 223 &EVENT_MAGIC_GDK_EVENT (e2),
226 sizeof (GdkEvent))); 224 sizeof (GdkEvent)));
227 if (CONSOLE_GTK_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) || 225 if (CONSOLE_GTK_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) ||
228 CONSOLE_GTK_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) 226 CONSOLE_GTK_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2)))))
229 return 0; 227 return 0;
230 return 1; 228 return 1;
233 static Hashcode 231 static Hashcode
234 emacs_gtk_hash_magic_event (Lisp_Event *e) 232 emacs_gtk_hash_magic_event (Lisp_Event *e)
235 { 233 {
236 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (e)); 234 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (e));
237 if (CONSOLE_GTK_P (XCONSOLE (console))) 235 if (CONSOLE_GTK_P (XCONSOLE (console)))
238 return memory_hash (&e->event.magic.underlying_gdk_event, 236 return memory_hash (&EVENT_MAGIC_GDK_EVENT (e),
239 sizeof (GdkEvent)); 237 sizeof (GdkEvent));
240 return 0; 238 return 0;
241 } 239 }
242 240
243 static void 241 static void
244 emacs_gtk_handle_magic_event (struct Lisp_Event *emacs_event) 242 emacs_gtk_handle_magic_event (struct Lisp_Event *emacs_event)
245 { 243 {
246 /* This function can GC */ 244 /* This function can GC */
247 GdkEvent *event = &emacs_event->event.magic.underlying_gdk_event; 245 GdkEvent *event = &EVENT_MAGIC_GDK_EVENT (emacs_event);
248 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); 246 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event));
249 247
250 if (!FRAME_LIVE_P (f)) 248 if (!FRAME_LIVE_P (f))
251 return; 249 return;
252 250
465 463
466 GCPRO2 (instream, fb_instream); 464 GCPRO2 (instream, fb_instream);
467 while ((ch = Lstream_get_ichar (istr)) != EOF) 465 while ((ch = Lstream_get_ichar (istr)) != EOF)
468 { 466 {
469 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); 467 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil);
470 struct Lisp_Event *ev = XEVENT (emacs_event); 468 Lisp_Event *ev = XEVENT (emacs_event);
471 ev->channel = DEVICE_CONSOLE (d); 469 ev->channel = DEVICE_CONSOLE (d);
472 ev->event_type = key_press_event;
473 ev->timestamp = event->time; 470 ev->timestamp = event->time;
474 ev->event.key.modifiers = 0; 471 XSET_EVENT_TYPE (emacs_event, key_press_event);
475 ev->event.key.keysym = make_char (ch); 472 XSET_EVENT_KEY_MODIFIERS (emacs_event, 0);
476 enqueue_gtk_dispatch_event (emacs_event); 473 XSET_EVENT_KEY_KEYSYM (emacs_event, make_char (ch));
474 enqueue_dispatch_event (emacs_event);
477 } 475 }
478 Lstream_close (istr); 476 Lstream_close (istr);
479 UNGCPRO; 477 UNGCPRO;
480 Lstream_delete (istr); 478 Lstream_delete (istr);
481 Lstream_delete (XLSTREAM (fb_instream)); 479 Lstream_delete (XLSTREAM (fb_instream));
617 gtk_timeout_to_emacs_event (struct Lisp_Event *emacs_event) 615 gtk_timeout_to_emacs_event (struct Lisp_Event *emacs_event)
618 { 616 {
619 struct GTK_timeout *timeout = completed_timeouts; 617 struct GTK_timeout *timeout = completed_timeouts;
620 assert (timeout); 618 assert (timeout);
621 completed_timeouts = completed_timeouts->next; 619 completed_timeouts = completed_timeouts->next;
622 emacs_event->event_type = timeout_event;
623 /* timeout events have nil as channel */ 620 /* timeout events have nil as channel */
624 emacs_event->timestamp = 0; /* #### wrong!! */ 621 set_event_type (emacs_event, timeout_event);
625 emacs_event->event.timeout.interval_id = timeout->id; 622 SET_EVENT_TIMESTAMP_ZERO (emacs_event); /* #### wrong!! */
623 SET_EVENT_TIMEOUT_INTERVAL_ID (emacs_event, timeout->id);
624 SET_EVENT_TIMEOUT_FUNCTION (emacs_event, Qnil);
625 SET_EVENT_TIMEOUT_OBJECT (emacs_event, Qnil);
626 Blocktype_free (the_GTK_timeout_blocktype, timeout); 626 Blocktype_free (the_GTK_timeout_blocktype, timeout);
627 } 627 }
628 628
629 629
630 /************************************************************************/ 630 /************************************************************************/
860 860
861 static void 861 static void
862 gtk_process_to_emacs_event (struct Lisp_Event *emacs_event) 862 gtk_process_to_emacs_event (struct Lisp_Event *emacs_event)
863 { 863 {
864 int i; 864 int i;
865 Lisp_Object process;
866 865
867 assert (process_events_occurred > 0); 866 assert (process_events_occurred > 0);
867
868 for (i = 0; i < MAXDESC; i++) 868 for (i = 0; i < MAXDESC; i++)
869 { 869 {
870 process = filedesc_with_input[i]; 870 Lisp_Object process = filedesc_with_input[i];
871 if (PROCESSP (process)) 871 if (PROCESSP (process))
872 break; 872 {
873 } 873 filedesc_with_input[i] = Qnil;
874 assert (i < MAXDESC); 874 process_events_occurred--;
875 filedesc_with_input[i] = Qnil; 875 /* process events have nil as channel */
876 process_events_occurred--; 876 set_event_type (emacs_event, process_event);
877 /* process events have nil as channel */ 877 SET_EVENT_TIMESTAMP_ZERO (emacs_event); /* #### */
878 emacs_event->event_type = process_event; 878 SET_EVENT_PROCESS_PROCESS (emacs_event, process);
879 emacs_event->timestamp = 0; /* #### */ 879 return;
880 emacs_event->event.process.process = process; 880 }
881 }
882 abort ();
881 } 883 }
882 884
883 static void 885 static void
884 emacs_gtk_select_console (struct console *con) 886 emacs_gtk_select_console (struct console *con)
885 { 887 {
966 Lisp_Object l_dndlist = Qnil, l_item = Qnil; 968 Lisp_Object l_dndlist = Qnil, l_item = Qnil;
967 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 969 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
968 970
969 GCPRO4 (l_type, l_data, l_dndlist, l_item); 971 GCPRO4 (l_type, l_data, l_dndlist, l_item);
970 972
971 ev->event_type = misc_user_event; 973 set_event_type (ev, misc_user_event);
972 ev->timestamp = time; 974 SET_EVENT_CHANNEL (ev, wrap_frame (f));
973 975 SET_EVENT_TIMESTAMP (ev, time);
974 ev->channel = wrap_frame (f); 976 SET_EVENT_MISC_USER_X (ev, x);
975 977 SET_EVENT_MISC_USER_Y (ev, y);
976 ev->event.misc.x = x;
977 ev->event.misc.y = y;
978 978
979 if (data->type == preferred_targets[TARGET_URI_LIST]) 979 if (data->type == preferred_targets[TARGET_URI_LIST])
980 { 980 {
981 /* newline-separated list of URLs */ 981 /* newline-separated list of URLs */
982 int start, end; 982 int start, end;
1032 build_string ("8bit"), 1032 build_string ("8bit"),
1033 make_ext_string ((Extbyte *) data->data, 1033 make_ext_string ((Extbyte *) data->data,
1034 data->length, Qbinary))); 1034 data->length, Qbinary)));
1035 } 1035 }
1036 1036
1037 ev->event.misc.function = Qdragdrop_drop_dispatch; 1037
1038 ev->event.misc.object = Fcons (l_type, l_dndlist); 1038 SET_EVENT_MISC_USER_FUNCTION (ev, Qdragdrop_drop_dispatch);
1039 SET_EVENT_MISC_USER_OBJECT (ev, Fcons (l_type, l_dndlist));
1039 1040
1040 UNGCPRO; 1041 UNGCPRO;
1041 1042
1042 gtk_drag_finish (context, TRUE, FALSE, time); 1043 gtk_drag_finish (context, TRUE, FALSE, time);
1043 enqueue_gtk_dispatch_event (event); 1044 enqueue_dispatch_event (event);
1044 } 1045 }
1045 1046
1046 gboolean 1047 gboolean
1047 dragndrop_dropped (GtkWidget *widget, 1048 dragndrop_dropped (GtkWidget *widget,
1048 GdkDragContext *drag_context, 1049 GdkDragContext *drag_context,
1120 1121
1121 /************************************************************************/ 1122 /************************************************************************/
1122 /* get the next event from gtk */ 1123 /* get the next event from gtk */
1123 /************************************************************************/ 1124 /************************************************************************/
1124 1125
1125 static Lisp_Object dispatch_event_queue, dispatch_event_queue_tail;
1126
1127 static void
1128 enqueue_gtk_dispatch_event (Lisp_Object event)
1129 {
1130 enqueue_event (event, &dispatch_event_queue, &dispatch_event_queue_tail);
1131 }
1132
1133 static Lisp_Object
1134 dequeue_gtk_dispatch_event (void)
1135 {
1136 return dequeue_event (&dispatch_event_queue, &dispatch_event_queue_tail);
1137 }
1138
1139 /* This business exists because menu events "happen" when 1126 /* This business exists because menu events "happen" when
1140 menubar_selection_callback() is called from somewhere deep 1127 menubar_selection_callback() is called from somewhere deep
1141 within XtAppProcessEvent in emacs_Xt_next_event(). The 1128 within XtAppProcessEvent in emacs_Xt_next_event(). The
1142 callback needs to terminate the modal loop in that function 1129 callback needs to terminate the modal loop in that function
1143 or else it will continue waiting until another event is 1130 or else it will continue waiting until another event is
1149 signal_special_gtk_user_event (Lisp_Object channel, Lisp_Object function, 1136 signal_special_gtk_user_event (Lisp_Object channel, Lisp_Object function,
1150 Lisp_Object object) 1137 Lisp_Object object)
1151 { 1138 {
1152 Lisp_Object event = Fmake_event (Qnil, Qnil); 1139 Lisp_Object event = Fmake_event (Qnil, Qnil);
1153 1140
1154 XEVENT (event)->event_type = misc_user_event; 1141 XSET_EVENT_TYPE (event, misc_user_event);
1155 XEVENT (event)->channel = channel; 1142 XSET_EVENT_CHANNEL (event, channel);
1156 XEVENT (event)->event.eval.function = function; 1143 XSET_EVENT_MISC_USER_FUNCTION (event, function);
1157 XEVENT (event)->event.eval.object = object; 1144 XSET_EVENT_MISC_USER_OBJECT (event, object);
1158 1145 enqueue_dispatch_event (event);
1159 enqueue_gtk_dispatch_event (event);
1160 } 1146 }
1161 1147
1162 static void 1148 static void
1163 emacs_gtk_next_event (struct Lisp_Event *emacs_event) 1149 emacs_gtk_next_event (struct Lisp_Event *emacs_event)
1164 { 1150 {
1175 1161
1176 if (!NILP (dispatch_event_queue)) 1162 if (!NILP (dispatch_event_queue))
1177 { 1163 {
1178 Lisp_Object event, event2; 1164 Lisp_Object event, event2;
1179 event2 = wrap_event (emacs_event); 1165 event2 = wrap_event (emacs_event);
1180 event = dequeue_gtk_dispatch_event (); 1166 event = dequeue_dispatch_event ();
1181 Fcopy_event (event, event2); 1167 Fcopy_event (event, event2);
1182 Fdeallocate_event (event); 1168 Fdeallocate_event (event);
1183 } 1169 }
1184 else if (tty_events_occurred) 1170 else if (tty_events_occurred)
1185 { 1171 {
1191 else if (fake_event_occurred) 1177 else if (fake_event_occurred)
1192 { 1178 {
1193 /* A dummy event, so that a cycle of the command loop will occur. */ 1179 /* A dummy event, so that a cycle of the command loop will occur. */
1194 fake_event_occurred = 0; 1180 fake_event_occurred = 0;
1195 /* eval events have nil as channel */ 1181 /* eval events have nil as channel */
1196 emacs_event->event_type = eval_event; 1182 set_event_type (emacs_event, eval_event);
1197 emacs_event->event.eval.function = Qidentity; 1183 SET_EVENT_EVAL_FUNCTION (emacs_event, Qidentity);
1198 emacs_event->event.eval.object = Qnil; 1184 SET_EVENT_EVAL_OBJECT (emacs_event, Qnil);
1199 } 1185 }
1200 else /* if (process_events_occurred) */ 1186 else /* if (process_events_occurred) */
1201 gtk_process_to_emacs_event (emacs_event); 1187 gtk_process_to_emacs_event (emacs_event);
1202 } 1188 }
1203 1189
1374 { 1360 {
1375 modifiers &= ~XEMACS_MOD_SHIFT; 1361 modifiers &= ~XEMACS_MOD_SHIFT;
1376 } 1362 }
1377 } 1363 }
1378 1364
1379 emacs_event->event_type = key_press_event; 1365 set_event_type (emacs_event, key_press_event);
1380 emacs_event->timestamp = key_event->time; 1366 SET_EVENT_TIMESTAMP (emacs_event, key_event->time);
1381 emacs_event->event.key.modifiers = modifiers; 1367 SET_EVENT_KEY_MODIFIERS (emacs_event, modifiers);
1382 emacs_event->event.key.keysym = keysym; 1368 SET_EVENT_KEY_KEYSYM (emacs_event, keysym);
1383 } 1369 }
1384 else /* Mouse press/release event */ 1370 else /* Mouse press/release event */
1385 { 1371 {
1386 GdkEventButton *button_event = &gdk_event->button; 1372 GdkEventButton *button_event = &gdk_event->button;
1387 emacs_event->channel = wrap_frame (frame); 1373
1388 1374 set_event_type (emacs_event,
1389 emacs_event->event_type = (button_event->type == GDK_BUTTON_RELEASE) ? 1375 button_event->type == GDK_BUTTON_RELEASE ?
1390 button_release_event : button_press_event; 1376 button_release_event : button_press_event);
1391 1377 SET_EVENT_CHANNEL (emacs_event, wrap_frame (frame));
1392 emacs_event->event.button.modifiers = modifiers; 1378
1393 emacs_event->timestamp = button_event->time; 1379 SET_EVENT_BUTTON_MODIFIERS (emacs_event, modifiers);
1394 emacs_event->event.button.button = button_event->button; 1380 SET_EVENT_TIMESTAMP (emacs_event, button_event->time);
1395 emacs_event->event.button.x = button_event->x; 1381 SET_EVENT_BUTTON_BUTTON (emacs_event, button_event->button);
1396 emacs_event->event.button.y = button_event->y; 1382 SET_EVENT_BUTTON_X (emacs_event, button_event->x);
1383 SET_EVENT_BUTTON_Y (emacs_event, button_event->y);
1397 } 1384 }
1398 } 1385 }
1399 break; 1386 break;
1400 case GDK_KEY_RELEASE: 1387 case GDK_KEY_RELEASE:
1401 return 0; 1388 return 0;
1417 waiting for us next time around. */ 1404 waiting for us next time around. */
1418 gdk_window_get_pointer (ev->window, &x, &y, &mask); 1405 gdk_window_get_pointer (ev->window, &x, &y, &mask);
1419 1406
1420 DEVICE_GTK_MOUSE_TIMESTAMP (d) = ev->time; 1407 DEVICE_GTK_MOUSE_TIMESTAMP (d) = ev->time;
1421 1408
1422 emacs_event->channel = wrap_frame (frame); 1409 SET_EVENT_CHANNEL (emacs_event, wrap_frame (frame));
1423 emacs_event->event_type = pointer_motion_event; 1410 set_event_type (emacs_event, pointer_motion_event);
1424 emacs_event->timestamp = ev->time; 1411 SET_EVENT_TIMESTAMP (emacs_event, ev->time);
1425 emacs_event->event.motion.x = x; 1412 SET_EVENT_MOTION_X (emacs_event, x);
1426 emacs_event->event.motion.y = y; 1413 SET_EVENT_MOTION_Y (emacs_event, y);
1414
1427 if (mask & GDK_SHIFT_MASK) modifiers |= XEMACS_MOD_SHIFT; 1415 if (mask & GDK_SHIFT_MASK) modifiers |= XEMACS_MOD_SHIFT;
1428 if (mask & GDK_CONTROL_MASK) modifiers |= XEMACS_MOD_CONTROL; 1416 if (mask & GDK_CONTROL_MASK) modifiers |= XEMACS_MOD_CONTROL;
1429 if (mask & gd->MetaMask) modifiers |= XEMACS_MOD_META; 1417 if (mask & gd->MetaMask) modifiers |= XEMACS_MOD_META;
1430 if (mask & gd->SuperMask) modifiers |= XEMACS_MOD_SUPER; 1418 if (mask & gd->SuperMask) modifiers |= XEMACS_MOD_SUPER;
1431 if (mask & gd->HyperMask) modifiers |= XEMACS_MOD_HYPER; 1419 if (mask & gd->HyperMask) modifiers |= XEMACS_MOD_HYPER;
1436 if (mask & GDK_BUTTON4_MASK) modifiers |= XEMACS_MOD_BUTTON4; 1424 if (mask & GDK_BUTTON4_MASK) modifiers |= XEMACS_MOD_BUTTON4;
1437 if (mask & GDK_BUTTON5_MASK) modifiers |= XEMACS_MOD_BUTTON5; 1425 if (mask & GDK_BUTTON5_MASK) modifiers |= XEMACS_MOD_BUTTON5;
1438 1426
1439 /* Currently ignores Shift_Lock but probably shouldn't 1427 /* Currently ignores Shift_Lock but probably shouldn't
1440 (but it definitely should ignore Caps_Lock). */ 1428 (but it definitely should ignore Caps_Lock). */
1441 emacs_event->event.motion.modifiers = modifiers; 1429 SET_EVENT_MOTION_MODIFIERS (emacs_event, modifiers);
1442 } 1430 }
1443 break; 1431 break;
1444 1432
1445 default: /* it's a magic event */ 1433 default: /* it's a magic event */
1446 return (0); 1434 return (0);
1463 1451
1464 emacs_event = Fmake_event (Qnil, Qnil); 1452 emacs_event = Fmake_event (Qnil, Qnil);
1465 1453
1466 if (gtk_event_to_emacs_event (GTK_XEMACS_FRAME (widget), event, XEVENT (emacs_event))) 1454 if (gtk_event_to_emacs_event (GTK_XEMACS_FRAME (widget), event, XEVENT (emacs_event)))
1467 { 1455 {
1468 enqueue_gtk_dispatch_event (emacs_event); 1456 enqueue_dispatch_event (emacs_event);
1469 return (TRUE); 1457 return (TRUE);
1470 } 1458 }
1471 else 1459 else
1472 { 1460 {
1473 Fdeallocate_event (emacs_event); 1461 Fdeallocate_event (emacs_event);
1496 gpointer closure) 1484 gpointer closure)
1497 { 1485 {
1498 struct frame *frame = (struct frame *) closure; 1486 struct frame *frame = (struct frame *) closure;
1499 Lisp_Object lisp_event = Fmake_event (Qnil, Qnil); 1487 Lisp_Object lisp_event = Fmake_event (Qnil, Qnil);
1500 struct Lisp_Event *emacs_event = XEVENT (lisp_event); 1488 struct Lisp_Event *emacs_event = XEVENT (lisp_event);
1501 GdkEvent *gdk_event_copy = &emacs_event->event.magic.underlying_gdk_event; 1489 GdkEvent *gdk_event_copy = &EVENT_MAGIC_GDK_EVENT (emacs_event);
1502 struct device *d = XDEVICE (FRAME_DEVICE (frame)); 1490 struct device *d = XDEVICE (FRAME_DEVICE (frame));
1503 gboolean ignore_p = FALSE; 1491 gboolean ignore_p = FALSE;
1504 1492
1505 set_last_server_timestamp (d, event); 1493 set_last_server_timestamp (d, event);
1506 1494
1537 Fdeallocate_event (lisp_event); 1525 Fdeallocate_event (lisp_event);
1538 return (FALSE); 1526 return (FALSE);
1539 } 1527 }
1540 else 1528 else
1541 { 1529 {
1542 enqueue_gtk_dispatch_event (lisp_event); 1530 enqueue_dispatch_event (lisp_event);
1543 return (TRUE); 1531 return (TRUE);
1544 } 1532 }
1545 } 1533 }
1546 1534
1547 1535
1548 /************************************************************************/ 1536 /************************************************************************/
1549 /* input pending / C-g checking */ 1537 /* input pending / C-g checking */
1550 /************************************************************************/ 1538 /************************************************************************/
1551 static void
1552 gtk_check_for_quit_char (struct device *d);
1553
1554 static void
1555 check_for_tty_quit_char (struct device *d)
1556 {
1557 SELECT_TYPE temp_mask;
1558 int infd = DEVICE_INFD (d);
1559 struct console *con = XCONSOLE (DEVICE_CONSOLE (d));
1560 Ichar quit_char = CONSOLE_QUIT_CHAR (con);
1561
1562 FD_ZERO (&temp_mask);
1563 FD_SET (infd, &temp_mask);
1564
1565 while (1)
1566 {
1567 Lisp_Object event;
1568 Ichar the_char;
1569
1570 if (!poll_fds_for_input (temp_mask))
1571 return;
1572
1573 event = Fmake_event (Qnil, Qnil);
1574 if (!read_event_from_tty_or_stream_desc (XEVENT (event), con))
1575 /* EOF, or something ... */
1576 return;
1577 /* #### bogus. quit-char should be allowed to be any sort
1578 of event. */
1579 the_char = event_to_character (XEVENT (event), 1, 0, 0);
1580 if (the_char >= 0 && the_char == quit_char)
1581 {
1582 Vquit_flag = Qt;
1583 /* do not queue the C-g. See above. */
1584 return;
1585 }
1586
1587 /* queue the read event to be read for real later. */
1588 enqueue_gtk_dispatch_event (event);
1589 }
1590 }
1591
1592 static void
1593 emacs_gtk_quit_p (void)
1594 {
1595 Lisp_Object devcons, concons;
1596
1597 CONSOLE_LOOP (concons)
1598 {
1599 struct console *con = XCONSOLE (XCAR (concons));
1600 if (!con->input_enabled)
1601 continue;
1602
1603 CONSOLE_DEVICE_LOOP (devcons, con)
1604 {
1605 struct device *d;
1606 d = XDEVICE (XCAR (devcons));
1607
1608 if (DEVICE_GTK_P (d))
1609 /* emacs may be exiting */
1610 gtk_check_for_quit_char (d);
1611 else if (DEVICE_TTY_P (d))
1612 check_for_tty_quit_char (d);
1613 }
1614 }
1615 }
1616 1539
1617 #include <gdk/gdkx.h> 1540 #include <gdk/gdkx.h>
1618 1541
1619 static void 1542 static void
1620 drain_gtk_queue (void) 1543 emacs_gtk_drain_queue (void)
1621 1544
1622 { 1545 {
1623 /* We can't just spin through here and wait for GTKs idea of the 1546 /* We can't just spin through here and wait for GTKs idea of the
1624 event queue to get empty, or the queue never gets drained. The 1547 event queue to get empty, or the queue never gets drained. The
1625 situation is as follows. A process event gets signalled, we put 1548 situation is as follows. A process event gets signalled, we put
1626 it on the queue, then we go into Fnext_event(), which calls 1549 it on the queue, then we go into Fnext_event(), which calls
1627 drain_gtk_queue(). But gtk_events_pending() will always return 1550 emacs_gtk_drain_queue(). But gtk_events_pending() will always return
1628 TRUE if there are file-descriptor (aka our process) events 1551 TRUE if there are file-descriptor (aka our process) events
1629 pending. Using GDK_events_pending() only shows us windowing 1552 pending. Using GDK_events_pending() only shows us windowing
1630 system events. 1553 system events.
1631 */ 1554 */
1632 if (GDK_DISPLAY ()) 1555 if (GDK_DISPLAY ())
1633 while (gdk_events_pending ()) 1556 while (gdk_events_pending ())
1634 gtk_main_iteration (); 1557 gtk_main_iteration ();
1558
1559 drain_tty_devices ();
1635 } 1560 }
1636 1561
1637 static int 1562 static int
1638 emacs_gtk_event_pending_p (int user_p) 1563 emacs_gtk_event_pending_p (int user_p)
1639 { 1564 {
1735 /* We need to drain the entire queue now -- if we only 1660 /* We need to drain the entire queue now -- if we only
1736 drain part of it, we may later on end up with events 1661 drain part of it, we may later on end up with events
1737 actually pending but detect_input_pending() returning 1662 actually pending but detect_input_pending() returning
1738 false because there wasn't another SIGIO. */ 1663 false because there wasn't another SIGIO. */
1739 1664
1740 drain_gtk_queue (); 1665 emacs_gtk_drain_queue ();
1741 1666
1742 EVENT_CHAIN_LOOP (event, dispatch_event_queue) 1667 EVENT_CHAIN_LOOP (event, dispatch_event_queue)
1743 if (!user_p || command_event_p (event)) 1668 if (!user_p || command_event_p (event))
1744 return 1; 1669 return 1;
1745 } 1670 }
1767 DEFSYMBOL (Qsans_modifiers); 1692 DEFSYMBOL (Qsans_modifiers);
1768 } 1693 }
1769 1694
1770 void reinit_vars_of_event_gtk (void) 1695 void reinit_vars_of_event_gtk (void)
1771 { 1696 {
1772 gtk_event_stream = xnew (struct event_stream); 1697 gtk_event_stream = xnew_and_zero (struct event_stream);
1773 gtk_event_stream->event_pending_p = emacs_gtk_event_pending_p; 1698 gtk_event_stream->event_pending_p = emacs_gtk_event_pending_p;
1774 gtk_event_stream->next_event_cb = emacs_gtk_next_event; 1699 gtk_event_stream->next_event_cb = emacs_gtk_next_event;
1775 gtk_event_stream->handle_magic_event_cb= emacs_gtk_handle_magic_event; 1700 gtk_event_stream->handle_magic_event_cb= emacs_gtk_handle_magic_event;
1776 gtk_event_stream->format_magic_event_cb= emacs_gtk_format_magic_event; 1701 gtk_event_stream->format_magic_event_cb= emacs_gtk_format_magic_event;
1777 gtk_event_stream->compare_magic_event_cb= emacs_gtk_compare_magic_event; 1702 gtk_event_stream->compare_magic_event_cb= emacs_gtk_compare_magic_event;
1780 gtk_event_stream->remove_timeout_cb = emacs_gtk_remove_timeout; 1705 gtk_event_stream->remove_timeout_cb = emacs_gtk_remove_timeout;
1781 gtk_event_stream->select_console_cb = emacs_gtk_select_console; 1706 gtk_event_stream->select_console_cb = emacs_gtk_select_console;
1782 gtk_event_stream->unselect_console_cb = emacs_gtk_unselect_console; 1707 gtk_event_stream->unselect_console_cb = emacs_gtk_unselect_console;
1783 gtk_event_stream->select_process_cb = emacs_gtk_select_process; 1708 gtk_event_stream->select_process_cb = emacs_gtk_select_process;
1784 gtk_event_stream->unselect_process_cb = emacs_gtk_unselect_process; 1709 gtk_event_stream->unselect_process_cb = emacs_gtk_unselect_process;
1785 gtk_event_stream->quit_p_cb = emacs_gtk_quit_p; 1710 gtk_event_stream->drain_queue_cb = emacs_gtk_drain_queue;
1786 gtk_event_stream->create_io_streams_cb= emacs_gtk_create_io_streams; 1711 gtk_event_stream->create_io_streams_cb= emacs_gtk_create_io_streams;
1787 gtk_event_stream->delete_io_streams_cb= emacs_gtk_delete_io_streams; 1712 gtk_event_stream->delete_io_streams_cb= emacs_gtk_delete_io_streams;
1788 gtk_event_stream->force_event_pending = emacs_gtk_force_event_pending; 1713 gtk_event_stream->force_event_pending_cb= emacs_gtk_force_event_pending;
1789 1714
1790 the_GTK_timeout_blocktype = Blocktype_new (struct GTK_timeout_blocktype); 1715 the_GTK_timeout_blocktype = Blocktype_new (struct GTK_timeout_blocktype);
1791 1716
1792 /* this function only makes safe calls */ 1717 /* this function only makes safe calls */
1793 init_what_input_once (); 1718 init_what_input_once ();
1795 1720
1796 void 1721 void
1797 vars_of_event_gtk (void) 1722 vars_of_event_gtk (void)
1798 { 1723 {
1799 reinit_vars_of_event_gtk (); 1724 reinit_vars_of_event_gtk ();
1800
1801 dispatch_event_queue = Qnil;
1802 staticpro (&dispatch_event_queue);
1803 dispatch_event_queue_tail = Qnil;
1804 staticpro (&dispatch_event_queue_tail);
1805 1725
1806 DEFVAR_BOOL ("gtk-allow-sendevents", &gtk_allow_sendevents /* 1726 DEFVAR_BOOL ("gtk-allow-sendevents", &gtk_allow_sendevents /*
1807 *Non-nil means to allow synthetic events. Nil means they are ignored. 1727 *Non-nil means to allow synthetic events. Nil means they are ignored.
1808 Beware: allowing emacs to process SendEvents opens a big security hole. 1728 Beware: allowing emacs to process SendEvents opens a big security hole.
1809 */ ); 1729 */ );
2136 syms [i] == XK_Mode_switch) /* why doesn't IsModifierKey count this? */ 2056 syms [i] == XK_Mode_switch) /* why doesn't IsModifierKey count this? */
2137 return 1; 2057 return 1;
2138 return 0; 2058 return 0;
2139 } 2059 }
2140 #endif 2060 #endif
2141
2142 struct _quit_predicate_closure {
2143 struct device *device;
2144 Bool *critical;
2145 };
2146
2147 static Bool
2148 quit_char_predicate (Display *display, XEvent *event, XPointer data)
2149 {
2150 struct _quit_predicate_closure *cl = (struct _quit_predicate_closure *) data;
2151 struct device *d = cl->device;
2152 struct frame *f = NULL;
2153 struct gtk_device *gd = DEVICE_GTK_DATA (d);
2154 char c, quit_char;
2155 Bool *critical = cl->critical;
2156 Lisp_Object keysym;
2157 GdkWindow *window = gdk_window_lookup (event->xany.window);
2158 guint32 keycode = 0;
2159 GdkEventKey gdk_event;
2160
2161 if (window)
2162 f = gtk_any_window_to_frame (d, window);
2163
2164 if (critical)
2165 *critical = False;
2166
2167 if ((event->type != KeyPress) ||
2168 (! window) ||
2169 (! f) ||
2170 (event->xkey.state
2171 & (gd->MetaMask | gd->HyperMask | gd->SuperMask | gd->AltMask)))
2172 {
2173 return 0;
2174 }
2175
2176 {
2177 char dummy[256];
2178 XLookupString (&(event->xkey), dummy, 200, (KeySym *)&keycode, 0);
2179 }
2180
2181 memset (&gdk_event, 0, sizeof (gdk_event));
2182 gdk_event.type = GDK_KEY_PRESS;
2183 gdk_event.window = window;
2184 gdk_event.keyval = keycode;
2185 gdk_event.state = event->xkey.state;
2186
2187 /* This duplicates some code that exists elsewhere, but it's relatively
2188 fast and doesn't cons. */
2189 keysym = gtk_to_emacs_keysym (d, &gdk_event, 1);
2190 if (NILP (keysym)) return 0;
2191 if (CHAR_OR_CHAR_INTP (keysym))
2192 c = XCHAR_OR_CHAR_INT (keysym);
2193 /* Highly doubtful that these are the quit character, but... */
2194 else if (EQ (keysym, QKbackspace)) c = '\b';
2195 else if (EQ (keysym, QKtab)) c = '\t';
2196 else if (EQ (keysym, QKlinefeed)) c = '\n';
2197 else if (EQ (keysym, QKreturn)) c = '\r';
2198 else if (EQ (keysym, QKescape)) c = 27;
2199 else if (EQ (keysym, QKspace)) c = ' ';
2200 else if (EQ (keysym, QKdelete)) c = 127;
2201 else return 0;
2202
2203 if (event->xkey.state & gd->MetaMask) c |= 0x80;
2204 if ((event->xkey.state & ControlMask) && !(c >= 'A' && c <= 'Z'))
2205 c &= 0x1F; /* unshifted control characters */
2206 quit_char = CONSOLE_QUIT_CHAR (XCONSOLE (DEVICE_CONSOLE (d)));
2207
2208 if (c == quit_char)
2209 return True;
2210 /* If we've got Control-Shift-G instead of Control-G, that means
2211 we have a critical_quit. Caps_Lock is its own modifier, so it
2212 won't cause ^G to act differently than before. */
2213 if (event->xkey.state & ControlMask) c &= 0x1F;
2214 if (c == quit_char)
2215 {
2216 if (critical) *critical = True;
2217 return True;
2218 }
2219 return False;
2220 }
2221
2222 static void
2223 gtk_check_for_quit_char (struct device *d)
2224 {
2225 XEvent event;
2226 int queued;
2227 Bool critical_quit = False;
2228 struct _quit_predicate_closure closure;
2229
2230 XEventsQueued (GDK_DISPLAY (), QueuedAfterReading);
2231
2232 closure.device = d;
2233 closure.critical = &critical_quit;
2234
2235 queued = XCheckIfEvent (GDK_DISPLAY (), &event, quit_char_predicate, (char *) &closure);
2236
2237 if (queued)
2238 {
2239 Vquit_flag = (critical_quit ? Qcritical : Qt);
2240 }
2241 }