mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 06:10:02 +01:00
protocols/datadevice: avoid double leave
ref https://github.com/hyprwm/Hyprland/discussions/12494
This commit is contained in:
parent
1ff801f5f3
commit
9aa313402b
2 changed files with 11 additions and 2 deletions
|
|
@ -298,10 +298,17 @@ void CWLDataDeviceResource::sendDataOffer(SP<IDataOffer> offer) {
|
||||||
void CWLDataDeviceResource::sendEnter(uint32_t serial, SP<CWLSurfaceResource> surf, const Vector2D& local, SP<IDataOffer> offer) {
|
void CWLDataDeviceResource::sendEnter(uint32_t serial, SP<CWLSurfaceResource> surf, const Vector2D& local, SP<IDataOffer> offer) {
|
||||||
if (const auto WL = offer->getWayland(); WL)
|
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_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
|
// FIXME: X11
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLDataDeviceResource::sendLeave() {
|
void CWLDataDeviceResource::sendLeave() {
|
||||||
|
if (!m_entered)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_entered.reset();
|
||||||
m_resource->sendLeave();
|
m_resource->sendLeave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,8 @@ class CWLDataDeviceResource : public IDataDevice {
|
||||||
SP<CWlDataDevice> m_resource;
|
SP<CWlDataDevice> m_resource;
|
||||||
wl_client* m_client = nullptr;
|
wl_client* m_client = nullptr;
|
||||||
|
|
||||||
|
WP<CWLSurfaceResource> m_entered;
|
||||||
|
|
||||||
friend class CWLDataDeviceProtocol;
|
friend class CWLDataDeviceProtocol;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue