2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2020-06-25 15:27:52 +00:00
|
|
|
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
|
2020-03-15 15:19:28 +00:00
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2021-03-10 16:08:30 +00:00
|
|
|
#pragma once
|
2014-11-06 15:56:50 +00:00
|
|
|
|
2022-04-22 09:27:33 +00:00
|
|
|
#include "kwin_export.h"
|
2014-11-06 15:56:50 +00:00
|
|
|
|
2022-04-22 09:27:33 +00:00
|
|
|
#include <QObject>
|
2014-11-06 15:56:50 +00:00
|
|
|
|
2017-11-26 15:31:57 +00:00
|
|
|
#include "datadevicemanager_interface.h"
|
2014-11-06 15:56:50 +00:00
|
|
|
|
2022-05-17 19:57:13 +00:00
|
|
|
#include <optional>
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2014-11-06 15:56:50 +00:00
|
|
|
{
|
|
|
|
class DataDeviceInterface;
|
2020-05-12 11:26:48 +00:00
|
|
|
class AbstractDataSource;
|
2020-06-25 15:27:52 +00:00
|
|
|
class DataOfferInterfacePrivate;
|
2014-11-06 15:56:50 +00:00
|
|
|
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
|
|
|
* @brief Represents the Resource for the wl_data_offer interface.
|
|
|
|
*
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2022-04-22 09:27:33 +00:00
|
|
|
class KWIN_EXPORT DataOfferInterface : public QObject
|
2014-11-06 15:56:50 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
virtual ~DataOfferInterface();
|
|
|
|
|
|
|
|
void sendAllOffers();
|
2020-06-25 15:27:52 +00:00
|
|
|
void sendSourceActions();
|
|
|
|
wl_resource *resource() const;
|
2014-11-06 15:56:50 +00:00
|
|
|
|
2017-11-26 15:31:57 +00:00
|
|
|
/**
|
|
|
|
* @returns The Drag and Drop actions supported by this DataOfferInterface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2022-05-17 19:57:13 +00:00
|
|
|
std::optional<DataDeviceManagerInterface::DnDActions> supportedDragAndDropActions() const;
|
2017-11-26 15:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns The preferred Drag and Drop action of this DataOfferInterface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2022-05-17 19:57:13 +00:00
|
|
|
std::optional<DataDeviceManagerInterface::DnDAction> preferredDragAndDropAction() const;
|
2017-11-26 15:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This event indicates the @p action selected by the compositor after matching the
|
|
|
|
* source/destination side actions. Only one action (or none) will be offered here.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2017-11-26 15:31:57 +00:00
|
|
|
void dndAction(DataDeviceManagerInterface::DnDAction action);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* Emitted whenever the supported or preferred Drag and Drop actions changed.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2017-11-26 15:31:57 +00:00
|
|
|
void dragAndDropActionsChanged();
|
|
|
|
|
2014-11-06 15:56:50 +00:00
|
|
|
private:
|
2020-06-25 15:27:52 +00:00
|
|
|
friend class DataDeviceInterfacePrivate;
|
|
|
|
explicit DataOfferInterface(AbstractDataSource *source, wl_resource *resource);
|
2014-11-06 15:56:50 +00:00
|
|
|
|
2020-06-25 15:27:52 +00:00
|
|
|
QScopedPointer<DataOfferInterfacePrivate> d;
|
2014-11-06 15:56:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-08-29 05:11:06 +00:00
|
|
|
Q_DECLARE_METATYPE(KWaylandServer::DataOfferInterface *)
|