xwayland: Ignore somebody else claiming WM_S0 selection

If somebody else claims the selection, it's unclear what we should do.
kwin can't give up its selection as it's the one who is responsible for
window management and compositing. If anything, Xwayland should ensure
that no client can claim WM_S0.
This commit is contained in:
Vlad Zahorodnii 2024-02-26 15:53:19 +02:00
parent 13c092d671
commit 329c5de451
2 changed files with 2 additions and 29 deletions

View file

@ -535,12 +535,6 @@ void Xwayland::handleXwaylandReady()
// create selection owner for WM_S0 - magic X display number expected by XWayland
m_windowManagerSelectionOwner = std::make_unique<KSelectionOwner>("WM_S0", kwinApp()->x11Connection(), kwinApp()->x11RootWindow());
connect(m_windowManagerSelectionOwner.get(), &KSelectionOwner::lostOwnership,
this, &Xwayland::handleSelectionLostOwnership);
connect(m_windowManagerSelectionOwner.get(), &KSelectionOwner::claimedOwnership,
this, &Xwayland::handleSelectionClaimedOwnership);
connect(m_windowManagerSelectionOwner.get(), &KSelectionOwner::failedToClaimOwnership,
this, &Xwayland::handleSelectionFailedToClaimOwnership);
m_windowManagerSelectionOwner->claim(true);
m_dataBridge = std::make_unique<DataBridge>();
@ -548,13 +542,13 @@ void Xwayland::handleXwaylandReady()
connect(workspace(), &Workspace::outputOrderChanged, this, &Xwayland::updatePrimary);
updatePrimary();
Xcb::sync(); // Trigger possible errors, there's still a chance to abort
delete m_xrandrEventsFilter;
m_xrandrEventsFilter = new XrandrEventFilter(this);
refreshEavesdropping();
connect(options, &Options::xwaylandEavesdropsChanged, this, &Xwayland::refreshEavesdropping);
Q_EMIT started();
}
void Xwayland::refreshEavesdropping()
@ -608,23 +602,6 @@ void Xwayland::updatePrimary()
}
}
void Xwayland::handleSelectionLostOwnership()
{
qCWarning(KWIN_XWL) << "Somebody else claimed ownership of WM_S0. This should never happen!";
m_launcher->stop();
}
void Xwayland::handleSelectionFailedToClaimOwnership()
{
qCWarning(KWIN_XWL) << "Failed to claim ownership of WM_S0. This should never happen!";
m_launcher->stop();
}
void Xwayland::handleSelectionClaimedOwnership()
{
Q_EMIT started();
}
bool Xwayland::createX11Connection()
{
xcb_connection_t *connection = xcb_connect_to_fd(m_launcher->xcbConnectionFd(), nullptr);

View file

@ -58,10 +58,6 @@ private Q_SLOTS:
void handleXwaylandFinished();
void handleXwaylandReady();
void handleSelectionLostOwnership();
void handleSelectionFailedToClaimOwnership();
void handleSelectionClaimedOwnership();
private:
friend class XrandrEventFilter;