diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp index a42933ed8..4a24e861c 100644 --- a/src/protocols/core/DataDevice.cpp +++ b/src/protocols/core/DataDevice.cpp @@ -298,10 +298,17 @@ void CWLDataDeviceResource::sendDataOffer(SP offer) { void CWLDataDeviceResource::sendEnter(uint32_t serial, SP surf, const Vector2D& local, SP offer) { if (const auto WL = offer->getWayland(); WL) m_resource->sendEnterRaw(serial, surf->getResource()->resource(), wl_fixed_from_double(local.x), wl_fixed_from_double(local.y), WL->m_resource->resource()); + + m_entered = surf; + // FIXME: X11 } void CWLDataDeviceResource::sendLeave() { + if (!m_entered) + return; + + m_entered.reset(); m_resource->sendLeave(); } diff --git a/src/protocols/core/DataDevice.hpp b/src/protocols/core/DataDevice.hpp index 8b52933e3..b4ad378fa 100644 --- a/src/protocols/core/DataDevice.hpp +++ b/src/protocols/core/DataDevice.hpp @@ -111,8 +111,10 @@ class CWLDataDeviceResource : public IDataDevice { WP m_self; private: - SP m_resource; - wl_client* m_client = nullptr; + SP m_resource; + wl_client* m_client = nullptr; + + WP m_entered; friend class CWLDataDeviceProtocol; };