Mercurial > emacs
annotate src/w32select.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 | 61f7601898b1 |
children |
rev | line source |
---|---|
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
1 /* Selection processing for Emacs on the Microsoft W32 API. |
112284
61f7601898b1
Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents:
112228
diff
changeset
|
2 |
61f7601898b1
Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents:
112228
diff
changeset
|
3 Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
61f7601898b1
Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents:
112228
diff
changeset
|
4 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
5 |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
6 This file is part of GNU Emacs. |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
7 |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91327
diff
changeset
|
8 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:
13434
diff
changeset
|
9 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:
91327
diff
changeset
|
10 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:
91327
diff
changeset
|
11 (at your option) any later version. |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
12 |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
13 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:
13434
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
16 GNU General Public License for more details. |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
17 |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
18 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:
91327
diff
changeset
|
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
13434 | 20 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
21 /* Written by Kevin Gallo, Benjamin Riefenstahl */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
22 |
13434 | 23 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
24 /* |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
25 * Notes on usage of selection-coding-system and |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
26 * next-selection-coding-system on MS Windows: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
27 * |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
28 * The selection coding system variables apply only to the version of |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
29 * the clipboard data that is closest in type, i.e. when a 16-bit |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
30 * Unicode coding system is given, they apply to he Unicode clipboard |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
31 * (CF_UNICODETEXT), when a well-known console codepage is given, they |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
32 * apply to the console version of the clipboard data (CF_OEMTEXT), |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
33 * else they apply to the normal 8-bit text clipboard (CF_TEXT). |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
34 * |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
35 * When pasting (getting data from the OS), the clipboard format that |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
36 * matches the {next-}selection-coding-system is retrieved. If |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
37 * Unicode is requested, but not available, 8-bit text (CF_TEXT) is |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
38 * used. In all other cases the OS will transparently convert |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
39 * formats, so no other fallback is needed. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
40 * |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
41 * When copying or cutting (sending data to the OS), the data is |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
42 * announced and stored internally, but only actually rendered on |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
43 * request. The requester determines the format provided. The |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
44 * {next-}selection-coding-system is only used, when its corresponding |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
45 * clipboard type matches the type requested. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
46 * |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
47 * Scenarios to use the facilities for customizing the selection |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
48 * coding system are: |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
49 * |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
50 * ;; Generally use KOI8-R instead of the russian MS codepage for |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
51 * ;; the 8-bit clipboard. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
52 * (set-selection-coding-system 'koi8-r-dos) |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
53 * |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
54 * Or |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
55 * |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
56 * ;; Create a special clipboard copy function that uses codepage |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
57 * ;; 1253 (Greek) to copy Greek text to a specific non-Unicode |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
58 * ;; application. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
59 * (defun greek-copy (beg end) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
60 * (interactive "r") |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
61 * (set-next-selection-coding-system 'cp1253-dos) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
62 * (copy-region-as-kill beg end)) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
63 * (global-set-key "\C-c\C-c" 'greek-copy) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
64 */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
65 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
66 /* |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
67 * Ideas for further directions: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
68 * |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
69 * The encoding and decoding routines could be moved to Lisp code |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
70 * similar to how xselect.c does it (using well-known routine names |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
71 * for the delayed rendering). If the definition of which clipboard |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
72 * types should be supported is also moved to Lisp, functionality |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
73 * could be expanded to CF_HTML, CF_RTF and maybe other types. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
74 */ |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
75 |
13434 | 76 #include <config.h> |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
77 #include <setjmp.h> |
13434 | 78 #include "lisp.h" |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15235
diff
changeset
|
79 #include "w32term.h" /* for all of the w32 includes */ |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
80 #include "w32heap.h" /* os_subtype */ |
13434 | 81 #include "blockinput.h" |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
82 #include "keyboard.h" /* cmd_error_internal() */ |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
83 #include "charset.h" |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
84 #include "coding.h" |
90930 | 85 #include "character.h" |
45988
37913830a881
Include composite.h
Juanma Barranquero <lekktu@gmail.com>
parents:
45984
diff
changeset
|
86 #include "composite.h" |
13434 | 87 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
88 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
89 static HGLOBAL convert_to_handle_as_ascii (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
90 static HGLOBAL convert_to_handle_as_coded (Lisp_Object coding_system); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
91 static Lisp_Object render (Lisp_Object oformat); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
92 static Lisp_Object render_locale (void); |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
93 static Lisp_Object render_all (Lisp_Object ignore); |
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
94 static void run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
95 static Lisp_Object lisp_error_handler (Lisp_Object error); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
96 static LRESULT CALLBACK owner_callback (HWND win, UINT msg, |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
97 WPARAM wp, LPARAM lp); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
98 static HWND create_owner (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
99 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
100 static void setup_config (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
101 static BOOL WINAPI enum_locale_callback (/*const*/ char* loc_string); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
102 static UINT cp_from_locale (LCID lcid, UINT format); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
103 static Lisp_Object coding_from_cp (UINT codepage); |
90157 | 104 static Lisp_Object validate_coding_system (Lisp_Object coding_system); |
105 static void setup_windows_coding_system (Lisp_Object coding_system, | |
106 struct coding_system * coding); | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
107 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
108 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
109 /* A remnant from X11: Symbol for the CLIPBORD selection type. Other |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
110 selections are not used on Windows, so we don't need symbols for |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
111 PRIMARY and SECONDARY. */ |
15235 | 112 Lisp_Object QCLIPBOARD; |
113 | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
114 /* Internal pseudo-constants, initialized in globals_of_w32select() |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
115 based on current system parameters. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
116 static LCID DEFAULT_LCID; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
117 static UINT ANSICP, OEMCP; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
118 static Lisp_Object QUNICODE, QANSICP, QOEMCP; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
119 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
120 /* A hidden window just for the clipboard management. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
121 static HWND clipboard_owner; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
122 /* A flag to tell WM_DESTROYCLIPBOARD who is to blame this time (just |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
123 checking GetClipboardOwner() doesn't work, sadly). */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
124 static int modifying_clipboard = 0; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
125 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
126 /* Configured transfer parameters, based on the last inspection of |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
127 selection-coding-system. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
128 static Lisp_Object cfg_coding_system; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
129 static UINT cfg_codepage; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
130 static LCID cfg_lcid; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
131 static UINT cfg_clipboard_type; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
132 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
133 /* The current state for delayed rendering. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
134 static Lisp_Object current_text; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
135 static Lisp_Object current_coding_system; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
136 static int current_requires_encoding, current_num_nls; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
137 static UINT current_clipboard_type; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
138 static LCID current_lcid; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
139 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
140 #if TRACE |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
141 #define ONTRACE(stmt) stmt |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
142 #else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
143 #define ONTRACE(stmt) /*stmt*/ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
144 #endif |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
145 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
146 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
147 /* This function assumes that there is no multibyte character in |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
148 current_text, so we can short-cut encoding. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
149 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
150 static HGLOBAL |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
151 convert_to_handle_as_ascii (void) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
152 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
153 HGLOBAL htext = NULL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
154 int nbytes; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
155 int truelen; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
156 unsigned char *src; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
157 unsigned char *dst; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
158 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
159 ONTRACE (fprintf (stderr, "convert_to_handle_as_ascii\n")); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
160 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
161 nbytes = SBYTES (current_text) + 1; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
162 src = SDATA (current_text); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
163 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
164 /* We need to add to the size the number of LF chars where we have |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
165 to insert CR chars (the standard CF_TEXT clipboard format uses |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
166 CRLF line endings, while Emacs uses just LF internally). */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
167 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
168 truelen = nbytes + current_num_nls; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
169 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
170 if ((htext = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, truelen)) == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
171 return NULL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
172 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
173 if ((dst = (unsigned char *) GlobalLock (htext)) == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
174 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
175 GlobalFree (htext); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
176 return NULL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
177 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
178 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
179 /* convert to CRLF line endings expected by clipboard */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
180 while (1) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
181 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
182 unsigned char *next; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
183 /* copy next line or remaining bytes including '\0' */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
184 next = _memccpy (dst, src, '\n', nbytes); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
185 if (next) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
186 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
187 /* copied one line ending with '\n' */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
188 int copied = next - dst; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
189 nbytes -= copied; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
190 src += copied; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
191 /* insert '\r' before '\n' */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
192 next[-1] = '\r'; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
193 next[0] = '\n'; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
194 dst = next + 1; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
195 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
196 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
197 /* copied remaining partial line -> now finished */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
198 break; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
199 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
200 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
201 GlobalUnlock (htext); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
202 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
203 return htext; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
204 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
205 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
206 /* This function assumes that there are multibyte or NUL characters in |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
207 current_text, or that we need to construct Unicode. It runs the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
208 text through the encoding machinery. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
209 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
210 static HGLOBAL |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
211 convert_to_handle_as_coded (Lisp_Object coding_system) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
212 { |
90157 | 213 HGLOBAL htext; |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
214 unsigned char *dst = NULL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
215 struct coding_system coding; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
216 |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
217 ONTRACE (fprintf (stderr, "convert_to_handle_as_coded: %s\n", |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
218 SDATA (SYMBOL_NAME (coding_system)))); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
219 |
90157 | 220 setup_windows_coding_system (coding_system, &coding); |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
221 coding.dst_bytes = SBYTES (current_text) * 2; |
90157 | 222 coding.destination = (unsigned char *) xmalloc (coding.dst_bytes); |
223 encode_coding_object (&coding, current_text, 0, 0, | |
224 SCHARS (current_text), SBYTES (current_text), Qnil); | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
225 |
90157 | 226 htext = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, coding.produced +2); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
227 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
228 if (htext != NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
229 dst = (unsigned char *) GlobalLock (htext); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
230 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
231 if (dst != NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
232 { |
90157 | 233 memcpy (dst, coding.destination, coding.produced); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
234 /* Add the string terminator. Add two NULs in case we are |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
235 producing Unicode here. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
236 dst[coding.produced] = dst[coding.produced+1] = '\0'; |
90157 | 237 |
238 GlobalUnlock (htext); | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
239 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
240 |
90157 | 241 xfree (coding.destination); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
242 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
243 return htext; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
244 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
245 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
246 static Lisp_Object |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
247 render (Lisp_Object oformat) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
248 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
249 HGLOBAL htext = NULL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
250 UINT format = XFASTINT (oformat); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
251 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
252 ONTRACE (fprintf (stderr, "render\n")); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
253 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
254 if (NILP (current_text)) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
255 return Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
256 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
257 if (current_requires_encoding || format == CF_UNICODETEXT) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
258 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
259 if (format == current_clipboard_type) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
260 htext = convert_to_handle_as_coded (current_coding_system); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
261 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
262 switch (format) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
263 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
264 case CF_UNICODETEXT: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
265 htext = convert_to_handle_as_coded (QUNICODE); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
266 break; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
267 case CF_TEXT: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
268 case CF_OEMTEXT: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
269 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
270 Lisp_Object cs; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
271 cs = coding_from_cp (cp_from_locale (current_lcid, format)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
272 htext = convert_to_handle_as_coded (cs); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
273 break; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
274 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
275 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
276 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
277 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
278 htext = convert_to_handle_as_ascii (); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
279 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
280 ONTRACE (fprintf (stderr, "render: htext = 0x%08X\n", (unsigned) htext)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
281 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
282 if (htext == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
283 return Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
284 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
285 if (SetClipboardData (format, htext) == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
286 { |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
287 GlobalFree (htext); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
288 return Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
289 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
290 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
291 return Qt; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
292 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
293 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
294 static Lisp_Object |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
295 render_locale (void) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
296 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
297 HANDLE hlocale = NULL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
298 LCID * lcid_ptr; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
299 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
300 ONTRACE (fprintf (stderr, "render_locale\n")); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
301 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
302 if (current_lcid == LOCALE_NEUTRAL || current_lcid == DEFAULT_LCID) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
303 return Qt; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
304 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
305 hlocale = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, sizeof (current_lcid)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
306 if (hlocale == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
307 return Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
308 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
309 if ((lcid_ptr = (LCID *) GlobalLock (hlocale)) == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
310 { |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
311 GlobalFree (hlocale); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
312 return Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
313 } |
33697
e7765cb122c3
(Fw32_set_clipboard_data): Save a copy of what is put on the clipboard.
Jason Rumney <jasonr@gnu.org>
parents:
31117
diff
changeset
|
314 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
315 *lcid_ptr = current_lcid; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
316 GlobalUnlock (hlocale); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
317 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
318 if (SetClipboardData (CF_LOCALE, hlocale) == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
319 { |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
320 GlobalFree (hlocale); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
321 return Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
322 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
323 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
324 return Qt; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
325 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
326 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
327 /* At the end of the program, we want to ensure that our clipboard |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
328 data survives us. This code will do that. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
329 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
330 static Lisp_Object |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
331 render_all (Lisp_Object ignore) |
13434 | 332 { |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
333 ONTRACE (fprintf (stderr, "render_all\n")); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
334 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
335 /* According to the docs we should not call OpenClipboard() here, |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
336 but testing on W2K and working code in other projects shows that |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
337 it is actually necessary. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
338 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
339 OpenClipboard (NULL); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
340 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
341 /* There is no usefull means to report errors here, there are none |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
342 expected anyway, and even if there were errors, they wouldn't do |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
343 any harm. So we just go ahead and do what has to be done without |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
344 bothering with error handling. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
345 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
346 ++modifying_clipboard; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
347 EmptyClipboard (); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
348 --modifying_clipboard; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
349 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
350 /* For text formats that we don't render here, the OS can use its |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
351 own translation rules instead, so we don't really need to offer |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
352 everything. To minimize memory consumption we cover three |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
353 possible situations based on our primary format as detected from |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
354 selection-coding-system (see setup_config()): |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
355 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
356 - Post CF_TEXT only. Let the OS convert to CF_OEMTEXT and the OS |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
357 (on NT) or the application (on 9x/Me) convert to |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
358 CF_UNICODETEXT. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
359 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
360 - Post CF_OEMTEXT only. Similar automatic conversions happen as |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
361 for CF_TEXT. |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
362 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
363 - Post CF_UNICODETEXT + CF_TEXT. 9x itself ignores |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
364 CF_UNICODETEXT, even though some applications can still handle |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
365 it. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
366 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
367 Note 1: We render the less capable CF_TEXT *before* the more |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
368 capable CF_UNICODETEXT, to prevent clobbering through automatic |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
369 conversions, just in case. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
370 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
371 Note 2: We could check os_subtype here and only render the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
372 additional CF_TEXT on 9x/Me. But OTOH with |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
373 current_clipboard_type == CF_UNICODETEXT we don't involve the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
374 automatic conversions anywhere else, so to get consistent |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
375 results, we probably don't want to rely on it here either. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
376 |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
377 render_locale (); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
378 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
379 if (current_clipboard_type == CF_UNICODETEXT) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
380 render (make_number (CF_TEXT)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
381 render (make_number (current_clipboard_type)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
382 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
383 CloseClipboard (); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
384 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
385 return Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
386 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
387 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
388 static void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
389 run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg) |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
390 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
391 /* FIXME: This works but it doesn't feel right. Too much fiddling |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
392 with global variables and calling strange looking functions. Is |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
393 this really the right way to run Lisp callbacks? */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
394 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
395 int owfi; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
396 |
13434 | 397 BLOCK_INPUT; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
398 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
399 /* Fsignal calls abort() if it sees that waiting_for_input is |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
400 set. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
401 owfi = waiting_for_input; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
402 waiting_for_input = 0; |
13434 | 403 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
404 internal_condition_case_1 (code, arg, Qt, lisp_error_handler); |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
405 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
406 waiting_for_input = owfi; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
407 |
13434 | 408 UNBLOCK_INPUT; |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
409 } |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
410 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
411 static Lisp_Object |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
412 lisp_error_handler (Lisp_Object error) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
413 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
414 Vsignaling_function = Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
415 cmd_error_internal (error, "Error in delayed clipboard rendering: "); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
416 Vinhibit_quit = Qt; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
417 return Qt; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
418 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
419 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
420 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
421 static LRESULT CALLBACK |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
422 owner_callback (HWND win, UINT msg, WPARAM wp, LPARAM lp) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
423 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
424 switch (msg) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
425 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
426 case WM_RENDERFORMAT: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
427 ONTRACE (fprintf (stderr, "WM_RENDERFORMAT\n")); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
428 run_protected (render, make_number (wp)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
429 return 0; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
430 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
431 case WM_RENDERALLFORMATS: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
432 ONTRACE (fprintf (stderr, "WM_RENDERALLFORMATS\n")); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
433 run_protected (render_all, Qnil); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
434 return 0; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
435 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
436 case WM_DESTROYCLIPBOARD: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
437 if (!modifying_clipboard) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
438 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
439 ONTRACE (fprintf (stderr, "WM_DESTROYCLIPBOARD (other)\n")); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
440 current_text = Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
441 current_coding_system = Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
442 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
443 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
444 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
445 ONTRACE (fprintf (stderr, "WM_DESTROYCLIPBOARD (self)\n")); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
446 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
447 return 0; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
448 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
449 case WM_DESTROY: |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
450 if (win == clipboard_owner) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
451 clipboard_owner = NULL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
452 break; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
453 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
454 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
455 return DefWindowProc (win, msg, wp, lp); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
456 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
457 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
458 static HWND |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
459 create_owner (void) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
460 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
461 static const char CLASSNAME[] = "Emacs Clipboard"; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
462 WNDCLASS wc; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
463 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
464 memset (&wc, 0, sizeof (wc)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
465 wc.lpszClassName = CLASSNAME; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
466 wc.lpfnWndProc = owner_callback; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
467 RegisterClass (&wc); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
468 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
469 return CreateWindow (CLASSNAME, CLASSNAME, 0, 0, 0, 0, 0, NULL, NULL, |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
470 NULL, NULL); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
471 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
472 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
473 /* Called on exit by term_ntproc() in w32.c */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
474 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
475 void |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
476 term_w32select (void) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
477 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
478 /* This is needed to trigger WM_RENDERALLFORMATS. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
479 if (clipboard_owner != NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
480 DestroyWindow (clipboard_owner); |
13434 | 481 } |
482 | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
483 static void |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
484 setup_config (void) |
13434 | 485 { |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
486 const char *coding_name; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
487 const char *cp; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
488 char *end; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
489 int slen; |
90157 | 490 Lisp_Object coding_system; |
491 Lisp_Object dos_coding_system; | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
492 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
493 CHECK_SYMBOL (Vselection_coding_system); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
494 |
90157 | 495 coding_system = NILP (Vnext_selection_coding_system) ? |
496 Vselection_coding_system : Vnext_selection_coding_system; | |
497 | |
498 dos_coding_system = validate_coding_system (coding_system); | |
499 if (NILP (dos_coding_system)) | |
500 Fsignal (Qerror, | |
501 list2 (build_string ("Coding system is invalid or doesn't have " | |
502 "an eol variant for dos line ends"), | |
503 coding_system)); | |
504 | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
505 /* Check if we have it cached */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
506 if (!NILP (cfg_coding_system) |
90157 | 507 && EQ (cfg_coding_system, dos_coding_system)) |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
508 return; |
90157 | 509 cfg_coding_system = dos_coding_system; |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
510 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
511 /* Set some sensible fallbacks */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
512 cfg_codepage = ANSICP; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
513 cfg_lcid = LOCALE_NEUTRAL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
514 cfg_clipboard_type = CF_TEXT; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
515 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
516 /* Interpret the coding system symbol name */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
517 coding_name = SDATA (SYMBOL_NAME (cfg_coding_system)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
518 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
519 /* "(.*-)?utf-16.*" -> CF_UNICODETEXT */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
520 cp = strstr (coding_name, "utf-16"); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
521 if (cp != NULL && (cp == coding_name || cp[-1] == '-')) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
522 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
523 cfg_clipboard_type = CF_UNICODETEXT; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
524 return; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
525 } |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
526 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
527 /* "cp[0-9]+.*" or "windows-[0-9]+.*" -> CF_TEXT or CF_OEMTEXT */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
528 slen = strlen (coding_name); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
529 if (slen >= 4 && coding_name[0] == 'c' && coding_name[1] == 'p') |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
530 cp = coding_name + 2; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
531 else if (slen >= 10 && memcmp (coding_name, "windows-", 8) == 0) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
532 cp = coding_name + 8; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
533 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
534 return; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
535 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
536 end = (char*)cp; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
537 cfg_codepage = strtol (cp, &end, 10); |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
538 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
539 /* Error return from strtol() or number of digits < 2 -> Restore the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
540 default and drop it. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
541 if (cfg_codepage == 0 || (end-cp) < 2 ) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
542 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
543 cfg_codepage = ANSICP; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
544 return; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
545 } |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
546 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
547 /* Is it the currently active system default? */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
548 if (cfg_codepage == ANSICP) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
549 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
550 /* cfg_clipboard_type = CF_TEXT; */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
551 return; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
552 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
553 if (cfg_codepage == OEMCP) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
554 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
555 cfg_clipboard_type = CF_OEMTEXT; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
556 return; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
557 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
558 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
559 /* Else determine a suitable locale the hard way. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
560 EnumSystemLocales (enum_locale_callback, LCID_INSTALLED); |
13434 | 561 } |
562 | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
563 static BOOL WINAPI |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
564 enum_locale_callback (/*const*/ char* loc_string) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
565 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
566 LCID lcid; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
567 UINT codepage; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
568 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
569 lcid = strtoul (loc_string, NULL, 16); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
570 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
571 /* Is the wanted codepage the "ANSI" codepage for this locale? */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
572 codepage = cp_from_locale (lcid, CF_TEXT); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
573 if (codepage == cfg_codepage) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
574 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
575 cfg_lcid = lcid; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
576 cfg_clipboard_type = CF_TEXT; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
577 return FALSE; /* Stop enumeration */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
578 } |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
579 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
580 /* Is the wanted codepage the OEM codepage for this locale? */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
581 codepage = cp_from_locale (lcid, CF_OEMTEXT); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
582 if (codepage == cfg_codepage) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
583 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
584 cfg_lcid = lcid; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
585 cfg_clipboard_type = CF_OEMTEXT; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
586 return FALSE; /* Stop enumeration */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
587 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
588 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
589 return TRUE; /* Continue enumeration */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
590 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
591 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
592 static UINT |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
593 cp_from_locale (LCID lcid, UINT format) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
594 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
595 char buffer[20] = ""; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
596 UINT variant, cp; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
597 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
598 variant = |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
599 format == CF_TEXT ? LOCALE_IDEFAULTANSICODEPAGE : LOCALE_IDEFAULTCODEPAGE; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
600 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
601 GetLocaleInfo (lcid, variant, buffer, sizeof (buffer)); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
602 cp = strtoul (buffer, NULL, 10); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
603 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
604 if (cp == CP_ACP) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
605 return ANSICP; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
606 else if (cp == CP_OEMCP) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
607 return OEMCP; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
608 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
609 return cp; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
610 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
611 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
612 static Lisp_Object |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
613 coding_from_cp (UINT codepage) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
614 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
615 char buffer[30]; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
616 sprintf (buffer, "cp%d-dos", (int) codepage); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
617 return intern (buffer); |
90157 | 618 /* We don't need to check that this coding system actually exists |
619 right here, because that is done later for all coding systems | |
620 used, regardless of where they originate. */ | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
621 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
622 |
90157 | 623 static Lisp_Object |
624 validate_coding_system (Lisp_Object coding_system) | |
625 { | |
626 Lisp_Object eol_type; | |
627 | |
628 /* Make sure the input is valid. */ | |
629 if (NILP (Fcoding_system_p (coding_system))) | |
630 return Qnil; | |
631 | |
632 /* Make sure we use a DOS coding system as mandated by the system | |
633 specs. */ | |
634 eol_type = Fcoding_system_eol_type (coding_system); | |
635 | |
636 /* Already a DOS coding system? */ | |
637 if (EQ (eol_type, make_number (1))) | |
638 return coding_system; | |
639 | |
640 /* Get EOL_TYPE vector of the base of CODING_SYSTEM. */ | |
641 if (!VECTORP (eol_type)) | |
642 { | |
643 eol_type = Fcoding_system_eol_type (Fcoding_system_base (coding_system)); | |
644 if (!VECTORP (eol_type)) | |
645 return Qnil; | |
646 } | |
647 | |
648 return AREF (eol_type, 1); | |
649 } | |
650 | |
651 static void | |
652 setup_windows_coding_system (Lisp_Object coding_system, | |
653 struct coding_system * coding) | |
654 { | |
655 memset (coding, 0, sizeof (*coding)); | |
656 setup_coding_system (coding_system, coding); | |
657 | |
658 /* Unset CODING_ANNOTATE_COMPOSITION_MASK. Previous code had | |
659 comments about crashes in encode_coding_iso2022 trying to | |
660 dereference a null pointer when composition was on. Selection | |
661 data should not contain any composition sequence on Windows. | |
662 | |
663 CODING_ANNOTATION_MASK also includes | |
664 CODING_ANNOTATE_DIRECTION_MASK and CODING_ANNOTATE_CHARSET_MASK, | |
665 which both apply to ISO6429 only. We don't know if these really | |
666 need to be unset on Windows, but it probably doesn't hurt | |
667 either. */ | |
668 coding->mode &= ~CODING_ANNOTATION_MASK; | |
669 coding->mode |= CODING_MODE_LAST_BLOCK | CODING_MODE_SAFE_ENCODING; | |
670 } | |
671 | |
672 | |
13434 | 673 |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
674 DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
675 Sw32_set_clipboard_data, 1, 2, 0, |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
676 doc: /* This sets the clipboard data to the given text. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109160
diff
changeset
|
677 (Lisp_Object string, Lisp_Object ignored) |
13434 | 678 { |
679 BOOL ok = TRUE; | |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
680 int nbytes; |
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
681 unsigned char *src; |
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
682 unsigned char *dst; |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
683 unsigned char *end; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
684 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
685 /* This parameter used to be the current frame, but we don't use |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
686 that any more. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
687 (void) ignored; |
24518
a0423d2b9302
(Fw32_set_clipboard_data): Take into account line
Andrew Innes <andrewi@gnu.org>
parents:
23874
diff
changeset
|
688 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
33697
diff
changeset
|
689 CHECK_STRING (string); |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
690 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
691 setup_config (); |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
692 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
693 current_text = string; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
694 current_coding_system = cfg_coding_system; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
695 current_clipboard_type = cfg_clipboard_type; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
696 current_lcid = cfg_lcid; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
697 current_num_nls = 0; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
698 current_requires_encoding = 0; |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
699 |
13434 | 700 BLOCK_INPUT; |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
701 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
702 /* Check for non-ASCII characters. While we are at it, count the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
703 number of LFs, so we know how many CRs we will have to add later |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
704 (just in the case where we can use our internal ASCII rendering, |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
705 see code and comment in convert_to_handle_as_ascii() above). */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
706 nbytes = SBYTES (string); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45988
diff
changeset
|
707 src = SDATA (string); |
24518
a0423d2b9302
(Fw32_set_clipboard_data): Take into account line
Andrew Innes <andrewi@gnu.org>
parents:
23874
diff
changeset
|
708 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
709 for (dst = src, end = src+nbytes; dst < end; dst++) |
24518
a0423d2b9302
(Fw32_set_clipboard_data): Take into account line
Andrew Innes <andrewi@gnu.org>
parents:
23874
diff
changeset
|
710 { |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
711 if (*dst == '\n') |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
712 current_num_nls++; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
713 else if (*dst >= 0x80 || *dst == 0) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
714 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
715 current_requires_encoding = 1; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
716 break; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
717 } |
24518
a0423d2b9302
(Fw32_set_clipboard_data): Take into account line
Andrew Innes <andrewi@gnu.org>
parents:
23874
diff
changeset
|
718 } |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
719 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
720 if (!current_requires_encoding) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
721 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
722 /* If all we have is ASCII we don't need to pretend we offer |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
723 anything fancy. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
724 current_coding_system = Qraw_text; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
725 current_clipboard_type = CF_TEXT; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
726 current_lcid = LOCALE_NEUTRAL; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
727 } |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
728 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
729 if (!OpenClipboard (clipboard_owner)) |
13434 | 730 goto error; |
33697
e7765cb122c3
(Fw32_set_clipboard_data): Save a copy of what is put on the clipboard.
Jason Rumney <jasonr@gnu.org>
parents:
31117
diff
changeset
|
731 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
732 ++modifying_clipboard; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
733 ok = EmptyClipboard (); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
734 --modifying_clipboard; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
735 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
736 /* If we have something non-ASCII we may want to set a locale. We |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
737 do that directly (non-delayed), as it's just a small bit. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
738 if (ok) |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
739 ok = !NILP (render_locale ()); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
740 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
741 if (ok) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
742 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
743 if (clipboard_owner == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
744 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
745 /* If for some reason we don't have a clipboard_owner, we |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
746 just set the text format as chosen by the configuration |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
747 and than forget about the whole thing. */ |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
748 ok = !NILP (render (make_number (current_clipboard_type))); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
749 current_text = Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
750 current_coding_system = Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
751 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
752 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
753 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
754 /* Advertise all supported formats so that whatever the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
755 requester chooses, only one encoding step needs to be |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
756 made. This is intentionally different from what we do in |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
757 the handler for WM_RENDERALLFORMATS. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
758 SetClipboardData (CF_UNICODETEXT, NULL); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
759 SetClipboardData (CF_TEXT, NULL); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
760 SetClipboardData (CF_OEMTEXT, NULL); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
761 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
762 } |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
763 |
54974
64d01f3f16e5
(Fw32_set_clipboard_data): Get sequence number after closing the clipboard.
Jason Rumney <jasonr@gnu.org>
parents:
53798
diff
changeset
|
764 CloseClipboard (); |
64d01f3f16e5
(Fw32_set_clipboard_data): Get sequence number after closing the clipboard.
Jason Rumney <jasonr@gnu.org>
parents:
53798
diff
changeset
|
765 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
766 /* With delayed rendering we haven't really "used" this coding |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
767 system yet, and it's even unclear if we ever will. But this is a |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
768 way to tell the upper level what we *would* use under ideal |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
769 circumstances. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
770 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
771 We don't signal the actually used coding-system later when we |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
772 finally render, because that can happen at any time and we don't |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
773 want to disturb the "foreground" action. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
774 if (ok) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
775 Vlast_coding_system_used = current_coding_system; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
776 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
777 Vnext_selection_coding_system = Qnil; |
51777
940c7de274a2
(last_clipboard_sequence_number): New variable.
Jason Rumney <jasonr@gnu.org>
parents:
47879
diff
changeset
|
778 |
13434 | 779 if (ok) goto done; |
780 | |
781 error: | |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
782 |
13434 | 783 ok = FALSE; |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
784 current_text = Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
785 current_coding_system = Qnil; |
51777
940c7de274a2
(last_clipboard_sequence_number): New variable.
Jason Rumney <jasonr@gnu.org>
parents:
47879
diff
changeset
|
786 |
13434 | 787 done: |
788 UNBLOCK_INPUT; | |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
789 |
13434 | 790 return (ok ? string : Qnil); |
791 } | |
792 | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
793 |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
794 DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
795 Sw32_get_clipboard_data, 0, 1, 0, |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
796 doc: /* This gets the clipboard data in text format. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109160
diff
changeset
|
797 (Lisp_Object ignored) |
13434 | 798 { |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
799 HGLOBAL htext; |
13434 | 800 Lisp_Object ret = Qnil; |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
801 UINT actual_clipboard_type; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
802 int use_configured_coding_system = 1; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
803 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
804 /* This parameter used to be the current frame, but we don't use |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
805 that any more. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
806 (void) ignored; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
807 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
808 /* Don't pass our own text from the clipboard (which might be |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
809 troublesome if the killed text includes null characters). */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
810 if (!NILP (current_text)) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
811 return ret; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
812 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
813 setup_config (); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
814 actual_clipboard_type = cfg_clipboard_type; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
815 |
13434 | 816 BLOCK_INPUT; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
817 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
818 if (!OpenClipboard (clipboard_owner)) |
13434 | 819 goto done; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
820 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
821 if ((htext = GetClipboardData (actual_clipboard_type)) == NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
822 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
823 /* If we want CF_UNICODETEXT but can't get it, the current |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
824 coding system is useless. OTOH we can still try and decode |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
825 CF_TEXT based on the locale that the system gives us and that |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
826 we get down below. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
827 if (actual_clipboard_type == CF_UNICODETEXT) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
828 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
829 htext = GetClipboardData (CF_TEXT); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
830 if (htext != NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
831 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
832 actual_clipboard_type = CF_TEXT; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
833 use_configured_coding_system = 0; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
834 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
835 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
836 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
837 if (htext == NULL) |
13434 | 838 goto closeclip; |
839 | |
840 { | |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
841 unsigned char *src; |
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
842 unsigned char *dst; |
13434 | 843 int nbytes; |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
844 int truelen; |
23835
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
845 int require_decoding = 0; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
846 |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
847 if ((src = (unsigned char *) GlobalLock (htext)) == NULL) |
13434 | 848 goto closeclip; |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
849 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
850 /* If the clipboard data contains any non-ascii code, we need to |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
851 decode it with a coding system. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
852 if (actual_clipboard_type == CF_UNICODETEXT) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
853 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
854 nbytes = lstrlenW ((WCHAR *)src) * 2; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
855 require_decoding = 1; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
856 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
857 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
858 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
859 int i; |
33697
e7765cb122c3
(Fw32_set_clipboard_data): Save a copy of what is put on the clipboard.
Jason Rumney <jasonr@gnu.org>
parents:
31117
diff
changeset
|
860 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
861 nbytes = strlen (src); |
23562
5f3243813b18
(Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23422
diff
changeset
|
862 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
863 for (i = 0; i < nbytes; i++) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
864 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
865 if (src[i] >= 0x80) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
866 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
867 require_decoding = 1; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
868 break; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
869 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
870 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
871 } |
43483
dcb45a76827f
(Fw32_set_clipboard_data): Run pre-write-conversion
Jason Rumney <jasonr@gnu.org>
parents:
40962
diff
changeset
|
872 |
23835
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
873 if (require_decoding) |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
874 { |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
875 struct coding_system coding; |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
876 Lisp_Object coding_system = Qnil; |
90157 | 877 Lisp_Object dos_coding_system; |
110994
734b2470f93c
src/w32*.c: Whitespace fixes and typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
878 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
879 /* `next-selection-coding-system' should override everything, |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
880 even when the locale passed by the system disagrees. The |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
881 only exception is when `next-selection-coding-system' |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
882 requested CF_UNICODETEXT and we couldn't get that. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
883 if (use_configured_coding_system |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
884 && !NILP (Vnext_selection_coding_system)) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
885 coding_system = Vnext_selection_coding_system; |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
886 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
887 /* If we have CF_TEXT or CF_OEMTEXT, we want to check out |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
888 CF_LOCALE, too. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
889 else if (actual_clipboard_type != CF_UNICODETEXT) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
890 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
891 HGLOBAL hlocale; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
892 LCID lcid = DEFAULT_LCID; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
893 UINT cp; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
894 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
895 /* Documentation says that the OS always generates |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
896 CF_LOCALE info automatically, so the locale handle |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
897 should always be present. Fact is that this is not |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
898 always true on 9x ;-(. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
899 hlocale = GetClipboardData (CF_LOCALE); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
900 if (hlocale != NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
901 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
902 const LCID * lcid_ptr; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
903 lcid_ptr = (const LCID *) GlobalLock (hlocale); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
904 if (lcid_ptr != NULL) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
905 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
906 lcid = *lcid_ptr; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
907 GlobalUnlock (hlocale); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
908 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
909 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
910 /* 9x has garbage as the sort order (to be exact there |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
911 is another instance of the language id in the upper |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
912 word). We don't care about sort order anyway, so |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
913 we just filter out the unneeded mis-information to |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
914 avoid irritations. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
915 lcid = MAKELCID (LANGIDFROMLCID (lcid), SORT_DEFAULT); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
916 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
917 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
918 /* If we are using fallback from CF_UNICODETEXT, we can't |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
919 use the configured coding system. Also we don't want |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
920 to use it, if the system has supplied us with a locale |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
921 and it is not just the system default. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
922 if (!use_configured_coding_system || lcid != DEFAULT_LCID) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
923 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
924 cp = cp_from_locale (lcid, actual_clipboard_type); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
925 /* If it's just our current standard setting anyway, |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
926 use the coding system that the user has selected. |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
927 Otherwise create a new spec to match the locale |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
928 that was specified by the other side or the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
929 system. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
930 if (!use_configured_coding_system || cp != cfg_codepage) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
931 coding_system = coding_from_cp (cp); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
932 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
933 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
934 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
935 if (NILP (coding_system)) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
936 coding_system = Vselection_coding_system; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
937 Vnext_selection_coding_system = Qnil; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
938 |
90157 | 939 dos_coding_system = validate_coding_system (coding_system); |
940 if (!NILP (dos_coding_system)) | |
941 { | |
942 setup_windows_coding_system (dos_coding_system, &coding); | |
943 coding.source = src; | |
944 decode_coding_object (&coding, Qnil, 0, 0, nbytes, nbytes, Qt); | |
945 ret = coding.dst_object; | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
946 |
90157 | 947 Vlast_coding_system_used = CODING_ID_NAME (coding.id); |
948 } | |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
949 } |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
950 else |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
951 { |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
952 /* FIXME: We may want to repeat the code in this branch for |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
953 the Unicode case. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
954 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
955 /* Need to know final size after CR chars are removed because |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
956 we can't change the string size manually, and doing an |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
957 extra copy is silly. We only remove CR when it appears as |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
958 part of CRLF. */ |
13434 | 959 |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
960 truelen = nbytes; |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
961 dst = src; |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
962 /* avoid using strchr because it recomputes the length everytime */ |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
963 while ((dst = memchr (dst, '\r', nbytes - (dst - src))) != NULL) |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
964 { |
23835
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
965 if (dst[1] == '\n') /* safe because of trailing '\0' */ |
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
966 truelen--; |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
967 dst++; |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
968 } |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
969 |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
970 ret = make_uninit_string (truelen); |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
971 |
23835
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
972 /* Convert CRLF line endings (the standard CF_TEXT clipboard |
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
973 format) to LF endings as used internally by Emacs. */ |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
974 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45988
diff
changeset
|
975 dst = SDATA (ret); |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
976 while (1) |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
977 { |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
978 unsigned char *next; |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
979 /* copy next line or remaining bytes excluding '\0' */ |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
980 next = _memccpy (dst, src, '\r', nbytes); |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
981 if (next) |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
982 { |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
983 /* copied one line ending with '\r' */ |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
984 int copied = next - dst; |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
985 nbytes -= copied; |
23835
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
986 dst += copied; |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
987 src += copied; |
23835
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
988 if (*src == '\n') |
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
989 dst--; /* overwrite '\r' with '\n' */ |
ad04307ef465
(Fw32_get_clipboard_data): Do not delete isolated CR
Geoff Voelker <voelker@cs.washington.edu>
parents:
23562
diff
changeset
|
990 } |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
991 else |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
992 /* copied remaining partial line -> now finished */ |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
993 break; |
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
994 } |
22745
ef9607e709bc
(Fw32_set_clipboard_data): Set Vlast_coding_system_used.
Andrew Innes <andrewi@gnu.org>
parents:
22545
diff
changeset
|
995 |
ef9607e709bc
(Fw32_set_clipboard_data): Set Vlast_coding_system_used.
Andrew Innes <andrewi@gnu.org>
parents:
22545
diff
changeset
|
996 Vlast_coding_system_used = Qraw_text; |
15150
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
997 } |
e37489592e27
(Fwin32_set_clipboard_data, Fwin32_get_clipboard_data):
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
998 |
13434 | 999 GlobalUnlock (htext); |
1000 } | |
1001 | |
1002 closeclip: | |
1003 CloseClipboard (); | |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
1004 |
13434 | 1005 done: |
1006 UNBLOCK_INPUT; | |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
1007 |
13434 | 1008 return (ret); |
1009 } | |
1010 | |
15235 | 1011 /* Support checking for a clipboard selection. */ |
1012 | |
1013 DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, | |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1014 0, 1, 0, |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1015 doc: /* Whether there is an owner for the given X Selection. |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1016 The arg should be the name of the selection in question, typically one of |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1017 the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1018 \(Those are literal upper-case symbol names, since that's what X expects.) |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1019 For convenience, the symbol nil is the same as `PRIMARY', |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1020 and t is the same as `SECONDARY'. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109160
diff
changeset
|
1021 (Lisp_Object selection) |
15235 | 1022 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
33697
diff
changeset
|
1023 CHECK_SYMBOL (selection); |
15235 | 1024 |
1025 /* Return nil for PRIMARY and SECONDARY selections; for CLIPBOARD, check | |
1026 if the clipboard currently has valid text format contents. */ | |
1027 | |
1028 if (EQ (selection, QCLIPBOARD)) | |
1029 { | |
1030 Lisp_Object val = Qnil; | |
1031 | |
90157 | 1032 setup_config (); |
1033 | |
15235 | 1034 if (OpenClipboard (NULL)) |
1035 { | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1036 UINT format = 0; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1037 while ((format = EnumClipboardFormats (format))) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1038 /* Check CF_TEXT in addition to cfg_clipboard_type, |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1039 because we can fall back on that if CF_UNICODETEXT is |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1040 not available. Actually a check for CF_TEXT only |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1041 should be enough. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1042 if (format == cfg_clipboard_type || format == CF_TEXT) |
15235 | 1043 { |
1044 val = Qt; | |
1045 break; | |
1046 } | |
1047 CloseClipboard (); | |
1048 } | |
1049 return val; | |
1050 } | |
1051 return Qnil; | |
1052 } | |
1053 | |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1054 /* One-time init. Called in the un-dumped Emacs, but not in the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1055 dumped version. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1056 |
47879
4ef507bc376e
(syms_of_win32select): Fix docstring for `selection-coding-system'.
Juanma Barranquero <lekktu@gmail.com>
parents:
47280
diff
changeset
|
1057 void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1058 syms_of_w32select (void) |
13434 | 1059 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15235
diff
changeset
|
1060 defsubr (&Sw32_set_clipboard_data); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15235
diff
changeset
|
1061 defsubr (&Sw32_get_clipboard_data); |
15235 | 1062 defsubr (&Sx_selection_exists_p); |
1063 | |
112364
42e22c4f06b7
Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents:
112284
diff
changeset
|
1064 DEFVAR_LISP ("selection-coding-system", Vselection_coding_system, |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1065 doc: /* Coding system for communicating with other programs. |
111136
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1066 |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1067 For MS-Windows and MS-DOS: |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1068 When sending or receiving text via selection and clipboard, the text |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1069 is encoded or decoded by this coding system. The default value is |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1070 the current system default encoding on 9x/Me, `utf-16le-dos' |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1071 \(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS. |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1072 |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1073 For X Windows: |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1074 When sending text via selection and clipboard, if the target |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1075 data-type matches with the type of this coding system, it is used |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1076 for encoding the text. Otherwise (including the case that this |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1077 variable is nil), a proper coding system is used as below: |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1078 |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1079 data-type coding system |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1080 --------- ------------- |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1081 UTF8_STRING utf-8 |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1082 COMPOUND_TEXT compound-text-with-extensions |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1083 STRING iso-latin-1 |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1084 C_STRING no-conversion |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1085 |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1086 When receiving text, if this coding system is non-nil, it is used |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1087 for decoding regardless of the data-type. If this is nil, a |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1088 proper coding system is used according to the data-type as above. |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1089 |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1090 See also the documentation of the variable `x-select-request-type' how |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1091 to control which data-type to request for receiving text. |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1092 |
bc1274182cc8
Sync docs of selection-coding-system between C and Lisp.
Glenn Morris <rgm@gnu.org>
parents:
111135
diff
changeset
|
1093 The default value is nil. */); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1094 /* The actual value is set dynamically in the dumped Emacs, see |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1095 below. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1096 Vselection_coding_system = Qnil; |
22545
5d3f50b4c8d2
Include buffer.h, charset.h, and coding.h.
Andrew Innes <andrewi@gnu.org>
parents:
16884
diff
changeset
|
1097 |
112364
42e22c4f06b7
Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents:
112284
diff
changeset
|
1098 DEFVAR_LISP ("next-selection-coding-system", Vnext_selection_coding_system, |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1099 doc: /* Coding system for the next communication with other programs. |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
1100 Usually, `selection-coding-system' is used for communicating with |
111135
600f564fdc23
Sync Lisp and C docs of next-selection-coding-system.
Glenn Morris <rgm@gnu.org>
parents:
110997
diff
changeset
|
1101 other programs (X Windows clients or MS Windows programs). But, if this |
600f564fdc23
Sync Lisp and C docs of next-selection-coding-system.
Glenn Morris <rgm@gnu.org>
parents:
110997
diff
changeset
|
1102 variable is set, it is used for the next communication only. |
600f564fdc23
Sync Lisp and C docs of next-selection-coding-system.
Glenn Morris <rgm@gnu.org>
parents:
110997
diff
changeset
|
1103 After the communication, this variable is set to nil. */); |
23562
5f3243813b18
(Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23422
diff
changeset
|
1104 Vnext_selection_coding_system = Qnil; |
5f3243813b18
(Vnext_selection_coding_system): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23422
diff
changeset
|
1105 |
90922
a4f75e39ca14
(syms_of_w32select): Use DEFSYM macro.
Jason Rumney <jasonr@gnu.org>
parents:
90737
diff
changeset
|
1106 DEFSYM (QCLIPBOARD, "CLIPBOARD"); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1107 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1108 cfg_coding_system = Qnil; staticpro (&cfg_coding_system); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1109 current_text = Qnil; staticpro (¤t_text); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1110 current_coding_system = Qnil; staticpro (¤t_coding_system); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1111 |
90922
a4f75e39ca14
(syms_of_w32select): Use DEFSYM macro.
Jason Rumney <jasonr@gnu.org>
parents:
90737
diff
changeset
|
1112 DEFSYM (QUNICODE, "utf-16le-dos"); |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1113 QANSICP = Qnil; staticpro (&QANSICP); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1114 QOEMCP = Qnil; staticpro (&QOEMCP); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1115 } |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1116 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1117 /* One-time init. Called in the dumped Emacs, but not in the |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1118 un-dumped version. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1119 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1120 void |
109152
e27859da5624
src/w32*.c: Convert function definitions to standard C.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
1121 globals_of_w32select (void) |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1122 { |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1123 DEFAULT_LCID = GetUserDefaultLCID (); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1124 /* Drop the sort order from the LCID, so we can compare this with |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1125 CF_LOCALE objects that have the same fix on 9x. */ |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1126 DEFAULT_LCID = MAKELCID (LANGIDFROMLCID (DEFAULT_LCID), SORT_DEFAULT); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1127 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1128 ANSICP = GetACP (); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1129 OEMCP = GetOEMCP (); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1130 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1131 QANSICP = coding_from_cp (ANSICP); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1132 QOEMCP = coding_from_cp (OEMCP); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1133 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1134 if (os_subtype == OS_NT) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1135 Vselection_coding_system = QUNICODE; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1136 else if (inhibit_window_system) |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1137 Vselection_coding_system = QOEMCP; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1138 else |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1139 Vselection_coding_system = QANSICP; |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1140 |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
56299
diff
changeset
|
1141 clipboard_owner = create_owner (); |
13434 | 1142 } |
52401 | 1143 |