diff options
author | Po Lu <luangruo@yahoo.com> | 2022-06-16 10:08:12 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-06-16 10:08:12 +0800 |
commit | 9accc800a75529c1eaf81d6844c53b6ca2f5622f (patch) | |
tree | df246f64d41c1d954e15007affa0d348f961877d /src/xselect.c | |
parent | 556c304007fbea1a552c65529fa86c0a5637b27b (diff) | |
download | emacs-9accc800a75529c1eaf81d6844c53b6ca2f5622f.tar.gz emacs-9accc800a75529c1eaf81d6844c53b6ca2f5622f.tar.bz2 emacs-9accc800a75529c1eaf81d6844c53b6ca2f5622f.zip |
Comply with the Motif requirement for unique drag atoms
* 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.
Diffstat (limited to 'src/xselect.c')
-rw-r--r-- | src/xselect.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/xselect.c b/src/xselect.c index 96c1e9830fb..fff79fb99f8 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -774,6 +774,25 @@ x_handle_selection_request (struct selection_input_event *event) bool success = false; specpdl_ref count = SPECPDL_INDEX (); bool pushed; + Lisp_Object alias, tem; + + alias = Vx_selection_alias_alist; + + FOR_EACH_TAIL_SAFE (alias) + { + tem = Qnil; + + if (CONSP (alias)) + tem = XCAR (alias); + + if (CONSP (tem) + && EQ (XCAR (tem), selection_symbol) + && SYMBOLP (XCDR (tem))) + { + selection_symbol = XCDR (tem); + break; + } + } pushed = false; @@ -2055,15 +2074,27 @@ On Nextstep, TIME-STAMP and TERMINAL are unused. */) Lisp_Object time_stamp, Lisp_Object terminal) { Lisp_Object val = Qnil; + Lisp_Object maybe_alias; struct frame *f = frame_for_x_selection (terminal); CHECK_SYMBOL (selection_symbol); CHECK_SYMBOL (target_type); + if (EQ (target_type, QMULTIPLE)) error ("Retrieving MULTIPLE selections is currently unimplemented"); if (!f) error ("X selection unavailable for this frame"); + /* Quitting inside this function is okay, so we don't have to use + FOR_EACH_TAIL_SAFE. */ + maybe_alias = Fassq (selection_symbol, Vx_selection_alias_alist); + + if (!NILP (maybe_alias)) + { + selection_symbol = XCDR (maybe_alias); + CHECK_SYMBOL (selection_symbol); + } + val = x_get_local_selection (selection_symbol, target_type, true, FRAME_DISPLAY_INFO (f)); @@ -2818,6 +2849,15 @@ If non-nil, selection converters for string types (`STRING', when Emacs itself is converting the selection. */); Vx_treat_local_requests_remotely = Qnil; + DEFVAR_LISP ("x-selection-alias-alist", Vx_selection_alias_alist, + doc: /* List of selections to alias to another. +It should be an alist of a selection name to another. When a +selection request arrives for the first selection, Emacs will respond +as if the request was meant for the other. + +Note that this does not affect setting or owning selections. */); + Vx_selection_alias_alist = Qnil; + /* QPRIMARY is defined in keyboard.c. */ DEFSYM (QSECONDARY, "SECONDARY"); DEFSYM (QSTRING, "STRING"); |