xwayland: Allow pushing to the clipboard without focus

X11 did not have a requirement that apps needed keyboard focus to update
a clipboard. Apps could copy things on click. With context menus and
grabs there can be no active window at this point.

Kwin tried to retrofit a requirement, which doesn't work in all cases.

Whilst there are security implications of reading a clipboard there are
no security issues about pushing a new clipboard. Gnome also allows X11
apps to push to the clipboard at any point.
This commit is contained in:
David Edmundson 2024-03-18 12:37:42 +00:00
parent 22ef6d9ddf
commit b2a48d09e7

View file

@ -123,14 +123,6 @@ void Clipboard::checkWlSource()
void Clipboard::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) void Clipboard::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event)
{ {
const Window *window = workspace()->activeWindow();
if (!qobject_cast<const X11Window *>(window)) {
// clipboard is only allowed to be acquired when Xwayland has focus
// TODO: can we make this stronger (window id comparison)?
createX11Source(nullptr);
return;
}
createX11Source(event); createX11Source(event);
if (X11Source *source = x11Source()) { if (X11Source *source = x11Source()) {