(x-scroll-event-delta-factor mouse float "29.1")
(x-gtk-use-native-input keyboard boolean "29.1")
(x-dnd-disable-motif-drag dnd boolean "29.1")
- (x-auto-preserve-selections x boolean "29.1")
+ (x-auto-preserve-selections x
+ (choice (const :tag "Always preserve selections" t)
+ (repeat symbol))
+ "29.1")
;; xselect.c
(x-select-enable-clipboard-manager killing boolean "24.1")
;; xsettings.c
x_handle_selection_request (event);
}
+static bool
+x_should_preserve_selection (Lisp_Object selection)
+{
+ Lisp_Object tem;
+
+ tem = Vx_auto_preserve_selections;
+
+ if (CONSP (Vx_auto_preserve_selections))
+ {
+ FOR_EACH_TAIL_SAFE (tem)
+ {
+ if (EQ (XCAR (tem), selection))
+ return true;
+ }
+
+ return false;
+ }
+
+ return !NILP (tem);
+}
/* Clear all selections that were made from frame F.
We do this when about to delete a frame. */
void
x_clear_frame_selections (struct frame *f)
{
- Lisp_Object frame, rest, lost;
+ Lisp_Object frame, rest, lost, selection;
struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
struct terminal *t = dpyinfo->terminal;
while (CONSP (t->Vselection_alist)
&& EQ (frame, XCAR (XCDR (XCDR (XCDR (XCAR (t->Vselection_alist)))))))
{
- if (!x_auto_preserve_selections)
+ selection = Fcar (Fcar (t->Vselection_alist));
+
+ if (!x_should_preserve_selection (selection))
/* Run the `x-lost-selection-functions' abnormal hook. */
CALLN (Frun_hook_with_args, Qx_lost_selection_functions,
- Fcar (Fcar (t->Vselection_alist)));
+ selection);
else
lost = Fcons (Fcar (t->Vselection_alist), lost);
if (CONSP (XCDR (rest))
&& EQ (frame, XCAR (XCDR (XCDR (XCDR (XCAR (XCDR (rest))))))))
{
- if (!x_auto_preserve_selections)
+ selection = XCAR (XCAR (XCDR (rest)));
+
+ if (!x_should_preserve_selection (selection))
CALLN (Frun_hook_with_args, Qx_lost_selection_functions,
- XCAR (XCAR (XCDR (rest))));
+ selection);
else
lost = Fcons (XCAR (XCDR (rest)), lost);
break;
}
- if (x_auto_preserve_selections)
+ if (!NILP (lost))
x_preserve_selections (dpyinfo, lost, frame);
}
\f
}
nowners = 0;
+ tail = lost;
FOR_EACH_TAIL_SAFE (tail)
{
ignored without waiting, which is generally faster. */);
x_fast_protocol_requests = false;
- DEFVAR_BOOL ("x-auto-preserve-selections", x_auto_preserve_selections,
+ DEFVAR_LISP ("x-auto-preserve-selections", Vx_auto_preserve_selections,
doc: /* Whether or not to transfer selection ownership when deleting a frame.
When non-nil, deleting a frame that is currently the owner of a
selection will cause its ownership to be transferred to another frame
-on the same display. */);
- x_auto_preserve_selections = true;
+on the same display.
+
+In addition, when this variable is a list, only preserve the
+selections whose names are contained within. */);
+ Vx_auto_preserve_selections = list2 (QCLIPBOARD, QPRIMARY);
}