File indexing completed on 2024-05-12 05:32:20

0001 /*
0002     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0003     SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include <qwayland-server-wayland.h>
0011 
0012 #include "datadevicemanager.h"
0013 
0014 namespace KWin
0015 {
0016 class DataSourceInterface;
0017 class XdgToplevelDragV1Interface;
0018 
0019 class DataSourceInterfacePrivate : public QtWaylandServer::wl_data_source
0020 {
0021 public:
0022     DataSourceInterfacePrivate(DataSourceInterface *_q, ::wl_resource *resource);
0023 
0024     static DataSourceInterfacePrivate *get(DataSourceInterface *dataSource);
0025 
0026     DataSourceInterface *q;
0027     QStringList mimeTypes;
0028     DataDeviceManagerInterface::DnDActions supportedDnDActions = DataDeviceManagerInterface::DnDAction::None;
0029     DataDeviceManagerInterface::DnDAction selectedDndAction = DataDeviceManagerInterface::DnDAction::None;
0030     bool isAccepted = false;
0031     bool dropPerformed = false;
0032     bool isCanceled = false;
0033     XdgToplevelDragV1Interface *xdgToplevelDrag = nullptr;
0034 
0035 protected:
0036     void data_source_destroy_resource(Resource *resource) override;
0037     void data_source_offer(Resource *resource, const QString &mime_type) override;
0038     void data_source_destroy(Resource *resource) override;
0039     void data_source_set_actions(Resource *resource, uint32_t dnd_actions) override;
0040 
0041 private:
0042     void offer(const QString &mimeType);
0043 };
0044 }