diff --git a/src/wayland/autotests/client/test_datadevice.cpp b/src/wayland/autotests/client/test_datadevice.cpp index bcdf1d94e4..eca1cdb9d6 100644 --- a/src/wayland/autotests/client/test_datadevice.cpp +++ b/src/wayland/autotests/client/test_datadevice.cpp @@ -73,6 +73,7 @@ static const QString s_socketName = QStringLiteral("kwayland-test-wayland-datade void TestDataDevice::init() { + qRegisterMetaType(); using namespace KWayland::Server; delete m_display; m_display = new Display(this); diff --git a/src/wayland/autotests/client/test_datasource.cpp b/src/wayland/autotests/client/test_datasource.cpp index ab4c9c6072..bd8b0811d5 100644 --- a/src/wayland/autotests/client/test_datasource.cpp +++ b/src/wayland/autotests/client/test_datasource.cpp @@ -132,6 +132,7 @@ void TestDataSource::testOffer() using namespace KWayland::Client; using namespace KWayland::Server; + qRegisterMetaType(); QSignalSpy dataSourceCreatedSpy(m_dataDeviceManagerInterface, SIGNAL(dataSourceCreated(KWayland::Server::DataSourceInterface*))); QVERIFY(dataSourceCreatedSpy.isValid()); diff --git a/src/wayland/datadevice_interface.cpp b/src/wayland/datadevice_interface.cpp index e7af140590..8ba19ba878 100644 --- a/src/wayland/datadevice_interface.cpp +++ b/src/wayland/datadevice_interface.cpp @@ -123,7 +123,7 @@ void DataDeviceInterface::Private::setSelectionCallback(wl_client *client, wl_re void DataDeviceInterface::Private::setSelection(DataSourceInterface *dataSource) { - if (dataSource->supportedDragAndDropActions()) { + if (dataSource && dataSource->supportedDragAndDropActions() && wl_resource_get_version(dataSource->resource()) >= WL_DATA_SOURCE_ACTION_SINCE_VERSION) { wl_resource_post_error(dataSource->resource(), WL_DATA_SOURCE_ERROR_INVALID_SOURCE, "Data source is for drag and drop"); return; } diff --git a/src/wayland/datasource_interface.cpp b/src/wayland/datasource_interface.cpp index 96f277ffb0..8ebb240909 100644 --- a/src/wayland/datasource_interface.cpp +++ b/src/wayland/datasource_interface.cpp @@ -40,8 +40,7 @@ public: ~Private(); QStringList mimeTypes; - // sensible default for < version 3 - DataDeviceManagerInterface::DnDActions supportedDnDActions = DataDeviceManagerInterface::DnDAction::Copy; + DataDeviceManagerInterface::DnDActions supportedDnDActions = DataDeviceManagerInterface::DnDAction::None; private: DataSourceInterface *q_func() { @@ -111,6 +110,10 @@ void DataSourceInterface::Private::setActionsCallback(wl_client *client, wl_reso DataSourceInterface::DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource) : Resource(new Private(this, parent, parentResource)) { + if (wl_resource_get_version(parentResource) < WL_DATA_SOURCE_ACTION_SINCE_VERSION) { + Q_D(); + d->supportedDnDActions = DataDeviceManagerInterface::DnDAction::Copy; + } } DataSourceInterface::~DataSourceInterface() = default;