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.

(cherry picked from commit 4150c1f047)
icc-effect-5.20.5
Aleix Pol 2020-10-28 18:47:45 +01:00 committed by Nate Graham
parent 7bfb9add96
commit 10e1b6fd9d
1 changed files with 5 additions and 6 deletions

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;
}