xwl: No need to delete the source immediately

Prefer replacing then deleting the selection to the other way around.
This way less events need to be reported and the clipboard manager
doesn't get confused.
This commit is contained in:
Aleix Pol 2020-10-28 18:47:45 +01:00
parent 0549c14588
commit 4150c1f047

View file

@ -167,9 +167,11 @@ void Selection::registerXfixes()
void Selection::setWlSource(WlSource *source)
{
delete m_waylandSource;
if (m_waylandSource) {
m_waylandSource->deleteLater();
m_waylandSource = nullptr;
}
delete m_xSource;
m_waylandSource = nullptr;
m_xSource = nullptr;
if (source) {
m_waylandSource = source;
@ -179,10 +181,7 @@ void Selection::setWlSource(WlSource *source)
void Selection::createX11Source(xcb_xfixes_selection_notify_event_t *event)
{
delete m_waylandSource;
delete m_xSource;
m_waylandSource = nullptr;
m_xSource = nullptr;
setWlSource(nullptr);
if (!event || event->owner == XCB_WINDOW_NONE) {
return;
}