[client] x11: don't use primary selection for clipboard

This behaviour is more consistent with other applications where text
selections do not influence explicit clipboard operations.
This commit is contained in:
Chris Spencer 2022-01-12 19:40:47 +00:00 committed by Geoffrey McRae
parent f145225dbc
commit 786a252b23

View File

@ -123,8 +123,6 @@ bool x11CBInit()
return false; return false;
} }
XFixesSelectSelectionInput(x11.display, x11.window,
XA_PRIMARY, XFixesSetSelectionOwnerNotifyMask);
XFixesSelectSelectionInput(x11.display, x11.window, XFixesSelectSelectionInput(x11.display, x11.window,
x11atoms.CLIPBOARD, XFixesSetSelectionOwnerNotifyMask); x11atoms.CLIPBOARD, XFixesSetSelectionOwnerNotifyMask);
@ -205,7 +203,7 @@ send:
static void x11CBSelectionClear(const XSelectionClearEvent e) static void x11CBSelectionClear(const XSelectionClearEvent e)
{ {
if (e.selection != XA_PRIMARY && e.selection != x11atoms.CLIPBOARD) if (e.selection != x11atoms.CLIPBOARD)
return; return;
x11cb.aCurSelection = BadValue; x11cb.aCurSelection = BadValue;
@ -291,7 +289,7 @@ out:
static void x11CBXFixesSelectionNotify(const XFixesSelectionNotifyEvent e) static void x11CBXFixesSelectionNotify(const XFixesSelectionNotifyEvent e)
{ {
// check if the selection is valid and it isn't ourself // check if the selection is valid and it isn't ourself
if ((e.selection != XA_PRIMARY && e.selection != x11atoms.CLIPBOARD) || if (e.selection != x11atoms.CLIPBOARD ||
e.owner == x11.window || e.owner == 0) e.owner == x11.window || e.owner == 0)
{ {
return; return;
@ -396,7 +394,6 @@ void x11CBNotice(LG_ClipboardData type)
{ {
x11cb.haveRequest = true; x11cb.haveRequest = true;
x11cb.type = type; x11cb.type = type;
XSetSelectionOwner(x11.display, XA_PRIMARY , x11.window, CurrentTime);
XSetSelectionOwner(x11.display, x11atoms.CLIPBOARD, x11.window, CurrentTime); XSetSelectionOwner(x11.display, x11atoms.CLIPBOARD, x11.window, CurrentTime);
XFlush(x11.display); XFlush(x11.display);
} }
@ -404,7 +401,6 @@ void x11CBNotice(LG_ClipboardData type)
void x11CBRelease(void) void x11CBRelease(void)
{ {
x11cb.haveRequest = false; x11cb.haveRequest = false;
XSetSelectionOwner(x11.display, XA_PRIMARY , None, CurrentTime);
XSetSelectionOwner(x11.display, x11atoms.CLIPBOARD, None, CurrentTime); XSetSelectionOwner(x11.display, x11atoms.CLIPBOARD, None, CurrentTime);
XFlush(x11.display); XFlush(x11.display);
} }