Changeset View
Changeset View
Standalone View
Standalone View
xwl/drag_x.cpp
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | |||||
64 | 64 | | |||
65 | XToWlDrag::XToWlDrag(X11Source *source) | 65 | XToWlDrag::XToWlDrag(X11Source *source) | ||
66 | : m_source(source) | 66 | : m_source(source) | ||
67 | { | 67 | { | ||
68 | connect(DataBridge::self()->dnd(), &Dnd::transferFinished, this, [this](xcb_timestamp_t eventTime) { | 68 | connect(DataBridge::self()->dnd(), &Dnd::transferFinished, this, [this](xcb_timestamp_t eventTime) { | ||
69 | // we use this mechanism, because the finished call is not | 69 | // we use this mechanism, because the finished call is not | ||
70 | // reliable done by Wayland clients | 70 | // reliable done by Wayland clients | ||
71 | auto it = std::find_if(m_dataRequests.begin(), m_dataRequests.end(), [eventTime](const QPair<xcb_timestamp_t, bool> &req) { | 71 | auto it = std::find_if(m_dataRequests.begin(), m_dataRequests.end(), [eventTime](const QPair<xcb_timestamp_t, bool> &req) { | ||
72 | return req.first == eventTime; | 72 | return req.first == eventTime && req.second == false; | ||
73 | }); | 73 | }); | ||
74 | if (it == m_dataRequests.end()) { | 74 | if (it == m_dataRequests.end()) { | ||
75 | // transfer finished for a different drag | 75 | // transfer finished for a different drag | ||
76 | return; | 76 | return; | ||
77 | } | 77 | } | ||
78 | Q_ASSERT(!(*it).second); | | |||
79 | (*it).second = true; | 78 | (*it).second = true; | ||
80 | checkForFinished(); | 79 | checkForFinished(); | ||
81 | }); | 80 | }); | ||
82 | connect(source, &X11Source::transferReady, this, [this](xcb_atom_t target, qint32 fd) { | 81 | connect(source, &X11Source::transferReady, this, [this](xcb_atom_t target, qint32 fd) { | ||
83 | Q_UNUSED(target); | 82 | Q_UNUSED(target); | ||
84 | Q_UNUSED(fd); | 83 | Q_UNUSED(fd); | ||
85 | m_dataRequests << QPair<xcb_timestamp_t, bool>(m_source->timestamp(), false); | 84 | m_dataRequests << QPair<xcb_timestamp_t, bool>(m_source->timestamp(), false); | ||
86 | }); | 85 | }); | ||
▲ Show 20 Lines • Show All 464 Lines • Show Last 20 Lines |