aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-08-28 13:45:06 +0200
committerVaxry <[email protected]>2024-08-28 13:45:13 +0200
commit00ee1cf98e3d8ef7cf71a9a505ba8d1382697e35 (patch)
treedcee00193cee8d3be10494c0cace4003f845846e /src
parent7dd0f76e5aa1e3726f9d9fd1871bc667237ef6a8 (diff)
downloadHyprland-00ee1cf98e3d8ef7cf71a9a505ba8d1382697e35.tar.gz
Hyprland-00ee1cf98e3d8ef7cf71a9a505ba8d1382697e35.zip
data-device: send dndFinished when dnd offer is destroyed while unfinished
fixes #7496 see https://invent.kde.org/plasma/kwin/-/commit/711c5bb43f2823766d5189dc8d567c8f4cec253c see https://bugs.kde.org/show_bug.cgi\?id\=482142
Diffstat (limited to 'src')
-rw-r--r--src/protocols/core/DataDevice.cpp8
-rw-r--r--src/protocols/core/DataDevice.hpp4
-rw-r--r--src/protocols/types/DataDevice.cpp4
-rw-r--r--src/protocols/types/DataDevice.hpp1
4 files changed, 16 insertions, 1 deletions
diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp
index b7640af3..8c1a48d8 100644
--- a/src/protocols/core/DataDevice.cpp
+++ b/src/protocols/core/DataDevice.cpp
@@ -67,6 +67,13 @@ CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataS
});
}
+CWLDataOfferResource::~CWLDataOfferResource() {
+ if (!source || !source->hasDnd() || dead)
+ return;
+
+ source->sendDndFinished();
+}
+
bool CWLDataOfferResource::good() {
return resource->resource();
}
@@ -173,6 +180,7 @@ void CWLDataSourceResource::sendDndDropPerformed() {
if (resource->version() < 3)
return;
resource->sendDndDropPerformed();
+ dropped = true;
}
void CWLDataSourceResource::sendDndFinished() {
diff --git a/src/protocols/core/DataDevice.hpp b/src/protocols/core/DataDevice.hpp
index 22bb9376..8aaf46be 100644
--- a/src/protocols/core/DataDevice.hpp
+++ b/src/protocols/core/DataDevice.hpp
@@ -29,6 +29,7 @@ class CMonitor;
class CWLDataOfferResource {
public:
CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataSource> source_);
+ ~CWLDataOfferResource();
bool good();
void sendData();
@@ -63,14 +64,15 @@ class CWLDataSourceResource : public IDataSource {
virtual bool hasDnd();
virtual bool dndDone();
virtual void error(uint32_t code, const std::string& msg);
+ virtual void sendDndFinished();
void sendDndDropPerformed();
- void sendDndFinished();
void sendDndAction(wl_data_device_manager_dnd_action a);
bool used = false;
bool dnd = false;
bool dndSuccess = false;
+ bool dropped = false;
WP<CWLDataDeviceResource> device;
WP<CWLDataSourceResource> self;
diff --git a/src/protocols/types/DataDevice.cpp b/src/protocols/types/DataDevice.cpp
index eb6969cc..e95f1c76 100644
--- a/src/protocols/types/DataDevice.cpp
+++ b/src/protocols/types/DataDevice.cpp
@@ -19,3 +19,7 @@ void IDataSource::markUsed() {
eDataSourceType IDataSource::type() {
return DATA_SOURCE_TYPE_WAYLAND;
}
+
+void IDataSource::sendDndFinished() {
+ ;
+}
diff --git a/src/protocols/types/DataDevice.hpp b/src/protocols/types/DataDevice.hpp
index 948f47a0..f6757e1c 100644
--- a/src/protocols/types/DataDevice.hpp
+++ b/src/protocols/types/DataDevice.hpp
@@ -21,6 +21,7 @@ class IDataSource {
virtual void cancelled() = 0;
virtual bool hasDnd();
virtual bool dndDone();
+ virtual void sendDndFinished();
virtual bool used();
virtual void markUsed();
virtual void error(uint32_t code, const std::string& msg) = 0;