mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
Disable middle click selection emulation during XDS
* doc/lispref/frames.texi (Drag and Drop): Document new variable. * lisp/x-dnd.el (x-dnd-do-direct-save): Disable drop emulation during XDS drag-and-drop. * src/keyboard.c (kbd_buffer_get_event): Handle recorded value. * src/xterm.c (x_dnd_do_unsupported_drop): Return if new variable is nil. (x_dnd_send_unsupported_drop): Record value of new variable in events. (x_dnd_begin_drag_and_drop): Handle recorded value. (syms_of_xterm): New variable `x-dnd-use-unsupported-drop'.
This commit is contained in:
parent
ce00057cb9
commit
833767e53f
@ -4280,6 +4280,18 @@ will only be used if @code{"FILE_NAME"} is one of the targets given to
|
||||
to drop all supported content.
|
||||
@end defvar
|
||||
|
||||
@defvar x-dnd-use-unsupported-drop
|
||||
When one of the @code{"STRING"}, @code{"UTF8_STRING"},
|
||||
@code{"COMPOUND_TEXT"} or @code{"TEXT"} targets is present in the list
|
||||
given to @code{x-begin-drag}, Emacs will try to use synthesized mouse
|
||||
events and the primary selection to insert the text if the drop target
|
||||
doesn't support any drag-and-drop protocol at all.
|
||||
|
||||
A side effect is that Emacs will become the owner of the primary
|
||||
selection upon such a drop. If that is not desired, then the drop
|
||||
emulation can be disabled by setting this variable to @code{nil}.
|
||||
@end defvar
|
||||
|
||||
@node Color Names
|
||||
@section Color Names
|
||||
|
||||
|
@ -1144,6 +1144,7 @@ ACTION is the action given to `x-begin-drag'."
|
||||
"Whether or not the drop target made a request for `XdndDirectSave0'.")
|
||||
|
||||
(defvar x-dnd-disable-motif-protocol)
|
||||
(defvar x-dnd-use-unsupported-drop)
|
||||
|
||||
(defun x-dnd-handle-direct-save (_selection _type _value)
|
||||
"Handle a selection request for `XdndDirectSave'."
|
||||
@ -1204,6 +1205,7 @@ was taken, or the direct save failed."
|
||||
;; possibly work with Motif or OffiX programs.
|
||||
(x-dnd-disable-motif-protocol t)
|
||||
(x-dnd-use-offix-drop nil)
|
||||
(x-dnd-use-unsupported-drop nil)
|
||||
(prop-deleted nil)
|
||||
encoded-name)
|
||||
(unwind-protect
|
||||
|
@ -4068,7 +4068,10 @@ kbd_buffer_get_event (KBOARD **kbp,
|
||||
|
||||
/* `x-dnd-unsupported-drop-function' could have deleted the
|
||||
event frame. */
|
||||
if (!FRAME_LIVE_P (f))
|
||||
if (!FRAME_LIVE_P (f)
|
||||
/* This means `x-dnd-use-unsupported-drop' was nil when the
|
||||
event was generated. */
|
||||
|| NILP (XCAR (XCDR (XCDR (XCDR (event->ie.arg))))))
|
||||
break;
|
||||
|
||||
x_dnd_do_unsupported_drop (FRAME_DISPLAY_INFO (f),
|
||||
|
20
src/xterm.c
20
src/xterm.c
@ -3810,6 +3810,9 @@ x_dnd_do_unsupported_drop (struct x_display_info *dpyinfo,
|
||||
if (NILP (value))
|
||||
return;
|
||||
|
||||
if (!x_dnd_use_unsupported_drop)
|
||||
return;
|
||||
|
||||
event.xbutton.serial = 0;
|
||||
event.xbutton.send_event = True;
|
||||
event.xbutton.display = dpyinfo->display;
|
||||
@ -3914,9 +3917,10 @@ x_dnd_send_unsupported_drop (struct x_display_info *dpyinfo, Window target_windo
|
||||
ie.kind = UNSUPPORTED_DROP_EVENT;
|
||||
ie.code = (unsigned) target_window;
|
||||
ie.modifiers = x_dnd_unsupported_event_level;
|
||||
ie.arg = list3 (assq_no_quit (QXdndSelection,
|
||||
ie.arg = list4 (assq_no_quit (QXdndSelection,
|
||||
dpyinfo->terminal->Vselection_alist),
|
||||
targets, arg);
|
||||
targets, arg, (x_dnd_use_unsupported_drop
|
||||
? Qt : Qnil));
|
||||
ie.timestamp = before;
|
||||
|
||||
XSETINT (ie.x, root_x);
|
||||
@ -11377,7 +11381,10 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
|
||||
|
||||
/* `x-dnd-unsupported-drop-function' could have deleted the
|
||||
event frame. */
|
||||
if (!FRAME_LIVE_P (event_frame))
|
||||
if (!FRAME_LIVE_P (event_frame)
|
||||
/* This means `x-dnd-use-unsupported-drop' was nil when the
|
||||
event was generated. */
|
||||
|| NILP (XCAR (XCDR (XCDR (XCDR (event->ie.arg))))))
|
||||
continue;
|
||||
|
||||
x_dnd_do_unsupported_drop (FRAME_DISPLAY_INFO (event_frame),
|
||||
@ -28075,4 +28082,11 @@ drag-and-drop code. */);
|
||||
When non-nil, `x-begin-drag' will not drop onto any window that only
|
||||
supports the Motif drag-and-drop protocols. */);
|
||||
x_dnd_disable_motif_protocol = false;
|
||||
|
||||
DEFVAR_BOOL ("x-dnd-use-unsupported-drop", x_dnd_use_unsupported_drop,
|
||||
doc: /* Enable the emulation of drag-and-drop based on the primary selection.
|
||||
When nil, do not use the primary selection and synthetic mouse clicks
|
||||
to emulate the drag-and-drop of `STRING', `UTF8_STRING',
|
||||
`COMPOUND_TEXT' or `TEXT'. */);
|
||||
x_dnd_use_unsupported_drop = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user