annotate src/w32inevt.c @ 112364:42e22c4f06b7

Move all DEFVAR'd globals into a structure -- threading infrastructure * globals.h: New file. * xterm.h (Vx_pixel_size_width_font_regexp): Remove declaration. * window.h (Vinitial_window_system, Vminibuf_scroll_window) (Vwindow_system_version): Remove declaration. * w32term.h (Vw32_enable_palette) (Vx_pixel_size_width_font_regexp): Remove declaration. * w32menu.c (Voverriding_local_map) (Voverriding_local_map_menu_flag): Remove declaration. * w32inevt.c (Vw32_alt_is_meta, Vw32_apps_modifier) (Vw32_capslock_is_shiftlock, Vw32_enable_caps_lock) (Vw32_enable_num_lock, Vw32_lwindow_modifier) (Vw32_pass_lwindow_to_system, Vw32_pass_rwindow_to_system) (Vw32_phantom_key_code, Vw32_recognize_altgr) (Vw32_rwindow_modifier, Vw32_scroll_lock_modifier) (w32_use_full_screen_buffer): Remove declaration. * w32.c (Vsystem_configuration, Vw32_downcase_file_names) (Vw32_generate_fake_inodes, Vw32_get_true_file_attributes) (w32_num_mouse_buttons, w32_pipe_read_delay): Remove declaration. * termopts.h (Vtruncate_partial_width_windows, inverse_video) (no_redraw_on_reenter, visible_bell): Remove declaration. * sysdep.c (Vsystem_name): Remove declaration. * syntax.h (parse_sexp_lookup_properties): Remove declaration. * menu.h (Vmenu_updating_frame): Remove declaration. * macros.h (Vexecuting_kbd_macro, executing_kbd_macro_index): Remove declaration. * lisp.h (Vafter_init_time, Vafter_load_alist) (Vauto_save_list_file_name, Vbefore_init_time, Vcommand_history) (Vcompletion_regexp_list, Vcurrent_load_list) (Vcurrent_prefix_arg, Vdata_directory, Vdebug_on_error) (Vdoc_directory, Vdoc_file_name, Vdynamic_library_alist) (Vexec_directory, Vexec_path, Vexec_suffixes) (Vface_font_rescale_alist, Vface_ignored_fonts, Vfeatures) (Vhelp_form, Vhistory_length, Vinhibit_field_text_motion) (Vinhibit_quit, Vinhibit_read_only, Vinhibit_redisplay) (Vinstallation_directory, Vinvocation_directory) (Vinvocation_name, Vload_file_rep_suffixes, Vload_history) (Vload_suffixes, Vmark_even_if_inactive, Vmemory_full) (Vmessage_log_max, Vobarray, Vprint_length, Vprint_level) (Vpurify_flag, Vquit_flag, Vsaved_region_selection) (Vscalable_fonts_allowed, Vselect_active_regions) (Vshell_file_name, Vstandard_input, Vstandard_output) (Vsystem_name, Vtemporary_file_directory, Vthrow_on_input) (Vtop_level, Vtty_erase_char, Vundo_outer_limit) (Vuser_login_name, Vwindow_scroll_functions) (Vwindow_system_version, Vx_no_window_manager) (Vx_resource_class, Vx_resource_name, baud_rate) (completion_ignore_case, debug_on_next_call, gc_cons_threshold) (history_delete_duplicates, inhibit_x_resources) (last_nonmenu_event, load_in_progress, max_specpdl_size) (minibuffer_auto_raise, print_escape_newlines, scroll_margin) (use_dialog_box, use_file_dialog): Remove declaration. Include globals.h. * keymap.h (Voverriding_local_map) (Voverriding_local_map_menu_flag, meta_prefix_char): Remove declaration. * keyboard.h (Vdouble_click_time, Vfunction_key_map) (Vinput_method_function, Vkey_translation_map) (Vlucid_menu_bar_dirty_flag, Vthis_original_command) (do_mouse_tracking, extra_keyboard_modifiers) (num_nonmacro_input_events): Remove declaration. * intervals.h (Vchar_property_alias_alist) (Vdefault_text_properties, Vinhibit_point_motion_hooks) (Vtext_property_default_nonsticky): Remove declaration. * gtkutil.h (x_gtk_file_dialog_help_text) (x_gtk_show_hidden_files, x_gtk_use_old_file_dialog) (x_gtk_whole_detached_tool_bar): Remove declaration. * frame.h (Vdefault_frame_alist, Vframe_alpha_lower_limit) (Vmenu_bar_mode, Vmouse_highlight, Vterminal_frame) (Vtool_bar_mode, Vx_resource_class, Vx_resource_name) (focus_follows_mouse): Remove declaration. * fontset.h (Valternate_fontname_alist, Vfontset_alias_alist) (Vignore_relative_composition, Votf_script_alist) (Vuse_default_ascent, Vvertical_centering_font_regexp): Remove declaration. * font.h (Vfont_log): Remove declaration. * dosfns.h (Vdos_display_scancodes, Vdos_version) (Vdos_windows_version, dos_codepage, dos_country_code) (dos_decimal_point, dos_hyper_key, dos_keyboard_layout) (dos_keypad_mode, dos_super_key, dos_timezone_offset): Remove declaration. * disptab.h (Vglyph_table, Vstandard_display_table): Remove declaration. * dispextern.h (Vface_remapping_alist, Vglyphless_char_display) (Vmouse_autoselect_window, Voverflow_newline_into_fringe) (Vshow_trailing_whitespace, Vtool_bar_button_margin) (Vtool_bar_style, cursor_in_echo_area, display_hourglass_p) (inverse_video, mode_line_in_non_selected_windows) (tool_bar_button_relief, tool_bar_max_label_size) (underline_minimum_offset) (unibyte_display_via_language_environment, x_stretch_cursor_p): Remove declaration. * composite.h (Vauto_composition_function) (Vcomposition_function_table): Remove declaration. * commands.h (Vexecuting_kbd_macro) (Vminibuffer_local_completion_map) (Vminibuffer_local_filename_completion_map) (Vminibuffer_local_filename_must_match_map) (Vminibuffer_local_map, Vminibuffer_local_must_match_map) (Vminibuffer_local_ns_map, Vthis_command) (Vunread_command_events, cursor_in_echo_area) (last_command_event, last_nonmenu_event, unread_command_char): Remove declaration. * coding.h (Vcoding_system_for_read, Vcoding_system_for_write) (Vdefault_file_name_coding_system) (Vdefault_process_coding_system, Vfile_name_coding_system) (Vlast_coding_system_used, Vlocale_coding_system) (Vselect_safe_coding_system_function) (Vtranslation_table_for_input, coding_system_require_warning) (eol_mnemonic_dos, eol_mnemonic_mac, eol_mnemonic_undecided) (eol_mnemonic_unix, inherit_process_coding_system): Remove declaration. * charset.h (Vcharset_list, Vcurrent_iso639_language): Remove declaration. * character.h (Vauto_fill_chars, Vchar_direction_table) (Vchar_script_table, Vchar_width_table, Vprintable_chars) (Vscript_representative_chars, Vtranslation_table_vector) (Vunicode_category_table): Remove declaration. * ccl.h (Vfont_ccl_encoder_alist): Remove declaration. * buffer.h (Vafter_change_functions, Vbefore_change_functions) (Vdeactivate_mark, Vfirst_change_hook, Vtransient_mark_mode) (inhibit_modification_hooks): Remove declaration. * xterm.c (syms_of_xterm): Update. (Vx_alt_keysym, Vx_hyper_keysym, Vx_keysym_table) (Vx_meta_keysym, Vx_super_keysym, Vx_toolkit_scroll_bars) (x_mouse_click_focus_ignore_position) (x_underline_at_descent_line) (x_use_underline_position_properties): Remove. * xsmfns.c (syms_of_xsmfns): Update. (Vx_session_id, Vx_session_previous_id): Remove. * xsettings.c (syms_of_xsettings): Update. (Vxft_settings, use_system_font): Remove. * xselect.c (syms_of_xselect): Update. (Vselection_converter_alist, Vx_lost_selection_functions) (Vx_sent_selection_functions, x_selection_timeout): Remove. * xfns.c (syms_of_xfns): Update. (Vgtk_version_string, Vmotif_version_string) (Vx_cursor_fore_pixel, Vx_hourglass_pointer_shape) (Vx_max_tooltip_size, Vx_mode_pointer_shape) (Vx_no_window_manager, Vx_nontext_pointer_shape) (Vx_pixel_size_width_font_regexp, Vx_pointer_shape) (Vx_sensitive_text_pointer_shape) (Vx_window_horizontal_drag_shape, x_gtk_file_dialog_help_text) (x_gtk_show_hidden_files, x_gtk_use_old_file_dialog) (x_gtk_use_system_tooltips, x_gtk_whole_detached_tool_bar): Remove. * xfaces.c (syms_of_xfaces): Update. (Vface_default_stipple, Vface_font_rescale_alist) (Vface_ignored_fonts, Vface_new_frame_defaults) (Vface_remapping_alist, Vfont_list_limit) (Vscalable_fonts_allowed, Vtty_defined_color_alist): Remove. * xdisp.c (syms_of_xdisp): Update. (Vauto_resize_tool_bars, Vblink_cursor_alist) (Vdisplay_pixels_per_inch, Vfontification_functions) (Vframe_title_format, Vglobal_mode_string) (Vglyphless_char_display, Vhourglass_delay, Vhscroll_step) (Vicon_title_format, Vinhibit_redisplay) (Vline_number_display_limit, Vline_prefix) (Vmax_mini_window_height, Vmenu_bar_update_hook) (Vmenu_updating_frame, Vmessage_log_max) (Vmouse_autoselect_window, Vnobreak_char_display) (Voverlay_arrow_position, Voverlay_arrow_string) (Voverlay_arrow_variable_list, Vredisplay_end_trigger_functions) (Vresize_mini_windows, Vshow_trailing_whitespace) (Vtool_bar_border, Vtool_bar_button_margin, Vtool_bar_style) (Vtruncate_partial_width_windows, Vvoid_text_area_pointer) (Vwindow_scroll_functions, Vwindow_size_change_functions) (Vwindow_text_change_functions, Vwrap_prefix) (auto_raise_tool_bar_buttons_p, automatic_hscrolling_p) (debug_end_pos, display_hourglass_p, emacs_scroll_step) (highlight_nonselected_windows, hscroll_margin) (inhibit_eval_during_redisplay, inhibit_free_realized_faces) (inhibit_menubar_update, inhibit_try_cursor_movement) (inhibit_try_window_id, inhibit_try_window_reusing) (line_number_display_limit_width) (make_cursor_line_fully_visible_p, message_truncate_lines) (mode_line_inverse_video, multiple_frames, overline_margin) (scroll_conservatively, scroll_margin, tool_bar_button_relief) (tool_bar_max_label_size, underline_minimum_offset) (unibyte_display_via_language_environment, x_stretch_cursor_p): Remove. * window.c (syms_of_window): Update. (Vminibuf_scroll_window, Vother_window_scroll_buffer) (Vrecenter_redisplay, Vscroll_preserve_screen_position) (Vtemp_buffer_show_function, Vwindow_configuration_change_hook) (Vwindow_point_insertion_type, auto_window_vscroll_p) (mode_line_in_non_selected_windows, next_screen_context_lines) (window_min_height, window_min_width): Remove. (scroll_margin): Remove declaration. * w32term.c (syms_of_w32term): Update. (Vw32_capslock_is_shiftlock, Vw32_grab_focus_on_raise) (Vw32_recognize_altgr, Vw32_swap_mouse_buttons) (Vx_toolkit_scroll_bars, w32_num_mouse_buttons) (w32_use_visible_system_caret, x_underline_at_descent_line) (x_use_underline_position_properties): Remove. (Vcommand_line_args, Vsystem_name, extra_keyboard_modifiers): Remove declaration. * w32select.c (syms_of_w32select): Update. (Vnext_selection_coding_system, Vselection_coding_system): Remove. * w32proc.c (syms_of_ntproc): Update. (Vw32_downcase_file_names, Vw32_generate_fake_inodes) (Vw32_get_true_file_attributes, Vw32_quote_process_args) (Vw32_start_process_inherit_error_mode) (Vw32_start_process_share_console) (Vw32_start_process_show_window, w32_pipe_read_delay): Remove. (Vsystem_name): Remove declaration. * w32font.c (syms_of_w32font): Update. (Vw32_charset_info_alist): Remove. * w32fns.c (globals_of_w32fns, syms_of_w32fns): Update. (Vw32_alt_is_meta, Vw32_apps_modifier, Vw32_bdf_filename_alist) (Vw32_color_map, Vw32_enable_caps_lock, Vw32_enable_num_lock) (Vw32_enable_palette, Vw32_lwindow_modifier) (Vw32_pass_alt_to_system, Vw32_pass_lwindow_to_system) (Vw32_pass_rwindow_to_system, Vw32_phantom_key_code) (Vw32_rwindow_modifier, Vw32_scroll_lock_modifier) (Vx_cursor_fore_pixel, Vx_hourglass_pointer_shape) (Vx_max_tooltip_size, Vx_mode_pointer_shape) (Vx_no_window_manager, Vx_nontext_pointer_shape) (Vx_pixel_size_width_font_regexp, Vx_pointer_shape) (Vx_sensitive_text_pointer_shape) (Vx_window_horizontal_drag_shape, w32_ansi_code_page) (w32_enable_synthesized_fonts, w32_mouse_button_tolerance) (w32_mouse_move_interval) (w32_pass_extra_mouse_buttons_to_system) (w32_pass_multimedia_buttons_to_system, w32_quit_key) (w32_strict_fontnames, w32_strict_painting): Remove. (Vhourglass_delay, Vmenu_bar_mode, Vtool_bar_mode) (Vw32_recognize_altgr, Vwindow_system_version) (w32_num_mouse_buttons, w32_use_visible_system_caret): Remove declaration. * w32console.c (syms_of_ntterm): Update. (w32_use_full_screen_buffer): Remove. (Vtty_defined_color_alist): Remove declaration. * w16select.c (syms_of_win16select): Update. (Vnext_selection_coding_system, Vselection_coding_system): Remove. * undo.c (syms_of_undo): Update. (Vundo_outer_limit, Vundo_outer_limit_function) (undo_inhibit_record_point, undo_limit, undo_strong_limit): Remove. * textprop.c (syms_of_textprop): Update. (Vchar_property_alias_alist, Vdefault_text_properties) (Vinhibit_point_motion_hooks, Vtext_property_default_nonsticky): Remove. * terminal.c (syms_of_terminal): Update. (Vdelete_terminal_functions, Vring_bell_function): Remove. * term.c (syms_of_term): Update. (Vresume_tty_functions, Vsuspend_tty_functions) (no_redraw_on_reenter, system_uses_terminfo, visible_cursor): Remove. * syntax.c (syms_of_syntax): Update. (Vfind_word_boundary_function_table, multibyte_syntax_as_symbol) (open_paren_in_column_0_is_defun_start) (parse_sexp_ignore_comments, parse_sexp_lookup_properties) (words_include_escapes): Remove. * search.c (syms_of_search): Update. (Vinhibit_changing_match_data, Vsearch_spaces_regexp): Remove. * process.c (syms_of_process): Update. (Vprocess_adaptive_read_buffering, Vprocess_connection_type) (delete_exited_processes): Remove. * print.c (syms_of_print): Update. (Vfloat_output_format, Vprint_charset_text_property) (Vprint_circle, Vprint_continuous_numbering, Vprint_gensym) (Vprint_length, Vprint_level, Vprint_number_table) (Vstandard_output, print_escape_multibyte) (print_escape_newlines, print_escape_nonascii, print_quoted): Remove. * msdos.c (syms_of_msdos): Update. (Vdos_unsupported_char_glyph): Remove. (unibyte_display_via_language_environment): Remove declaration. * minibuf.c (syms_of_minibuf): Update. (Vcompletion_regexp_list, Vhistory_add_new_input) (Vhistory_length, Vminibuffer_completing_file_name) (Vminibuffer_completion_confirm) (Vminibuffer_completion_predicate, Vminibuffer_completion_table) (Vminibuffer_exit_hook, Vminibuffer_help_form) (Vminibuffer_history_position, Vminibuffer_history_variable) (Vminibuffer_prompt_properties, Vminibuffer_setup_hook) (Vread_buffer_function, Vread_expression_map) (completion_ignore_case, enable_recursive_minibuffers) (history_delete_duplicates, minibuffer_allow_text_properties) (minibuffer_auto_raise, read_buffer_completion_ignore_case): Remove. * marker.c (syms_of_marker): Update. (byte_debug_flag): Remove. * macros.c (syms_of_macros): Update. (Vexecuting_kbd_macro, executing_kbd_macro_index): Remove. * lread.c (syms_of_lread): Update. (Vafter_load_alist, Vbyte_boolean_vars) (Vbytecomp_version_regexp, Vcurrent_load_list) (Veval_buffer_list, Vload_file_name, Vload_file_rep_suffixes) (Vload_history, Vload_path, Vload_read_function) (Vload_source_file_function, Vload_suffixes, Vobarray) (Vold_style_backquotes, Vpreloaded_file_list, Vread_circle) (Vread_symbol_positions_list, Vread_with_symbol_positions) (Vsource_directory, Vstandard_input, Vuser_init_file, Vvalues) (force_load_messages, load_convert_to_unibyte) (load_dangerous_libraries, load_force_doc_strings) (load_in_progress): Remove. * keymap.c (syms_of_keymap): Update. (Vdefine_key_rebound_commands, Vemulation_mode_map_alists) (Vminibuffer_local_completion_map) (Vminibuffer_local_filename_completion_map) (Vminibuffer_local_filename_must_match_map) (Vminibuffer_local_map, Vminibuffer_local_must_match_map) (Vminibuffer_local_ns_map, Vminor_mode_map_alist) (Vminor_mode_overriding_map_alist, Vwhere_is_preferred_modifier): Remove. * keyboard.c (syms_of_keyboard): Update. (Vauto_save_timeout, Vcommand_error_function) (Vcommand_hook_internal, Vdeactivate_mark) (Vdeferred_action_function, Vdeferred_action_list) (Vdisable_point_adjustment, Vdouble_click_time) (Vecho_keystrokes, Venable_disabled_menus_and_buttons) (Vfunction_key_map, Vglobal_disable_point_adjustment) (Vhelp_char, Vhelp_event_list, Vhelp_form) (Vinput_method_function, Vinput_method_previous_message) (Vkey_translation_map, Vlast_event_frame) (Vlucid_menu_bar_dirty_flag, Vmenu_bar_final_items) (Vminibuffer_message_timeout, Voverriding_local_map) (Voverriding_local_map_menu_flag, Vpost_command_hook) (Vpre_command_hook, Vprefix_help_command) (Vsaved_region_selection, Vselect_active_regions) (Vshow_help_function, Vspecial_event_map, Vsuggest_key_bindings) (Vthis_command, Vthis_command_keys_shift_translated) (Vthis_original_command, Vthrow_on_input, Vtimer_idle_list) (Vtimer_list, Vtool_bar_separator_image_expression, Vtop_level) (Vtty_erase_char, Vunread_command_events) (Vunread_input_method_events, Vunread_post_input_method_events) (auto_save_interval, cannot_suspend, do_mouse_tracking) (double_click_fuzz, extra_keyboard_modifiers) (inhibit_local_menu_bar_menus, last_command_event) (last_input_event, last_nonmenu_event, menu_prompt_more_char) (menu_prompting, meta_prefix_char, num_input_keys) (num_nonmacro_input_events, polling_period, unread_command_char): Remove. * insdel.c (syms_of_insdel): Update. (Vcombine_after_change_calls, check_markers_debug_flag): Remove. * indent.c (syms_of_indent): Update. (indent_tabs_mode): Remove. * image.c (syms_of_image): Update. (Vimage_cache_eviction_delay, Vimage_types) (Vimagemagick_render_type, Vmax_image_size, Vx_bitmap_file_path) (cross_disabled_images): Remove. * fringe.c (syms_of_fringe): Update. (Vfringe_bitmaps, Voverflow_newline_into_fringe): Remove. * frame.c (syms_of_frame): Update. (Vdefault_frame_alist, Vdefault_frame_scroll_bars) (Vdelete_frame_functions, Vframe_alpha_lower_limit) (Vmake_pointer_invisible, Vmenu_bar_mode, Vmouse_highlight) (Vmouse_position_function, Vterminal_frame, Vtool_bar_mode) (Vx_resource_class, Vx_resource_name, focus_follows_mouse): Remove. * fontset.c (syms_of_fontset): Update. (Valternate_fontname_alist, Vfont_encoding_charset_alist) (Vfontset_alias_alist, Vignore_relative_composition) (Votf_script_alist, Vuse_default_ascent) (Vvertical_centering_font_regexp): Remove. * font.c (syms_of_font): Update. (Vfont_encoding_alist, Vfont_log, Vfont_slant_table) (Vfont_weight_table, Vfont_width_table): Remove. * fns.c (syms_of_fns): Update. (Vfeatures, use_dialog_box, use_file_dialog): Remove. * filelock.c (syms_of_filelock): Update. (Vtemporary_file_directory): Remove. * fileio.c (syms_of_fileio): Update. (Vafter_insert_file_functions, Vauto_save_include_big_deletions) (Vauto_save_list_file_name, Vauto_save_visited_file_name) (Vdefault_file_name_coding_system, Vfile_name_coding_system) (Vfile_name_handler_alist, Vinhibit_file_name_handlers) (Vinhibit_file_name_operation, Vset_auto_coding_function) (Vwrite_region_annotate_functions) (Vwrite_region_annotations_so_far) (Vwrite_region_post_annotation_function) (delete_by_moving_to_trash, write_region_inhibit_fsync): Remove. (Vw32_get_true_file_attributes): Remove declaration. * eval.c (syms_of_eval): Update. (Vdebug_ignored_errors, Vdebug_on_error, Vdebug_on_signal) (Vdebugger, Vinhibit_quit, Vmacro_declaration_function) (Vquit_flag, Vsignal_hook_function, Vstack_trace_on_error) (debug_on_next_call, debug_on_quit, debugger_may_continue) (max_lisp_eval_depth, max_specpdl_size): Remove. * emacs.c (syms_of_emacs): Update. (Vafter_init_time, Vbefore_init_time, Vcommand_line_args) (Vdynamic_library_alist, Vemacs_copyright, Vemacs_version) (Vinstallation_directory, Vinvocation_directory) (Vinvocation_name, Vkill_emacs_hook, Vpath_separator) (Vprevious_system_messages_locale, Vprevious_system_time_locale) (Vsystem_configuration, Vsystem_configuration_options) (Vsystem_messages_locale, Vsystem_time_locale, Vsystem_type) (inhibit_x_resources, noninteractive1): Remove. * editfns.c (syms_of_editfns): Update. (Vbuffer_access_fontified_property) (Vbuffer_access_fontify_functions, Vinhibit_field_text_motion) (Voperating_system_release, Vsystem_name, Vuser_full_name) (Vuser_login_name, Vuser_real_login_name): Remove. * dosfns.c (syms_of_dosfns): Update. (Vdos_display_scancodes, Vdos_version, Vdos_windows_version) (dos_codepage, dos_country_code, dos_decimal_point) (dos_hyper_key, dos_keyboard_layout, dos_keypad_mode) (dos_super_key, dos_timezone_offset): Remove. * doc.c (syms_of_doc): Update. (Vbuild_files, Vdoc_file_name): Remove. * dispnew.c (syms_of_display): Update. (Vglyph_table, Vinitial_window_system) (Vredisplay_preemption_period, Vstandard_display_table) (Vwindow_system_version, baud_rate, cursor_in_echo_area) (inverse_video, redisplay_dont_pause, visible_bell): Remove. * dired.c (syms_of_dired): Update. (Vcompletion_ignored_extensions): Remove. (Vw32_get_true_file_attributes): Remove declaration. * dbusbind.c (syms_of_dbusbind): Update. (Vdbus_debug, Vdbus_registered_buses) (Vdbus_registered_objects_table): Remove. * data.c (syms_of_data): Update. (Vmost_negative_fixnum, Vmost_positive_fixnum): Remove. * composite.c (syms_of_composite): Update. (Vauto_composition_function, Vauto_composition_mode) (Vcompose_chars_after_function, Vcomposition_function_table): Remove. * coding.c (syms_of_coding): Update. (Vcharset_revision_table, Vcoding_category_list) (Vcoding_system_alist, Vcoding_system_for_read) (Vcoding_system_for_write, Vcoding_system_list) (Vdefault_process_coding_system, Venable_character_translation) (Vfile_coding_system_alist, Vlast_code_conversion_error) (Vlast_coding_system_used, Vlatin_extra_code_table) (Vlocale_coding_system, Vnetwork_coding_system_alist) (Vprocess_coding_system_alist) (Vselect_safe_coding_system_function) (Vstandard_translation_table_for_decode) (Vstandard_translation_table_for_encode) (Vtranslation_table_for_input, coding_system_require_warning) (eol_mnemonic_dos, eol_mnemonic_mac, eol_mnemonic_undecided) (eol_mnemonic_unix, inherit_process_coding_system) (inhibit_eol_conversion, inhibit_iso_escape_detection) (inhibit_null_byte_detection): Remove. * cmds.c (syms_of_cmds): Update. (Vpost_self_insert_hook): Remove. * charset.c (syms_of_charset): Update. (Vcharset_list, Vcharset_map_path, Vcurrent_iso639_language) (inhibit_load_charset_map): Remove. * character.c (syms_of_character): Update. (Vauto_fill_chars, Vchar_direction_table, Vchar_script_table) (Vchar_width_table, Vprintable_chars) (Vscript_representative_chars, Vtranslation_table_vector) (Vunicode_category_table): Remove. * ccl.c (syms_of_ccl): Update. (Vcode_conversion_map_vector, Vfont_ccl_encoder_alist) (Vtranslation_hash_table_vector): Remove. * category.c (syms_of_category): Update. (Vword_combining_categories, Vword_separating_categories): Remove. * callproc.c (syms_of_callproc): Update. (Vconfigure_info_directory, Vdata_directory, Vdoc_directory) (Vexec_directory, Vexec_path, Vexec_suffixes) (Vinitial_environment, Vprocess_environment) (Vshared_game_score_directory, Vshell_file_name): Remove. * callint.c (syms_of_callint): Update. (Vcommand_debug_status, Vcommand_history, Vcurrent_prefix_arg) (Vmark_even_if_inactive, Vmouse_leave_buffer_hook): Remove. * bytecode.c (syms_of_bytecode): Update. (Vbyte_code_meter, byte_metering_on): Remove. * buffer.c (syms_of_buffer): Update. (Vafter_change_functions, Vbefore_change_functions) (Vchange_major_mode_hook, Vfirst_change_hook) (Vinhibit_read_only, Vkill_buffer_query_functions) (Vtransient_mark_mode, inhibit_modification_hooks): Remove. * alloc.c (syms_of_alloc): Update. (Vgc_cons_percentage, Vgc_elapsed, Vmemory_full) (Vmemory_signal_data, Vpost_gc_hook, Vpurify_flag) (cons_cells_consed, floats_consed, garbage_collection_messages) (gc_cons_threshold, gcs_done, intervals_consed) (misc_objects_consed, pure_bytes_used, string_chars_consed) (strings_consed, symbols_consed, vector_cells_consed): Remove. * lisp.h (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL) (DEFVAR_INT): Assume global is in `globals'. * alloc.c (globals): Define.
author Tom Tromey <tromey@redhat.com>
date Tue, 18 Jan 2011 13:45:37 -0700
parents 417b1e4d63cd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
1 /* Input event support for Emacs on the Microsoft W32 API.
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
2 Copyright (C) 1992, 1993, 1995, 2001, 2002, 2003, 2004, 2005, 2006,
112218
376148b31b5e Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 110994
diff changeset
3 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
5 This file is part of GNU Emacs.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
7 GNU Emacs is free software: you can redistribute it and/or modify
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
8 it under the terms of the GNU General Public License as published by
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
10 (at your option) any later version.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
15 GNU General Public License for more details.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
17 You should have received a copy of the GNU General Public License
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
20 /*
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 Drew Bliss 01-Oct-93
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 Adapted from ntkbd.c by Tim Fleehart
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
42469
64341c22fb4c Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 35284
diff changeset
26 #include <config.h>
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 #include <stdio.h>
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 #include <windows.h>
105669
68dd71358159 * alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 101682
diff changeset
29 #include <setjmp.h>
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
31113
1743924e00dd Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 29319
diff changeset
31 #ifndef MOUSE_MOVED
1743924e00dd Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 29319
diff changeset
32 #define MOUSE_MOVED 1
1743924e00dd Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 29319
diff changeset
33 #endif
1743924e00dd Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 29319
diff changeset
34
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 #include "lisp.h"
31113
1743924e00dd Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 29319
diff changeset
36 #include "keyboard.h"
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 #include "frame.h"
80615
ed3882ec9644 Backport of long term bug from trunk:
Jason Rumney <jasonr@gnu.org>
parents: 79759
diff changeset
38 #include "dispextern.h"
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 #include "blockinput.h"
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 #include "termhooks.h"
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
41 #include "w32heap.h"
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
42 #include "w32term.h"
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 /* stdin, from ntterm */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 extern HANDLE keyboard_handle;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 /* Info for last mouse motion */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 static COORD movement_pos;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 static DWORD movement_time;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 /* from keyboard.c */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 extern void reinvoke_input_signal (void);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
54 extern unsigned int map_keypad_keys (unsigned int, unsigned int);
15460
be07c4433554 (Vwin32_alt_is_meta): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 15144
diff changeset
55
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
56 extern unsigned int w32_key_to_modifier (int key);
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
57
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 /* Event queue */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 #define EVENT_QUEUE_SIZE 50
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 static INPUT_RECORD event_queue[EVENT_QUEUE_SIZE];
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
63 /* Temporarily store lead byte of DBCS input sequences. */
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
64 static char dbcs_lead = 0;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
65
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
66 static int
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 fill_queue (BOOL block)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 BOOL rc;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 DWORD events_waiting;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
71
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 if (queue_ptr < queue_end)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 return queue_end-queue_ptr;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
74
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 if (!block)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 /* Check to see if there are some events to read before we try
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 because we can't block. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 if (!GetNumberOfConsoleInputEvents (keyboard_handle, &events_waiting))
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 if (events_waiting == 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
84
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 rc = ReadConsoleInput (keyboard_handle, event_queue, EVENT_QUEUE_SIZE,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 &events_waiting);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 if (!rc)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 queue_ptr = event_queue;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 queue_end = event_queue + events_waiting;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 return (int) events_waiting;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 /* In a generic, multi-frame world this should take a console handle
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 and return the frame for it
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 Right now, there's only one frame so return it. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
98 static FRAME_PTR
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 get_frame (void)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 {
27399
22e4449438ff (get_frame, w32_console_mouse_position, mouse_moved_to):
Jason Rumney <jasonr@gnu.org>
parents: 24937
diff changeset
101 return SELECTED_FRAME ();
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
104 /* Translate console modifiers to emacs modifiers.
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
105 German keyboard support (Kai Morgan Zeise 2/18/95). */
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
106 int
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
107 w32_kbd_mods_to_emacs (DWORD mods, WORD key)
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
108 {
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
109 int retval = 0;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
110
21611
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
111 /* If we recognize right-alt and left-ctrl as AltGr, and it has been
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
112 pressed, first remove those modifiers. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
113 if (!NILP (Vw32_recognize_altgr)
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
114 && (mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
115 == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
116 mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED);
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
117
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
118 if (mods & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
119 retval = ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
120
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
121 if (mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
122 {
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
123 retval |= ctrl_modifier;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
124 if ((mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
125 == (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
126 retval |= meta_modifier;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
127 }
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
128
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
129 if (mods & LEFT_WIN_PRESSED)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
130 retval |= w32_key_to_modifier (VK_LWIN);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
131 if (mods & RIGHT_WIN_PRESSED)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
132 retval |= w32_key_to_modifier (VK_RWIN);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
133 if (mods & APPS_PRESSED)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
134 retval |= w32_key_to_modifier (VK_APPS);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
135 if (mods & SCROLLLOCK_ON)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
136 retval |= w32_key_to_modifier (VK_SCROLL);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
137
96376
c3309dba6542 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 94963
diff changeset
138 /* Just in case someone wanted the original behavior, make it
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
139 optional by setting w32-capslock-is-shiftlock to t. */
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
140 if (NILP (Vw32_capslock_is_shiftlock)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
141 /* Keys that should _not_ be affected by CapsLock. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
142 && ( (key == VK_BACK)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
143 || (key == VK_TAB)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
144 || (key == VK_CLEAR)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
145 || (key == VK_RETURN)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
146 || (key == VK_ESCAPE)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
147 || ((key >= VK_SPACE) && (key <= VK_HELP))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
148 || ((key >= VK_NUMPAD0) && (key <= VK_F24))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
149 || ((key >= VK_NUMPAD_CLEAR) && (key <= VK_NUMPAD_DELETE))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
150 ))
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
151 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
152 /* Only consider shift state. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
153 if ((mods & SHIFT_PRESSED) != 0)
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
154 retval |= shift_modifier;
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
155 }
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
156 else
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
157 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
158 /* Ignore CapsLock state if not enabled. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
159 if (NILP (Vw32_enable_caps_lock))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
160 mods &= ~CAPSLOCK_ON;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
161 if ((mods & (SHIFT_PRESSED | CAPSLOCK_ON)) != 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
162 retval |= shift_modifier;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
163 }
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
164
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
165 return retval;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
166 }
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
167
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
168 #if 0
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
169 /* Return nonzero if the virtual key is a dead key. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
170 static int
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
171 is_dead_key (int wparam)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
172 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
173 unsigned int code = MapVirtualKey (wparam, 2);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
174
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
175 /* Windows 95 returns 0x8000, NT returns 0x80000000. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
176 return (code & 0x80008000) ? 1 : 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
177 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
178 #endif
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
179
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
180 /* The return code indicates key code size. */
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
181 int
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
182 w32_kbd_patch_key (KEY_EVENT_RECORD *event)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 {
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
184 unsigned int key_code = event->wVirtualKeyCode;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
185 unsigned int mods = event->dwControlKeyState;
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
186 BYTE keystate[256];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
187 static BYTE ansi_code[4];
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
188 static int isdead = 0;
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
189
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
190 if (isdead == 2)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
191 {
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
192 event->uChar.AsciiChar = ansi_code[2];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
193 isdead = 0;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
194 return 1;
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
195 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
196 if (event->uChar.AsciiChar != 0)
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
197 return 1;
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
198
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
199 memset (keystate, 0, sizeof (keystate));
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
200 keystate[key_code] = 0x80;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
201 if (mods & SHIFT_PRESSED)
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
202 keystate[VK_SHIFT] = 0x80;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
203 if (mods & CAPSLOCK_ON)
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
204 keystate[VK_CAPITAL] = 1;
21611
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
205 /* If we recognize right-alt and left-ctrl as AltGr, set the key
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
206 states accordingly before invoking ToAscii. */
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
207 if (!NILP (Vw32_recognize_altgr)
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
208 && (mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED))
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
209 {
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
210 keystate[VK_CONTROL] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
211 keystate[VK_LCONTROL] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
212 keystate[VK_MENU] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
213 keystate[VK_RMENU] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
214 }
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
215
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
216 #if 0
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
217 /* Because of an OS bug, ToAscii corrupts the stack when called to
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
218 convert a dead key in console mode on NT4. Unfortunately, trying
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
219 to check for dead keys using MapVirtualKey doesn't work either -
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
220 these functions apparently use internal information about keyboard
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
221 layout which doesn't get properly updated in console programs when
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
222 changing layout (though apparently it gets partly updated,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
223 otherwise ToAscii wouldn't crash). */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
224 if (is_dead_key (event->wVirtualKeyCode))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
225 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
226 #endif
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
227
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
228 /* On NT, call ToUnicode instead and then convert to the current
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
229 locale's default codepage. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
230 if (os_subtype == OS_NT)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
231 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
232 WCHAR buf[128];
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
233
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
234 isdead = ToUnicode (event->wVirtualKeyCode, event->wVirtualScanCode,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
235 keystate, buf, 128, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
236 if (isdead > 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
237 {
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
238 char cp[20];
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
239 int cpId;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
240
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
241 event->uChar.UnicodeChar = buf[isdead - 1];
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
242
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
243 GetLocaleInfo (GetThreadLocale (),
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
244 LOCALE_IDEFAULTANSICODEPAGE, cp, 20);
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
245 cpId = atoi (cp);
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
246 isdead = WideCharToMultiByte (cpId, 0, buf, isdead,
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
247 ansi_code, 4, NULL, NULL);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
248 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
249 else
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
250 isdead = 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
251 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
252 else
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
253 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
254 isdead = ToAscii (event->wVirtualKeyCode, event->wVirtualScanCode,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
255 keystate, (LPWORD) ansi_code, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
256 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
257
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
258 if (isdead == 0)
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
259 return 0;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
260 event->uChar.AsciiChar = ansi_code[0];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
261 return isdead;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 }
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
263
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264
111539
ad93f2dd2d38 Add const to array elements.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 110975
diff changeset
265 extern const char *const lispy_function_keys[];
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
267 static int faked_key = 0;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
268
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
269 /* return code -1 means that event_queue_ptr won't be incremented.
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
270 In other word, this event makes two key codes. (by himi) */
110975
e0ac9a58795e src/w32*.c: Make functions static.
Juanma Barranquero <lekktu@gmail.com>
parents: 110683
diff changeset
271 static int
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
272 key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
274 static int mod_key_state = 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
275 int wParam;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
276
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
277 *isdead = 0;
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
278
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 /* Skip key-up events. */
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
280 if (!event->bKeyDown)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
282 switch (event->wVirtualKeyCode)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
283 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
284 case VK_LWIN:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
285 mod_key_state &= ~LEFT_WIN_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
286 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
287 case VK_RWIN:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
288 mod_key_state &= ~RIGHT_WIN_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
289 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
290 case VK_APPS:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
291 mod_key_state &= ~APPS_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
292 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
293 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
294 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
295 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
296
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
297 /* Ignore keystrokes we fake ourself; see below. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
298 if (faked_key == event->wVirtualKeyCode)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
299 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
300 faked_key = 0;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 }
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
303
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
304 /* To make it easier to debug this code, ignore modifier keys! */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
305 switch (event->wVirtualKeyCode)
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
306 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
307 case VK_LWIN:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
308 if (NILP (Vw32_pass_lwindow_to_system))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
309 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
310 /* Prevent system from acting on keyup (which opens the Start
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
311 menu if no other key was pressed) by simulating a press of
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
312 Space which we will ignore. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
313 if ((mod_key_state & LEFT_WIN_PRESSED) == 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
314 {
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
315 if (NUMBERP (Vw32_phantom_key_code))
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
316 faked_key = XUINT (Vw32_phantom_key_code) & 255;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
317 else
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
318 faked_key = VK_SPACE;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
319 keybd_event (faked_key, (BYTE) MapVirtualKey (faked_key, 0), 0, 0);
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
320 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
321 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
322 mod_key_state |= LEFT_WIN_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
323 if (!NILP (Vw32_lwindow_modifier))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
324 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
325 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
326 case VK_RWIN:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
327 if (NILP (Vw32_pass_rwindow_to_system))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
328 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
329 if ((mod_key_state & RIGHT_WIN_PRESSED) == 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
330 {
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
331 if (NUMBERP (Vw32_phantom_key_code))
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
332 faked_key = XUINT (Vw32_phantom_key_code) & 255;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
333 else
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
334 faked_key = VK_SPACE;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
335 keybd_event (faked_key, (BYTE) MapVirtualKey (faked_key, 0), 0, 0);
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
336 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
337 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
338 mod_key_state |= RIGHT_WIN_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
339 if (!NILP (Vw32_rwindow_modifier))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
340 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
341 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
342 case VK_APPS:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
343 mod_key_state |= APPS_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
344 if (!NILP (Vw32_apps_modifier))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
345 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
346 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
347 case VK_CAPITAL:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
348 /* Decide whether to treat as modifier or function key. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
349 if (NILP (Vw32_enable_caps_lock))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
350 goto disable_lock_key;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
351 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
352 case VK_NUMLOCK:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
353 /* Decide whether to treat as modifier or function key. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
354 if (NILP (Vw32_enable_num_lock))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
355 goto disable_lock_key;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
356 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
357 case VK_SCROLL:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
358 /* Decide whether to treat as modifier or function key. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
359 if (NILP (Vw32_scroll_lock_modifier))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
360 goto disable_lock_key;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
361 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
362 disable_lock_key:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
363 /* Ensure the appropriate lock key state is off (and the
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
364 indicator light as well). */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
365 wParam = event->wVirtualKeyCode;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
366 if (GetAsyncKeyState (wParam) & 0x8000)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
367 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
368 /* Fake another press of the relevant key. Apparently, this
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
369 really is the only way to turn off the indicator. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
370 faked_key = wParam;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
371 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
372 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
373 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
374 KEYEVENTF_EXTENDEDKEY | 0, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
375 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
376 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
377 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
378 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
379 case VK_MENU:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
380 case VK_CONTROL:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
381 case VK_SHIFT:
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 return 0;
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
383 case VK_CANCEL:
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
384 /* Windows maps Ctrl-Pause (aka Ctrl-Break) into VK_CANCEL,
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
385 which is confusing for purposes of key binding; convert
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
386 VK_CANCEL events into VK_PAUSE events. */
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
387 event->wVirtualKeyCode = VK_PAUSE;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
388 break;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
389 case VK_PAUSE:
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
390 /* Windows maps Ctrl-NumLock into VK_PAUSE, which is confusing
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
391 for purposes of key binding; convert these back into
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
392 VK_NUMLOCK events, at least when we want to see NumLock key
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
393 presses. (Note that there is never any possibility that
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
394 VK_PAUSE with Ctrl really is C-Pause as per above.) */
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
395 if (NILP (Vw32_enable_num_lock)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
396 && (event->dwControlKeyState
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
397 & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) != 0)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
398 event->wVirtualKeyCode = VK_NUMLOCK;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
399 break;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 }
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
401
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
402 /* Recognize state of Windows and Apps keys. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
403 event->dwControlKeyState |= mod_key_state;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
404
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
405 /* Distinguish numeric keypad keys from extended keys. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
406 event->wVirtualKeyCode =
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
407 map_keypad_keys (event->wVirtualKeyCode,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
408 (event->dwControlKeyState & ENHANCED_KEY));
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
409
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
410 if (lispy_function_keys[event->wVirtualKeyCode] == 0)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
412 if (!NILP (Vw32_recognize_altgr)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
413 && (event->dwControlKeyState & LEFT_CTRL_PRESSED)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
414 && (event->dwControlKeyState & RIGHT_ALT_PRESSED))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
415 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
416 /* Don't try to interpret AltGr key chords; ToAscii seems not
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
417 to process them correctly. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
418 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
419 /* Handle key chords including any modifiers other than shift
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
420 directly, in order to preserve as much modifier information as
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
421 possible. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
422 else if (event->dwControlKeyState
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
423 & ( RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
424 | RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
425 | (!NILP (Vw32_lwindow_modifier) ? LEFT_WIN_PRESSED : 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
426 | (!NILP (Vw32_rwindow_modifier) ? RIGHT_WIN_PRESSED : 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
427 | (!NILP (Vw32_apps_modifier) ? APPS_PRESSED : 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
428 | (!NILP (Vw32_scroll_lock_modifier) ? SCROLLLOCK_ON : 0)))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
429 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
430 /* Don't translate modified alphabetic keystrokes, so the user
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
431 doesn't need to constantly switch layout to type control or
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
432 meta keystrokes when the normal layout translates
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
433 alphabetic characters to non-ascii characters. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
434 if ('A' <= event->wVirtualKeyCode && event->wVirtualKeyCode <= 'Z')
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
435 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
436 event->uChar.AsciiChar = event->wVirtualKeyCode;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
437 if ((event->dwControlKeyState & SHIFT_PRESSED) == 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
438 event->uChar.AsciiChar += ('a' - 'A');
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
439 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
440 /* Try to handle unrecognized keystrokes by determining the
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
441 base character (ie. translating the base key plus shift
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
442 modifier). */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
443 else if (event->uChar.AsciiChar == 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
444 w32_kbd_patch_key (event);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
445 }
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
446
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
447 if (event->uChar.AsciiChar == 0)
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
448 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
449 emacs_ev->kind = NO_EVENT;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
450 return 0;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
451 }
107043
3809515a97b5 w32inevt.c (key_event): Remove unnecessary comparison of
Eli Zaretskii <eliz@gnu.org>
parents: 107016
diff changeset
452 else if (event->uChar.AsciiChar > 0)
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
453 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
454 emacs_ev->kind = ASCII_KEYSTROKE_EVENT;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
455 emacs_ev->code = event->uChar.AsciiChar;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
456 }
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
457 else if (event->uChar.UnicodeChar > 0)
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
458 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
459 emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
460 emacs_ev->code = event->uChar.UnicodeChar;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
461 }
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
462 else
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
463 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
464 /* Fallback for non-Unicode versions of Windows. */
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
465 wchar_t code;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
466 char dbcs[2];
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
467 char cp[20];
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
468 int cpId;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
469
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
470 /* Get the codepage to interpret this key with. */
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
471 GetLocaleInfo (GetThreadLocale (),
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
472 LOCALE_IDEFAULTANSICODEPAGE, cp, 20);
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
473 cpId = atoi (cp);
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
474
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
475 dbcs[0] = dbcs_lead;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
476 dbcs[1] = event->uChar.AsciiChar;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
477 if (dbcs_lead)
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
478 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
479 dbcs_lead = 0;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
480 if (!MultiByteToWideChar (cpId, 0, dbcs, 2, &code, 1))
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
481 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
482 /* Garbage */
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
483 DebPrint (("Invalid DBCS sequence: %d %d\n",
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
484 dbcs[0], dbcs[1]));
107016
b7aa72d41625 Fix typos, check for negative ASCII characters.
Jason Rumney <jasonr@gnu.org>
parents: 107015
diff changeset
485 emacs_ev->kind = NO_EVENT;
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
486 }
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
487 }
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
488 else if (IsDBCSLeadByteEx (cpId, dbcs[1]))
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
489 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
490 dbcs_lead = dbcs[1];
107016
b7aa72d41625 Fix typos, check for negative ASCII characters.
Jason Rumney <jasonr@gnu.org>
parents: 107015
diff changeset
491 emacs_ev->kind = NO_EVENT;
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
492 }
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
493 else
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
494 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
495 if (!MultiByteToWideChar (cpId, 0, &dbcs[1], 1, &code, 1))
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
496 {
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
497 /* Garbage */
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
498 DebPrint (("Invalid character: %d\n", dbcs[1]));
107016
b7aa72d41625 Fix typos, check for negative ASCII characters.
Jason Rumney <jasonr@gnu.org>
parents: 107015
diff changeset
499 emacs_ev->kind = NO_EVENT;
107015
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
500 }
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
501 }
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
502 emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
503 emacs_ev->code = code;
0b67a7f89499 Use Unicode for console keyboard input on Windows.
Jason Rumney <jasonr@gnu.org>
parents: 106815
diff changeset
504 }
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 else
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 {
45804
863817d7e734 *** empty log message ***
Pavel Janík <Pavel@Janik.cz>
parents: 42469
diff changeset
508 emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT;
55640
773eb057811d (w32_console_mouse_position, do_mouse_event, key_event): Don't mix
Jason Rumney <jasonr@gnu.org>
parents: 54169
diff changeset
509 emacs_ev->code = event->wVirtualKeyCode;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 }
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
511
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
512 XSETFRAME (emacs_ev->frame_or_window, get_frame ());
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
513 emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState,
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
514 event->wVirtualKeyCode);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 emacs_ev->timestamp = GetTickCount ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 return 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
519 int
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
520 w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
521 {
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
522 int cur_state = (GetKeyState (vk_code) & 1);
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
523
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
524 if (NILP (new_state)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
525 || (NUMBERP (new_state)
35284
712561c30aa5 (w32_console_toggle_lock_key): Add parentheses.
Jason Rumney <jasonr@gnu.org>
parents: 31113
diff changeset
526 && ((XUINT (new_state)) & 1) != cur_state))
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
527 {
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
528 faked_key = vk_code;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
529
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
530 keybd_event ((BYTE) vk_code,
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
531 (BYTE) MapVirtualKey (vk_code, 0),
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
532 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
533 keybd_event ((BYTE) vk_code,
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
534 (BYTE) MapVirtualKey (vk_code, 0),
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
535 KEYEVENTF_EXTENDEDKEY | 0, 0);
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
536 keybd_event ((BYTE) vk_code,
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
537 (BYTE) MapVirtualKey (vk_code, 0),
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
538 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
539 cur_state = !cur_state;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
540 }
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
541
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
542 return cur_state;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
543 }
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
544
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 /* Mouse position hook. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
546 void
21829
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
547 w32_console_mouse_position (FRAME_PTR *f,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
548 int insist,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
549 Lisp_Object *bar_window,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
550 enum scroll_bar_part *part,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
551 Lisp_Object *x,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
552 Lisp_Object *y,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
553 unsigned long *time)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 BLOCK_INPUT;
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
556
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
557 insist = insist;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
558
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 *f = get_frame ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 *bar_window = Qnil;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 *part = 0;
27399
22e4449438ff (get_frame, w32_console_mouse_position, mouse_moved_to):
Jason Rumney <jasonr@gnu.org>
parents: 24937
diff changeset
562 SELECTED_FRAME ()->mouse_moved = 0;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
563
110994
734b2470f93c src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 107043
diff changeset
564 XSETINT (*x, movement_pos.X);
734b2470f93c src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 107043
diff changeset
565 XSETINT (*y, movement_pos.Y);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 *time = movement_time;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
567
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 UNBLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 /* Remember mouse motion and notify emacs. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
572 static void
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 mouse_moved_to (int x, int y)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 /* If we're in the same place, ignore it */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 if (x != movement_pos.X || y != movement_pos.Y)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 {
27399
22e4449438ff (get_frame, w32_console_mouse_position, mouse_moved_to):
Jason Rumney <jasonr@gnu.org>
parents: 24937
diff changeset
578 SELECTED_FRAME ()->mouse_moved = 1;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 movement_pos.X = x;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 movement_pos.Y = y;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 movement_time = GetTickCount ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 /* Consoles return button bits in a strange order:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 least significant - Leftmost button
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 next - Rightmost button
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 next - Leftmost+1
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 next - Leftmost+2...
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 Assume emacs likes three button mice, so
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 Left == 0
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 Middle == 1
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 Right == 2
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 Others increase from there. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596
29319
2069f3aa4939 (NUM_TRANSLATED_MOUSE_BUTTONS): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 27515
diff changeset
597 #define NUM_TRANSLATED_MOUSE_BUTTONS 3
2069f3aa4939 (NUM_TRANSLATED_MOUSE_BUTTONS): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 27515
diff changeset
598 static int emacs_button_translation[NUM_TRANSLATED_MOUSE_BUTTONS] =
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 {
29319
2069f3aa4939 (NUM_TRANSLATED_MOUSE_BUTTONS): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 27515
diff changeset
600 0, 2, 1
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 };
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
603 static int
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 do_mouse_event (MOUSE_EVENT_RECORD *event,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 struct input_event *emacs_ev)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 static DWORD button_state = 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 DWORD but_change, mask;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 int i;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
610
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 if (event->dwEventFlags == MOUSE_MOVED)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 /* For movement events we just note that the mouse has moved
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 so that emacs will generate drag events. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
618
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 /* It looks like the console code sends us a mouse event with
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 dwButtonState == 0 when a window is activated. Ignore this case. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 if (event->dwButtonState == button_state)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622 return 0;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
623
45804
863817d7e734 *** empty log message ***
Pavel Janík <Pavel@Janik.cz>
parents: 42469
diff changeset
624 emacs_ev->kind = MOUSE_CLICK_EVENT;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
625
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 /* Find out what button has changed state since the last button event. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 but_change = button_state ^ event->dwButtonState;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 mask = 1;
29319
2069f3aa4939 (NUM_TRANSLATED_MOUSE_BUTTONS): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 27515
diff changeset
629 for (i = 0; mask; i++, mask <<= 1)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 if (but_change & mask)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 {
29319
2069f3aa4939 (NUM_TRANSLATED_MOUSE_BUTTONS): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 27515
diff changeset
632 if (i < NUM_TRANSLATED_MOUSE_BUTTONS)
55640
773eb057811d (w32_console_mouse_position, do_mouse_event, key_event): Don't mix
Jason Rumney <jasonr@gnu.org>
parents: 54169
diff changeset
633 emacs_ev->code = emacs_button_translation[i];
29319
2069f3aa4939 (NUM_TRANSLATED_MOUSE_BUTTONS): New constant.
Jason Rumney <jasonr@gnu.org>
parents: 27515
diff changeset
634 else
55640
773eb057811d (w32_console_mouse_position, do_mouse_event, key_event): Don't mix
Jason Rumney <jasonr@gnu.org>
parents: 54169
diff changeset
635 emacs_ev->code = i;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 button_state = event->dwButtonState;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 emacs_ev->timestamp = GetTickCount ();
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
641 emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState, 0) |
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 ((event->dwButtonState & mask) ? down_modifier : up_modifier);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
643
10007
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
644 XSETFASTINT (emacs_ev->x, event->dwMousePosition.X);
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
645 XSETFASTINT (emacs_ev->y, event->dwMousePosition.Y);
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
646 /* for Mule 2.2 (Based on Emacs 19.28 */
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
647 #ifdef MULE
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
648 XSET (emacs_ev->frame_or_window, Lisp_Frame, get_frame ());
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
649 #else
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
650 XSETFRAME (emacs_ev->frame_or_window, get_frame ());
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
651 #endif
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
652
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 return 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
656 static void
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 FRAME_PTR f = get_frame ();
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
660
80615
ed3882ec9644 Backport of long term bug from trunk:
Jason Rumney <jasonr@gnu.org>
parents: 79759
diff changeset
661 change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1, 0);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 SET_FRAME_GARBAGED (f);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
665 static void
109152
e27859da5624 src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents: 107043
diff changeset
666 maybe_generate_resize_event (void)
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
667 {
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
668 CONSOLE_SCREEN_BUFFER_INFO info;
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
669 FRAME_PTR f = get_frame ();
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
670
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
671 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info);
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
672
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
673 /* It is okay to call this unconditionally, since it will do nothing
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
674 if the size hasn't actually changed. */
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
675 change_frame_size (f,
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
676 1 + info.srWindow.Bottom - info.srWindow.Top,
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
677 1 + info.srWindow.Right - info.srWindow.Left,
80615
ed3882ec9644 Backport of long term bug from trunk:
Jason Rumney <jasonr@gnu.org>
parents: 79759
diff changeset
678 0, 0, 0);
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
679 }
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
680
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
681 int
83575
cc3d57dc8761 (w32_console_read_socket): Make first arg a frame.
Jason Rumney <jasonr@gnu.org>
parents: 75227
diff changeset
682 w32_console_read_socket (struct terminal *terminal,
cc3d57dc8761 (w32_console_read_socket): Make first arg a frame.
Jason Rumney <jasonr@gnu.org>
parents: 75227
diff changeset
683 int expected,
cc3d57dc8761 (w32_console_read_socket): Make first arg a frame.
Jason Rumney <jasonr@gnu.org>
parents: 75227
diff changeset
684 struct input_event *hold_quit)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 BOOL no_events = TRUE;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 int nev, ret = 0, add;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
688 int isdead;
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
689
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 if (interrupt_input_blocked)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 interrupt_input_pending = 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
695
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696 interrupt_input_pending = 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 BLOCK_INPUT;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
698
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 for (;;)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 {
15784
75547616a6fe (win32_read_socket): Never block reading from input queue.
Richard M. Stallman <rms@gnu.org>
parents: 15460
diff changeset
701 nev = fill_queue (0);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 if (nev <= 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 /* If nev == -1, there was some kind of error
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 If nev == 0 then waitp must be zero and no events were available
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 so return. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 UNBLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 return nev;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710
54169
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
711 while (nev > 0)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 {
54169
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
713 struct input_event inev;
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
714
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
715 EVENT_INIT (inev);
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
716 inev.kind = NO_EVENT;
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
717 inev.arg = Qnil;
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
718
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 switch (queue_ptr->EventType)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 case KEY_EVENT:
54169
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
722 add = key_event (&queue_ptr->Event.KeyEvent, &inev, &isdead);
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
723 if (add == -1) /* 95.7.25 by himi */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
724 {
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
725 queue_ptr--;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
726 add = 1;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
727 }
54169
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
728 if (add)
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
729 kbd_buffer_store_event_hold (&inev, hold_quit);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 case MOUSE_EVENT:
54169
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
733 add = do_mouse_event (&queue_ptr->Event.MouseEvent, &inev);
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
734 if (add)
8b5313e6b324 (w32_console_read_socket): Remove bufp_r and
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
735 kbd_buffer_store_event_hold (&inev, hold_quit);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 case WINDOW_BUFFER_SIZE_EVENT:
24937
42f29912dc46 (w32_console_read_socket): Use new variable w32_use_full_screen_buffer.
Andrew Innes <andrewi@gnu.org>
parents: 24756
diff changeset
739 if (w32_use_full_screen_buffer)
42f29912dc46 (w32_console_read_socket): Use new variable w32_use_full_screen_buffer.
Andrew Innes <andrewi@gnu.org>
parents: 24756
diff changeset
740 resize_event (&queue_ptr->Event.WindowBufferSizeEvent);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 break;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
742
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 case MENU_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 case FOCUS_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745 /* Internal event types, ignored. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45804
diff changeset
748
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 queue_ptr++;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750 nev--;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
753 if (ret > 0 || expected == 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755 }
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
757 /* We don't get told about changes in the window size (only the buffer
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
758 size, which we no longer care about), so we have to check it
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
759 periodically. */
24937
42f29912dc46 (w32_console_read_socket): Use new variable w32_use_full_screen_buffer.
Andrew Innes <andrewi@gnu.org>
parents: 24756
diff changeset
760 if (!w32_use_full_screen_buffer)
42f29912dc46 (w32_console_read_socket): Use new variable w32_use_full_screen_buffer.
Andrew Innes <andrewi@gnu.org>
parents: 24756
diff changeset
761 maybe_generate_resize_event ();
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
762
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 UNBLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764 return ret;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
766