kwin/src/wayland/datasource_interface.h
David Edmundson b219b9175c Only guard DND cancel events with the version check
In a recent refactor a guard seemingly in the wrong place on
SeatInterface was moved into AbstractDataSource, as typically that's
where we guard.

However it turns out the original code was correct, we want to send
cancel for all clipboard cancels, but for D&D it's version dependent.

This class introduces a new method to astract that from seat.
2021-09-10 14:06:49 +00:00

62 lines
1.7 KiB
C++

/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#pragma once
#include "abstract_data_source.h"
#include <KWaylandServer/kwaylandserver_export.h>
#include "datadevicemanager_interface.h"
namespace KWaylandServer
{
class DataSourceInterfacePrivate;
/**
* @brief Represents the Resource for the wl_data_source interface.
*/
class KWAYLANDSERVER_EXPORT DataSourceInterface : public AbstractDataSource
{
Q_OBJECT
public:
virtual ~DataSourceInterface();
void accept(const QString &mimeType) override;
void requestData(const QString &mimeType, qint32 fd) override;
void cancel() override;
QStringList mimeTypes() const override;
static DataSourceInterface *get(wl_resource *native);
/**
* @returns The Drag and Drop actions supported by this DataSourceInterface.
*/
DataDeviceManagerInterface::DnDActions supportedDragAndDropActions() const override;
void dropPerformed() override;
void dndFinished() override;
void dndAction(DataDeviceManagerInterface::DnDAction action) override;
void dndCancelled() override;
wl_resource *resource() const;
wl_client *client() const override;
bool isAccepted() const override;
void setAccepted(bool accepted);
private:
friend class DataDeviceManagerInterfacePrivate;
explicit DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource);
QScopedPointer<DataSourceInterfacePrivate> d;
};
}
Q_DECLARE_METATYPE(KWaylandServer::DataSourceInterface *)