xwl: Handle X11 clipboard owners closing more thoroughly
Selection acts as an abstraction around multiple X11Sources, when we get a new source we asyncronously emit that x11OffersChanged when it completes. If the selection is lost, we were just deleting the source, without notifying other parts. XwlDataSource is the datasource that SeatInterface knows about. We need to delete this when the X11 connection is no longer valid. SeatInterface will update the selection when the XwmlDataSource is deleted if it's the active selection. The hook is introduced as updating the selection in Clipboard will cause Selection to delete m_xSource which gets messy. BUG: 449909
This commit is contained in:
parent
261121547d
commit
f7fb9476b3
8 changed files with 22 additions and 2 deletions
|
@ -141,6 +141,11 @@ void Clipboard::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event)
|
|||
}
|
||||
}
|
||||
|
||||
void Clipboard::x11OfferLost()
|
||||
{
|
||||
m_selectionSource.reset();
|
||||
}
|
||||
|
||||
void Clipboard::x11OffersChanged(const QStringList &added, const QStringList &removed)
|
||||
{
|
||||
m_waitingForTargets = false;
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
|
||||
private:
|
||||
void doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) override;
|
||||
void x11OfferLost() override;
|
||||
void x11OffersChanged(const QStringList &added, const QStringList &removed) override;
|
||||
/**
|
||||
* React to Wl selection change.
|
||||
|
|
|
@ -113,6 +113,10 @@ void Dnd::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event)
|
|||
m_currentDrag = new XToWlDrag(source, this);
|
||||
}
|
||||
|
||||
void Dnd::x11OfferLost()
|
||||
{
|
||||
}
|
||||
|
||||
void Dnd::x11OffersChanged(const QStringList &added, const QStringList &removed)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
XwlDropHandler *dropHandler() const;
|
||||
|
||||
void doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) override;
|
||||
void x11OfferLost() override;
|
||||
void x11OffersChanged(const QStringList &added, const QStringList &removed) override;
|
||||
bool handleClientMessage(xcb_client_message_event_t *event) override;
|
||||
|
||||
|
|
|
@ -144,6 +144,11 @@ void Primary::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event)
|
|||
}
|
||||
}
|
||||
|
||||
void Primary::x11OfferLost()
|
||||
{
|
||||
m_primarySelectionSource.reset();
|
||||
}
|
||||
|
||||
void Primary::x11OffersChanged(const QStringList &added, const QStringList &removed)
|
||||
{
|
||||
m_waitingForTargets = false;
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
|
||||
private:
|
||||
void doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) override;
|
||||
void x11OfferLost() override;
|
||||
void x11OffersChanged(const QStringList &added, const QStringList &removed) override;
|
||||
/**
|
||||
* React to Wl selection change.
|
||||
|
|
|
@ -183,12 +183,14 @@ void Selection::setWlSource(WlSource *source)
|
|||
|
||||
void Selection::createX11Source(xcb_xfixes_selection_notify_event_t *event)
|
||||
{
|
||||
setWlSource(nullptr);
|
||||
if (!event || event->owner == XCB_WINDOW_NONE) {
|
||||
x11OfferLost();
|
||||
setWlSource(nullptr);
|
||||
return;
|
||||
}
|
||||
m_xSource = new X11Source(this, event);
|
||||
setWlSource(nullptr);
|
||||
|
||||
m_xSource = new X11Source(this, event);
|
||||
connect(m_xSource, &X11Source::offersChanged, this, &Selection::x11OffersChanged);
|
||||
connect(m_xSource, &X11Source::transferReady, this, &Selection::startTransferToWayland);
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ protected:
|
|||
void registerXfixes();
|
||||
|
||||
virtual void doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) = 0;
|
||||
virtual void x11OfferLost() = 0;
|
||||
virtual void x11OffersChanged(const QStringList &added, const QStringList &removed) = 0;
|
||||
|
||||
virtual bool handleClientMessage(xcb_client_message_event_t *event)
|
||||
|
|
Loading…
Reference in a new issue