aboutsummaryrefslogtreecommitdiffstats
path: root/src/xselect.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2026 to copyright years.Sean Whitton2026-01-011-1/+1
|
* Don't lose drag-and-drop data intended for XTerm-like programsPo Lu2025-03-081-1/+8
| | | | | | * src/xselect.c (x_own_selection): If special values exist for drag-and-drop to unsupported programs, retain them till the selection is cleared.
* Replace call[1-8] with callnStefan Kangas2025-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Since the introduction of the 'calln' macro, the 'call1', 'call2', ..., 'call8' macros are just aliases for the former. This is slightly misleading and potentially unhelpful. The number of arguments N can also easily go out-of-synch with the used alias callN. There is no reason not to replace these aliases with using 'calln' directly. To reduce the risk for mistakes, the tool Coccinelle was used to make these changes. See <https://coccinelle.gitlabpages.inria.fr/website/>. * src/alloc.c, src/androidvfs.c, src/androidfns.c, src/buffer.c: * src/callint.c, src/callproc.c, src/casefiddle.c, src/charset.c: * src/chartab.c, src/cmds.c, src/coding.c, src/composite.c: * src/data.c, src/dbusbind.c, src/dired.c, src/doc.c: * src/emacs.c, src/eval.c, src/fileio.c, src/filelock.c: * src/fns.c, src/frame.c, src/gtkutil.c, src/haikufns.c: * src/haikumenu.c, src/image.c, src/insdel.c, src/intervals.c: * src/keyboard.c, src/keymap.c, src/lisp.h, src/lread.c: * src/minibuf.c, src/nsfns.m, src/nsselect.m, src/pgtkfns.c: * src/pgtkselect.c, src/print.c, src/process.c, src/sort.c: * src/syntax.c, src/textconv.c, src/textprop.c, src/undo.c: * src/w32fns.c, src/window.c, src/xfaces.c, src/xfns.c: * src/xmenu.c, src/xselect.c, src/xterm.c: Replace all uses of 'call1', 'call2', ..., 'call8' with 'calln'.
* Update copyright year to 2025Paul Eggert2025-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Pacify gcc -Wmissing-variable-declarationsPaul Eggert2024-05-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This is a new warning diagnostic in GCC 14. * lib-src/etags.c (mercury_heuristics_ratio): * src/pgtkselect.c, src/xselect.c (selection_request_stack): * src/xselect.c (outstanding_transfers): * src/xterm.c (pending_selection_requests) (x_dnd_waiting_for_motif_finish_display): Now static. * lib-src/make-docfile.c (close_emacs_globals): Arrange for lispsym to be declared with extern first, when compiling lread.c. * src/alloc.c (gdb_make_enums_visible) [__GNUC__]: * src/emacs.c (RCS_Id): * src/keyboard.c (stop_character): * src/print.c (print_output_debug_flag): Now declared with extern first. * src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN) [MAIN_PROGRAM]: Arrange for ID to be declared extern first. * src/lisp.h (garbage_collection_inhibited): * src/xterm.h (x_frame_parm_handlers): Declare here, so that its interface is properly checked. Other decls removed.
* Pacify Ubuntu GCC 13.2 in x_get_local_selectionPaul Eggert2024-01-061-0/+6
| | | | | * src/xselect.c: Ignore -Wanalyzer-null-dereference, to work around GCC bug 102671.
* Merge from savannah/emacs-29Po Lu2024-01-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
| |
* | ; Fix typosStefan Kangas2023-12-101-1/+1
| |
* | Fix leak when quit arrives during incremental selection transferPo Lu2023-07-031-6/+28
| | | | | | | | | | | | * src/xselect.c (x_free_selection_data): New function. (x_get_window_property_as_lisp_data): Free `data' reliably if receive_incremental_selection quits.
* | Prefer C23 ckd_* to Gnulib *_WRAPV macrosPaul Eggert2023-05-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C23 has added ckd_add etc. macros with functionality equivalent to the older Gnulib INT_ADD_WRAPV macros, so switch to the more-standard names. * admin/merge-gnulib (GNULIB_MODULES): Add stdckdint. This merely makes the dependency explicit, as we were already using this Gnulib module indirectly. * lib-src/etags.c, src/lisp.h: Include stdckdint.h. * lib-src/etags.c (xnmalloc, xnrealloc): * src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string) (mark_memory): * src/bignum.c (emacs_mpz_pow_ui): * src/buffer.c (record_overlay_string, overlay_strings): * src/bytecode.c (exec_byte_code): * src/casefiddle.c (do_casify_multibyte_string): * src/ccl.c (ccl_driver, Fccl_execute_on_string): * src/character.c (char_width, c_string_width) (lisp_string_width, count_size_as_multibyte) (string_escape_byte8): * src/cmds.c (internal_self_insert): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display_interactive): * src/doprnt.c (parse_format_integer): * src/editfns.c (Freplace_buffer_contents, str2num) (styled_format): * src/emacs-module.c (module_global_reference_p) (module_make_global_ref, module_funcall): * src/eval.c (max_ensure_room): * src/fileio.c (blocks_to_bytes): * src/fns.c (Ffillarray): * src/font.c (font_intern_prop): * src/frame.c (check_frame_pixels): * src/gnutls.c (gnutls_hex_string, gnutls_symmetric_aead): * src/gtkutil.c (get_utf8_string): * src/haikuterm.c (haiku_term_init): * src/image.c (xbm_scan, image_to_emacs_colors) (image_detect_edges, png_load_body): * src/keyboard.c (Frecursion_depth): * src/keymap.c (Flookup_key, Fkey_description): * src/lisp.h (modiff_incr, SAFE_ALLOCA_LISP_EXTRA): * src/lread.c (read_bool_vector): * src/pgtkterm.c (pgtk_term_init): * src/regex-emacs.c (regex_compile): * src/term.c (encode_terminal_code): * src/termcap.c (tputs): * src/textconv.c (textconv_query): * src/timefns.c (timespec_ticks, lisp_time_hz_ticks) (Fdecode_time, check_tm_member): * src/tparam.c (tparam1): * src/w32term.c (w32_initialize_display_info): * src/xdisp.c (fill_column_indicator_column, decode_mode_spec): * src/xselect.c (selection_data_size, x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (xm_setup_dnd_targets, x_sync_get_monotonic_time) (x_sync_current_monotonic_time, x_sync_note_frame_times) (x_display_set_last_user_time, x_term_init): Prefer the C23 stdckdint macros to their Gnulib intprops.h counterparts, since C23 is standard.
* | Merge from origin/emacs-29Eli Zaretskii2023-01-011-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | 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-011-1/+1
| |
* | Handle selection transfer errors earlierPo Lu2022-12-151-9/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-081-38/+12
| | | | | | | | | | | | | | | | | | | | * 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-041-2/+10
| | | | | | | | | | * src/xselect.c (x_cancel_selection_transfer): Catch errors around XSelectInput.
* | More behind the scenes transparent speedups around xselect.cPo Lu2022-12-021-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-011-4/+2
| | | | | | | | | | | | * 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-011-0/+3
| | | | | | | | Author:
* | Fix pdumper buildPo Lu2022-12-011-0/+5
| | | | | | | | | | * src/xselect.c (mark_xselect): Don't mark if outstanding_transfers.next is still NULL.
* | Speed up handling X selection requestsPo Lu2022-12-011-240/+542
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-261-4/+4
| | | | | | * 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-201-1/+1
|
* ; * src/xselect.c (x_handle_selection_request): Fix typo in last change.Po Lu2022-11-121-1/+1
|
* Fix implementation of MULTIPLEPo Lu2022-11-121-0/+7
| | | | | * 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-251-6/+1
| | | | | | | | | | | | | | | | | 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-171-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-051-1/+11
| | | | | | * 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-301-5/+29
| | | | | | | | * 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-181-2/+1
| | | | | | | | | | | | | | | | 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-151-6/+30
| | | | | | | | | | * 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-131-1/+1
| | | | | | | | | | | * 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-121-7/+17
| | | | | | | | | | * 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-111-6/+17
| | | | | | | | * 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-091-11/+6
| | | | | | | | | | | | * 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-061-0/+15
| | | | | | | | * 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-041-3/+7
| | | | | | | * 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-031-3/+8
| | | | | | | | | | | | | | | | | * 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-301-23/+39
| | | | | | | | | | | | | | | | * 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-291-1/+4
| | | | | * src/xselect.c (x_handle_selection_request): Correctly punt when !dpyinfo.
* Implement starting X Direct Save (XDS) dropsPo Lu2022-06-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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-291-9/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-211-6/+35
| | | | | | | | | * 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-201-1/+7
| | | | | | | | | * 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-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-161-0/+40
| | | | | | | | | | | | | | | | | | * 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-141-2/+12
| | | | | | | | | | | | 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-131-2/+2
| | | | | | | | | | | | | | | | * 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-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-091-9/+8
| | | | | | * src/xselect.c (symbol_to_x_atom): (x_atom_to_symbol): Use x_get_atom_name and x_intern_cached_atom.