diff options
author | Vaxry <[email protected]> | 2024-06-16 20:36:55 +0200 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-06-16 20:36:55 +0200 |
commit | 172ee1cadaabd3ba4df330f9cdd02fb520b59e71 (patch) | |
tree | d721ef41ccce3e6c0776cefd39e6d74b0fdc2cf2 | |
parent | 738530e62ee48f7326cd5a610b90b47344b701f1 (diff) | |
download | Hyprland-172ee1cadaabd3ba4df330f9cdd02fb520b59e71.tar.gz Hyprland-172ee1cadaabd3ba4df330f9cdd02fb520b59e71.zip |
data-device: minor fixups
ref #6543
firefox needs a re-enter after a dnd
don't destroy dnd on an offer destroy, it's not valid
-rw-r--r-- | src/protocols/core/DataDevice.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp index e54d3633..986d1176 100644 --- a/src/protocols/core/DataDevice.cpp +++ b/src/protocols/core/DataDevice.cpp @@ -12,20 +12,8 @@ CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataS if (!good()) return; - resource->setDestroy([this](CWlDataOffer* r) { - if (!dead && (recvd || accepted)) - PROTO::data->completeDrag(); - else - PROTO::data->abortDrag(); - PROTO::data->destroyResource(this); - }); - resource->setOnDestroy([this](CWlDataOffer* r) { - if (!dead && (recvd || accepted)) - PROTO::data->completeDrag(); - else - PROTO::data->abortDrag(); - PROTO::data->destroyResource(this); - }); + resource->setDestroy([this](CWlDataOffer* r) { PROTO::data->destroyResource(this); }); + resource->setOnDestroy([this](CWlDataOffer* r) { PROTO::data->destroyResource(this); }); resource->setAccept([this](CWlDataOffer* r, uint32_t serial, const char* mime) { if (!source) { @@ -210,7 +198,7 @@ CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : reso pClient = resource->client(); - resource->setSetSelection([this](CWlDataDevice* r, wl_resource* sourceR, uint32_t serial) { + resource->setSetSelection([](CWlDataDevice* r, wl_resource* sourceR, uint32_t serial) { auto source = sourceR ? CWLDataSourceResource::fromResource(sourceR) : CSharedPointer<CWLDataSourceResource>{}; if (!source) { LOGM(LOG, "Reset selection received"); @@ -226,7 +214,7 @@ CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : reso g_pSeatManager->setCurrentSelection(source); }); - resource->setStartDrag([this](CWlDataDevice* r, wl_resource* sourceR, wl_resource* origin, wl_resource* icon, uint32_t serial) { + resource->setStartDrag([](CWlDataDevice* r, wl_resource* sourceR, wl_resource* origin, wl_resource* icon, uint32_t serial) { auto source = CWLDataSourceResource::fromResource(sourceR); if (!source) { LOGM(ERR, "No source in drag"); @@ -615,6 +603,7 @@ void CWLDataDeviceProtocol::dropDrag() { dnd.overriddenCursor = false; g_pInputManager->simulateMouseMovement(); + g_pSeatManager->resendEnterEvents(); } bool CWLDataDeviceProtocol::wasDragSuccessful() { @@ -645,6 +634,7 @@ void CWLDataDeviceProtocol::completeDrag() { dnd.currentSource.reset(); g_pInputManager->simulateMouseMovement(); + g_pSeatManager->resendEnterEvents(); } void CWLDataDeviceProtocol::abortDrag() { @@ -664,6 +654,7 @@ void CWLDataDeviceProtocol::abortDrag() { dnd.currentSource.reset(); g_pInputManager->simulateMouseMovement(); + g_pSeatManager->resendEnterEvents(); } void CWLDataDeviceProtocol::renderDND(CMonitor* pMonitor, timespec* when) { |