summaryrefslogtreecommitdiff
path: root/src/xselect.c
Commit message (Collapse)AuthorAge
* Merge from origin/emacs-29Eli Zaretskii2023-01-01
|\ | | | | | | | | | | | | | | | | | | | | cae528457c ; Add 2023 to copyright years. b394359261 Improve documentation of 'isearch-open-overlay-temporary' ab3210e709 Document 'use-package' in the 2 main manuals # Conflicts: # etc/refcards/ru-refcard.tex # lib/explicit_bzero.c # m4/explicit_bzero.m4
| * ; Add 2023 to copyright years.Eli Zaretskii2023-01-01
| |
* | Handle selection transfer errors earlierPo Lu2022-12-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xselect.c (x_decline_selection_request, struct transfer) (struct x_selection_request, x_cancel_selection_transfer) (x_start_selection_transfer, x_continue_selection_transfer): Give the right serial to x_ignore_errors_for_next_request. (x_handle_selection_error): New function. (x_reply_selection_request): Give the right serial to x_ignore_errors_for_next_request. * src/xterm.c (x_ignore_errors_for_next_request): New arg `selection_serial'. All callers changed. (x_error_handler): Call selection error handler. * src/xterm.h (struct x_failable_request): New field `selection_serial'.
* | Remove conversion_fail_tag from selection requestsPo Lu2022-12-08
| | | | | | | | | | | | | | | | | | | | * src/xselect.c (struct x_selection_request): Delete `conversion_fail_tag'. (x_push_current_selection_request, x_start_selection_transfer): Stop checking against conversion_fail_tag. (x_handle_selection_request): Adjust callers. (x_convert_selection): Remove arg `for_multiple'. Never link nonconvertible data onto frame->converted_selections.
* | Fix potential crash deselecting for property change notificationsPo Lu2022-12-04
| | | | | | | | | | * src/xselect.c (x_cancel_selection_transfer): Catch errors around XSelectInput.
* | More behind the scenes transparent speedups around xselect.cPo Lu2022-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (display_menu_bar): Fix compiler warning about NULL pointer dereference. * src/xfns.c (Fx_begin_drag): Use x_intern_atoms. (Fx_change_window_property): Pass dpyinfo to x_fill_property_data. * src/xselect.c (lisp_data_to_selection_data): Use x_intern_atoms instead of syncing for each atom. (x_fill_property_data, x_send_client_event): Use x_intern_cached_atom. * src/xterm.c (x_intern_atoms): New function. * src/xterm.h: Update prototypes.
* | Remove unnecessary error checks in xselect.cPo Lu2022-12-01
| | | | | | | | | | | | * src/xselect.c (x_own_selection): Don't sync around XSetSelectionOwner, as the atom and window specified are always correct.
* | ; * src/xselect.c (syms_of_xselect_for_pdumper): Fix last change.Po Lu2022-12-01
| | | | | | | | Author:
* | Fix pdumper buildPo Lu2022-12-01
| | | | | | | | | | * src/xselect.c (mark_xselect): Don't mark if outstanding_transfers.next is still NULL.
* | Speed up handling X selection requestsPo Lu2022-12-01
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/NEWS: Announce speedup. * src/alloc.c (garbage_collect): Call mark_xselect. * src/xftfont.c (xftfont_end_for_frame): Fix crash on display IO error. * src/xselect.c (struct selection_data, struct transfer): New structures. (outstading_transfers): New variable. (SELECTED_EVENTS, x_selection_request_lisp_error): Stop checking cs->nofree. (x_catch_errors_unwind): Delete function. (c_size_for_format, x_size_for_format, selection_data_for_offset) (selection_data_size, transfer_selecting_event) (x_continue_selection_transfer, x_remove_selection_transfers) (x_selection_transfer_timeout): New functions. (x_reply_selection_request): When handling selection requests, never wait for property notifications synchronously. Instead, write out the selection data as the client reads it from the event loop. (x_handle_selection_request, x_convert_selection) (x_handle_property_notify, x_get_window_property) (lisp_data_to_selection_data): Don't ever use pointers to Lisp string data! Instead, just store the string object itself. (syms_of_xselect): Initialize outstanding transfer list. (syms_of_xselect_for_pdumper): * src/xterm.c (x_delete_display): Remove outstanding selection transfers. * src/xterm.h: Update prototypes.
* Reduce wasted cycles in x*.cPo Lu2022-11-26
| | | | | | * src/xfns.c (compute_tip_xy, Fx_show_tip): * src/xselect.c (x_own_selection, x_get_local_selection) (x_clear_frame_selections): Call CAR and CDR, not Fcar and Fcdr.
* ; Fix typosStefan Kangas2022-11-20
|
* ; * src/xselect.c (x_handle_selection_request): Fix typo in last change.Po Lu2022-11-12
|
* Fix implementation of MULTIPLEPo Lu2022-11-12
| | | | | * src/xselect.c (x_handle_selection_request): Make sure the type of a reply to a MULTIPLE request is ATOM_PAIR.
* Fix drag-and-drop bugs on Lucid buildPo Lu2022-10-25
| | | | | | | | | | | | | | | | | Also, optimize Fx_translate_coordinates to avoid excessive calls to _XReply. * lisp/x-dnd.el (x-dnd-get-drop-rectangle): Return empty drop rectangle if posn-area. * src/xfns.c (Fx_translate_coordinates): Accept arg `require_child'. If not set, allow optimizations based on cached position data. * src/xselect.c (x_handle_dnd_message): Use x_translate_coordinates. * src/xterm.c (x_translate_coordinates): Export function. (x_handle_translate_coordinates): New function. (handle_one_xevent): Fix coding style. * src/xterm.h: Update prototypes.
* Fix pieces of code being too expensive over slow network connectionsPo Lu2022-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/menu-bar.el (menu-bar-edit-menu): Test buffer-read-only before gui-backend-selection-exists-p. This places the less expensive condition before the more expensive one. * src/xfns.c (compute_tip_xy): Use cached monitor attributes whenever available. (Fx_show_tip): Remove code that really did nothing. (Fx_backspace_delete_keys_p): Do not download the entire keymap from the server upon creating a frame. * src/xmenu.c (create_and_show_popup_menu): Use x_translate_coordinates_to_root. (x_menu_show): Use x_translate_coordinates_to_root. * src/xselect.c (Fx_selection_exists_p): If a temporary selection owner can be found, use it. * src/xterm.c (x_translate_coordinates_to_root) (x_handle_selection_monitor_event, x_find_selection_owner): New functions. These functions try to avoid downloading data from the X server in places that are called very often (i.e. during tool bar updates.) (handle_one_xevent): Handle selection notify events. Also catch some mistakes found. Fetch all kinds of key names as well. (x_create_special_window): New function. (x_term_init, x_delete_display): Ask for all key names. Also, passively monitor selections that are given to `x-selection-exists-p' during redisplay, so we do not have to ask the server about them upon each redisplay. (syms_of_xterm): New variable `x-fast-selection-list'. * src/xterm.h (struct x_monitored_selection): New structure. (X_INVALID_WINDOW): New define. (struct x_display_info): New fields for selection monitoring. Also, record the fixes extension base.
* Fix crash while converting empty vector to X dataPo Lu2022-09-05
| | | | | | * src/xselect.c (lisp_data_to_selection_data): Assume an empty vector represents INTEGER data, instead of blindly trying to aref it's first element.
* Fix junk data being returned with incremental selection transfersPo Lu2022-08-30
| | | | | | | | * src/xselect.c (receive_incremental_selection): New arg REAL_BYTES_RET. Set it to the actual size instead of using the size of the array after it was grown by xpalloc. (x_get_window_property_as_lisp_data): Adjust call to receive_incremental_selection.
* Copy-edit doc strings and comments wrt bignum and fixnumMattias Engdegård2022-08-18
| | | | | | | | | | | | | | | | Don't say that a value is a fixnum if small enough and a bignum otherwise, because that is now how Lisp integers always work, and we generally don't expose the fixnum/bignum difference to the user unless really necessary. * src/charset.c (Fencode_char): * src/editfns.c (Fuser_uid, Fuser_real_uid, Fgroup_gid) (Fgroup_real_gid, Femacs_pid): * src/font.c (Ffont_variation_glyphs): * src/process.c (Fprocess_id): Edit doc strings. * src/pgtkselect.c: * src/xselect.c: Edit comments.
* Only preserve PRIMARY and CLIPBOARD selection ownership by defaultPo Lu2022-07-15
| | | | | | | | | | * lisp/cus-start.el (standard): Update defcustom type. * src/xselect.c (x_should_preserve_selection): New function. (x_clear_frame_selections): Use it to determine whether or not to preserve a selection. * src/xterm.c (x_preserve_selections): Fix tail initialization. (syms_of_xterm): Update doc string of `x-auto-preserve-selections'.
* Fix closing displays when preserving selections is enabledPo Lu2022-07-13
| | | | | | | | | | | * src/frame.c (delete_frame): Bind `x-auto-preserve-selections' to nil if deleting display. * src/xselect.c (x_clear_frame_selections): Pass original frame to that function. * src/xterm.c (x_preserve_selections): Fix determining the new owner. (syms_of_xterm): New defsym `x-auto-preserve-selections'. * src/xterm.h: Update prototypes.
* Try to save selections from being disowned during frame deletionPo Lu2022-07-12
| | | | | | | | | | * lisp/cus-start.el (standard): Add `x-auto-preserve-selections'. * src/xselect.c (x_clear_frame_selections): Collect deleted selections into a variable and preserve them. * src/xterm.c (x_preserve_selections): New function. (syms_of_xterm): New variable `x-auto-preserve-selections'. * src/xterm.h: Update prototypes.
* Handle errors sending selection decline events asynchronouslyPo Lu2022-07-11
| | | | | | | | * src/xselect.c (x_decline_selection_request): Handle errors asynchronously. * src/xterm.c (x_ignore_errors_for_next_request) (x_stop_ignoring_errors): Export functions. * src/xterm.h: Update prototypes.
* Improve drag-and-drop emulation time handlingPo Lu2022-07-09
| | | | | | | | | | | | * src/xselect.c (x_handle_selection_request): Use display-specific pending DND time. (x_set_pending_dnd_time): Delete function. * src/xterm.c (x_dnd_do_unsupported_drop, handle_one_xevent): Set dpyinfo->pending_dnd_time instead. * src/xterm.h (struct x_display_info): New field `pending_dnd_time'. Make handling pending drops display-specific to avoid interference when there are multiple displays.
* Speed up interning XDS atomsPo Lu2022-07-06
| | | | | | | | * src/xselect.c (symbol_to_x_atom, x_atom_to_symbol) (syms_of_xselect): Handle new atoms. * src/xterm.c (x_atom_refs): * src/xterm.h (struct x_display_info): New atoms `XdndDirectSave0', `XdndActionDirectSave' and `text/plain'.
* Fix core dump with x-get-local-selectionPaul Eggert2022-07-04
| | | | | | | * src/xselect.c (Fx_get_local_selection): Check that VALUE has 4 elements, since x_get_local_selection can dump core otherwise. This pacifies gcc -Wanalyzer-null-dereference, which found the problem.
* Speed up receiving drops over slow connectionsPo Lu2022-07-03
| | | | | | | | | | | | | | | | | * lisp/x-dnd.el (x-dnd-debug-errors): New variable. (x-dnd-handle-drag-n-drop-event): Bind `x-fast-protocol-requests' to t if that is off. * src/xfns.c (Fx_change_window_property): (Fx_delete_window_property): * src/xselect.c (Fx_send_client_message, x_send_client_event): Don't sync to check for errors if fast protocol requests are enabled. * src/xterm.c (x_catch_errors_for_lisp, x_check_errors_for_lisp) (x_uncatch_errors_for_lisp): New functions. (syms_of_xterm): New variable `x-fast-protocol-requests'. * src/xterm.h: Update prototypes.
* Fix preservation of the original value of PRIMARY after dropping on xtermPo Lu2022-06-30
| | | | | | | | | | | | | | | | * src/xselect.c (x_own_selection): New arg `dnd_data'. Record it. (x_get_local_selection, x_handle_selection_request) (x_convert_selection): Convert the DND data instead if the situation warrants. (Fx_own_selection_internal, Fx_get_selection_internal) (Fx_get_local_selection): Update calls to x_get_local_selection. * src/xterm.c (x_dnd_do_unsupported_drop): If obtaining selection ownership failed, return. Record DND value and preserve the current value of PRIMARY, if it exists. * src/xterm.h: Update prototypes.
* Fix handling invalidated selection requestsPo Lu2022-06-29
| | | | | * src/xselect.c (x_handle_selection_request): Correctly punt when !dpyinfo.
* Implement starting X Direct Save (XDS) dropsPo Lu2022-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/frames.texi (Drag and Drop): Document new function `dnd-direct-save'. * etc/NEWS: Likewise. * lisp/dnd.el (dnd-direct-save-remote-files): New defcustom. (dnd-begin-file-drag): Implement defucstom. (dnd-begin-drag-files): Add kill-emacs-hook after saving remote file. (dnd-direct-save): New function. * lisp/x-dnd.el (x-dnd-known-types): Fix coding style. (x-dnd-handle-drag-n-drop-event): Handle local value with self-originating DND events. (x-dnd-xds-current-file, x-dnd-xds-source-frame): New defvars. (x-dnd-handle-direct-save, x-dnd-do-direct-save): New functions. * src/xfns.c (Fx_begin_drag): Allow any atom to be used as a DND action. * src/xselect.c (symbol_to_x_atom): Make public. * src/xterm.c (x_dnd_note_self_drop): Include selection local value. (x_ignore_errors_for_next_request): Don't assume x_error_message is set. * src/xterm.h: Update prototypes.
* Fix reported problem with drag-and-drop inside VirtualBoxPo Lu2022-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/x-dnd.el (x-dnd-handle-old-kde, x-dnd-handle-offix) (x-dnd-handle-motif): Select window before handling drop, like on Xdnd. (x-dnd-convert-to-offix, x-dnd-do-offix-drop) (x-dnd-handle-unsupported-drop): Accept local selection data and use that instead. * src/keyboard.c (kbd_buffer_get_event): Call unsupported drop function with local selection data as 8th arg. * src/xselect.c (x_get_local_selection): Accept new arg `local_value'. All callers changed. (Fx_get_local_selection): New function. (syms_of_xselect): Update defsubrs. * src/xterm.c (x_dnd_lose_ownership): New function. (x_dnd_begin_drag_and_drop): Unless new variable is true, disown XdndSelection after returning. This supposedly makes drag-and-drop from guest to host work in VirtualBox without causing pointer motion to become choppy afterwards. (syms_of_xterm): New variable `x_dnd_preserve_selection_data' and update doc string of `x-dnd-unsupported-drop-function'. * test/lisp/dnd-tests.el (dnd-tests-begin-text-drag) (dnd-tests-begin-file-drag, dnd-tests-begin-drag-files): Set new variable to nil during tests.
* Move selection delayed message to a better locationPo Lu2022-06-21
| | | | | | | | | * lisp/term/x-win.el (gui-backend-get-selection): Remove `with-delayed-message' here. * src/xselect.c (x_display_selection_waiting_message) (x_cancel_atimer): New functions. (x_get_foreign_selection): Add an atimer that displays the message after a while.
* Fix x-selection-timeout if some keyboard input arrives while waitingPo Lu2022-06-20
| | | | | | | | | * src/process.c (wait_reading_process_output): Don't allow skipping calls to select if detect_input_pending when just waiting for a cell. (bug#46935) * src/xselect.c (x_get_foreign_selection): Add more debugging code.
* Use BASE_EQ instead of EQ where obviously safeMattias Engdegård2022-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (deadp): * src/buffer.c (reset_buffer_local_variables, candidate_buffer) (Fkill_buffer, Fbuffer_swap_text, Fmake_overlay, Fmove_overlay): * src/callint.c (Fcall_interactively): * src/coding.c (decode_coding_object, encode_coding_object) (code_convert_region, Ffind_operation_coding_system): * src/comp.c (Fcomp_el_to_eln_rel_filename): * src/conf_post.h (RE_TRANSLATE_P): * src/data.c (Fkill_local_variable, Fash, expt_integer): * src/dired.c (file_name_completion): * src/dispnew.c (set_window_cursor_after_update, update_frame_1) (Fframe_or_buffer_changed_p): * src/doc.c (Fdocumentation, Fdocumentation_property) (default_to_grave_quoting_style): * src/editfns.c (Fconstrain_to_field, save_excursion_save) (save_excursion_restore, Fngettext): * src/eval.c (Fautoload, un_autoload, specbind): * src/fileio.c (Fmake_temp_file_internal): * src/fns.c (string_char_to_byte, string_byte_to_char) (Fnthcdr, Fnreverse): * src/indent.c (vmotion): * src/inotify.c (add_watch): * src/keyboard.c (command_loop_1, read_char) (read_char_minibuf_menu_prompt): * src/lread.c (oblookup): * src/macfont.m (macfont_descriptor_entity, macfont_open): * src/minibuf.c (Finnermost_minibuffer_p, Ftry_completion) (Ftest_completion): * src/nsfns.m (ns_set_icon_name): * src/pdumper.c (dump_queue_dequeue): * src/pgtkfns.c (pgtk_set_icon_type, pgtk_set_icon_name): * src/process.c (Faccept_process_output): * src/textprop.c (set_text_properties): * src/w32fns.c (w32_set_icon_type, w32_set_icon_name): * src/w32select.c (validate_coding_system): * src/window.c (decode_next_window_args, window_loop) (save_window_save): * src/xdisp.c (wset_redisplay): * src/xfaces.c (Fx_family_fonts, resolve_face_name) (gui_supports_face_attributes_p): * src/xfns.c (x_set_icon_type, x_set_icon_name): * src/xselect.c (clean_local_selection_data): Use BASE_EQ instead of EQ where it is obvious that neither argument can be a symbol with properties or at least one argument is a non-symbol.
* Comply with the Motif requirement for unique drag atomsPo Lu2022-06-16
| | | | | | | | | | | | | | | | | | * src/xselect.c (x_handle_selection_request) (Fx_get_selection_internal, syms_of_xselect): New variable `x-selection-alias-alist'. Respect that alist of aliases. * src/xterm.c (x_atom_refs): Intern _EMACS_DRAG_ATOM. (xm_get_drag_atom_1, xm_get_drag_atom): New functions. (xm_setup_drag_info, x_dnd_cleanup_drag_and_drop) (x_dnd_begin_drag_and_drop, x_dnd_update_state, handle_one_xevent) (x_connection_closed, x_intern_cached_atom): Alias the drag atom to XdndSelection. Use it instead of XdndSelection to set the Motif index atom. (x_get_atom_name): Handle new atoms. (syms_of_xterm): New defsym. * src/xterm.h (struct x_display_info): New fields for new atoms and their names.
* Use coordinates provided by DND messages if availablePo Lu2022-06-14
| | | | | | | | | | | | This avoids an extra sync, which matters when dropping onto Emacs running over a slow connection. * src/xselect.c (x_handle_dnd_message): New args `root_window_coords', `root_x' and `root_y'. * src/xterm.c (x_coords_from_dnd_message): New function. (handle_one_xevent): Pass root window coordinates to x_handle_dnd_message. * src/xterm.h: Update prototypes.
* Respect test function when performing local drag-and-dropPo Lu2022-06-13
| | | | | | | | | | | | | | | | * lisp/x-dnd.el (x-dnd-test-function): Fix doc string to describe what is actually accepted. (x-dnd-known-types, x-dnd-targets-list): Fix coding style. (x-dnd-handle-native-drop): New function. * src/xselect.c (x_atom_to_symbol): Export. * src/xterm.c (x_dnd_note_self_drop): Call new variable to determine what action to return. (x_clear_dnd_action): New function. (x_dnd_begin_drag_and_drop): Respect new variable. (syms_of_xterm): New defvar `x-dnd-native-test-function'. * src/xterm.h: Update prototypes.
* Use BASE_EQ when comparing with QunboundMattias Engdegård2022-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qunbound is uninterned and can therefore never be EQ to any symbol with position. * src/buffer.c (Fbuffer_local_value, buffer_lisp_local_variables) (buffer_local_variables_1): * src/bytecode.c (exec_byte_code): * src/comp.c (compile_function, Fcomp__compile_ctxt_to_file): * src/composite.c (composition_gstring_cache_clear_font): * src/data.c (Fboundp, Fsymbol_value, set_internal) (Fdefault_boundp, Fdefault_value, Fmake_variable_buffer_local): * src/emacs-module.c (module_global_reference_p): * src/eval.c (Fdefault_toplevel_value, defvar) (run_hook_with_args): * src/fns.c (hash_put, Fmaphash): * src/font.c (font_put_extra): * src/frame.c (gui_set_frame_parameters) (gui_frame_get_and_record_arg, gui_default_parameter) (gui_figure_window_size): * src/haikufns.c (get_geometry_from_preferences) (haiku_create_frame, haiku_create_tip_frame): * src/haikuterm.c (haiku_draw_text_decoration) (haiku_default_font_parameter): * src/json.c (lisp_to_json_nonscalar_1): * src/keymap.c (access_keymap_1, access_keymap, current_minor_maps): * src/lread.c (readevalloop, define_symbol): * src/minibuf.c (read_minibuf, Ftry_completion): (Fall_completions, Ftest_completion): * src/pgtkfns.c (pgtk_default_font_parameter, Fx_create_frame) (x_create_tip_frame): * src/pgtkselect.c (Fpgtk_own_selection_internal): * src/print.c (print): * src/profiler.c (evict_lower_half, record_backtrace): * src/terminal.c (create_terminal): * src/textprop.c (set_properties): * src/w32fns.c (my_create_window, w32_icon) (w32_default_font_parameter, Fx_create_frame) (w32_create_tip_frame): * src/w32term.c (w32_draw_glyph_string): * src/xdisp.c (handle_single_display_spec) (cursor_row_fully_visible_p, calc_pixel_width_or_height): * src/xfns.c (x_default_scroll_bar_color_parameter, x_icon_verify) (x_icon, x_default_font_parameter, Fx_create_frame) (x_create_tip_frame): * src/xselect.c (x_handle_selection_request): * src/xterm.c (x_draw_glyph_string, x_term_init): Use BASE_EQ instead of EQ when comparing with Qunbound.
* Make use of faster atom intern functions in xselect.cPo Lu2022-06-09
| | | | | | * src/xselect.c (symbol_to_x_atom): (x_atom_to_symbol): Use x_get_atom_name and x_intern_cached_atom.
* Allow running some DND tests interactivelyPo Lu2022-06-08
| | | | | | | | | | | | | | | * src/xselect.c (x_get_local_selection): Respect new variable. (syms_of_xselect): New variable `x-treat-local-requests-remotely'. * test/lisp/dnd-tests.el (x-begin-drag, gui-set-selection): Don't redefine these functions under X. (dnd-tests-verify-selection-data): Use `x-get-selection-internal' under X. (dnd-tests-extract-selection-data): New function. (dnd-tests-begin-text-drag): Update accordingly. (dnd-tests-begin-file-drag, dnd-tests-begin-drag-files): Temporarily skip these tests under X.
* Make responding to selection requests work inside popupsPo Lu2022-06-08
| | | | | | | | | | | | | | | | | | | * src/xfns.c (Fx_file_dialog): * src/xmenu.c (x_menu_wait_for_event, create_and_show_popup_menu) (create_and_show_dialog, x_menu_show): Defer selection requests. * src/xselect.c (x_get_foreign_selection) (x_handle_selection_notify): Add some more info to selection trace. * src/xterm.c (x_defer_selection_requests): Make non-static. (x_release_selection_requests_and_flush): New function. (x_dnd_begin_drag_and_drop): Use DEFER_SELECTIONS instead. (x_wait_for_cell_change): Fix initial value of rc for pushed back events. (handle_one_xevent): Allow GTK to respond to selections in its windows too. * src/xterm.h (DEFER_SELECTIONS): New slug of code.
* Fix crash with outdated selection requestsPo Lu2022-06-08
| | | | | * src/xselect.c (x_handle_selection_request): Don't store into stack if it wasn't previously pushed.
* Improve compatibility with some clients of the Motif drop protocolPo Lu2022-06-07
| | | | | | | | | | | | | | | | | | | * lisp/select.el (x-dnd-targets-list): New defvar. (xselect-convert-to-targets): Convert XdndSelection based on the DND targets list. * src/xfns.c (Fx_begin_drag): Pass new argument. * src/xselect.c (struct x_selection_request): New struct. (x_push_current_selection_request): (x_pop_current_selection_request): New functions. (x_selection_request_lisp_error, x_reply_selection_request) (x_handle_selection_request, x_convert_selection) (syms_of_xselect_for_pdumper): Correctly handle recursive requests for MULTIPLE by maintaining a stack of selection requests, converted selections, and other data. * src/xterm.c (x_dnd_begin_drag_and_drop): New argument `selection_target_list'. Bind it to the DND targets list. (syms_of_xterm): New defvar and associated defsym. * src/xterm.h: Update prototypes.
* Signal an error XdndSelection was lost during drag-and-dropPo Lu2022-06-06
| | | | | * src/xselect.c (x_handle_selection_clear): Signal an error if ownership of XdndSelection was lost during drag-and-drop.
* Rework X selections to make it safe to run the debugger inside convertersPo Lu2022-06-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/keyboard.c (prev_kbd_event): Delete function. (readable_events): Return 1 if x_detect_pending_selection_requests returns true. (kbd_buffer_unget_event): Also delete function, since nested selection requests are really handled correctly. (kbd_buffer_get_event): Handle events from the special X deferred selection queue as well. * src/keyboard.h: Update prototypes. * src/xselect.c (struct selection_event_queue) (selection_input_event_equal, x_queue_event) (x_start_queuing_selection_requests) (x_stop_queuing_selection_requests): Delete structs, since they are no longer required. (x_handle_selection_request, x_handle_selection_event): Allow nested selection events. * src/xterm.c (struct x_selection_request_event): New struct. (x_handle_pending_selection_requests_1) (x_handle_pending_selection_requests): Handle all events in the new selection event queue. (x_push_selection_request, x_detect_pending_selection_requests): New functions. (x_dnd_begin_drag_and_drop): Drain the selection queue here as well. (handle_one_xevent): When inside a nested event loop, just push selections to that queue. (XTread_socket): Allow reading X events if x_dnd_unwind_flag is true, even though DND is in progress. (x_delete_display): Delete pending selection events for the display that is going away. * src/xterm.h: Update prototypes.
* Clean up text/uri-list mess inside the Dired drag-and-drop codePo Lu2022-06-01
| | | | | | | | | | | | | | | * doc/lispref/frames.texi (Window System Selections): * etc/NEWS: Document new changes to `gui-get-selection'. * lisp/dired.el (dired-mouse-drag): Specify text/uri-list value explicitly. * lisp/select.el (gui-set-selection): Update doc string. (xselect-convert-to-text-uri-list): Update to handle either a single URL (as a string) or a vector of URLs, instead of file names. (xselect-uri-list-available-p): Likewise. * src/xselect.c (x_get_local_selection): Look in tem's text properties (if it is a string) for a local value before using tem itself.
* Fix hangs when x-get-selection is called inside a popup menuPo Lu2022-05-30
| | | | | | | | * src/xselect.c (wait_for_property_change): (x_get_foreign_selection): Use `x_wait_for_cell_change' if input is blocked. (bug#22214) * src/xterm.c (x_wait_for_cell_change): New function. * src/xterm.h: Update prototypes.
* Fix frame destruction issues and misuse of x_get_atom_namePo Lu2022-05-28
| | | | | | | | | | | | * src/frame.c (delete_frame): Prevent deleting the dnd frame while waiting for finish as well. * src/xselect.c (Fx_get_atom_name): Clean up code and fix uninitialized use of need_sync. * src/xterm.c (x_dnd_send_unsupported_drop, x_dnd_send_drop) (handle_one_xevent): Clean up usage of x_get_atom_name. (x_get_atom_name): Accept NULL for need_sync. * src/xterm.h: Update declarations.
* Fix unlikely null pointer dereferencePaul Eggert2022-05-27
| | | | | * src/xselect.c (Fx_get_atom_name): Fix unlikely core dump when build_string is called on a null pointer. Found by GCC -fanalyzer.
* * src/xselect.c (Fx_register_dnd_atom): Use x_intern_cached_atom.Po Lu2022-05-26
|