From 1c3059c74b8cbffea3e815e0a91a7eab9ea44e70 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 28 May 2020 10:25:56 +0300 Subject: [PATCH] Fix class names for data control wrappers The data control protocol is unstable. Therefore, class names must have "V1" suffix. --- src/wayland/CMakeLists.txt | 16 ++-- .../server/test_datacontrol_interface.cpp | 10 +- ...cpp => datacontroldevice_v1_interface.cpp} | 48 +++++----- ...ace.h => datacontroldevice_v1_interface.h} | 26 +++--- ...datacontroldevicemanager_v1_interface.cpp} | 30 +++--- ...> datacontroldevicemanager_v1_interface.h} | 18 ++-- ....cpp => datacontroloffer_v1_interface.cpp} | 30 +++--- ...face.h => datacontroloffer_v1_interface.h} | 20 ++-- .../datacontrolsource_v1_interface.cpp | 92 +++++++++++++++++++ ...ace.h => datacontrolsource_v1_interface.h} | 18 ++-- src/wayland/display.cpp | 6 +- src/wayland/display.h | 6 +- src/wayland/seat_interface.cpp | 10 +- src/wayland/seat_interface.h | 2 +- src/wayland/seat_interface_p.h | 6 +- .../server/datacontrolsource_interface.cpp | 92 ------------------- 16 files changed, 215 insertions(+), 215 deletions(-) rename src/wayland/{server/datacontroldevice_interface.cpp => datacontroldevice_v1_interface.cpp} (51%) rename src/wayland/{server/datacontroldevice_interface.h => datacontroldevice_v1_interface.h} (53%) rename src/wayland/{server/datacontroldevicemanager_interface.cpp => datacontroldevicemanager_v1_interface.cpp} (52%) rename src/wayland/{server/datacontroldevicemanager_interface.h => datacontroldevicemanager_v1_interface.h} (50%) rename src/wayland/{server/datacontroloffer_interface.cpp => datacontroloffer_v1_interface.cpp} (51%) rename src/wayland/{server/datacontroloffer_interface.h => datacontroloffer_v1_interface.h} (54%) create mode 100644 src/wayland/datacontrolsource_v1_interface.cpp rename src/wayland/{server/datacontrolsource_interface.h => datacontrolsource_v1_interface.h} (56%) delete mode 100644 src/wayland/server/datacontrolsource_interface.cpp diff --git a/src/wayland/CMakeLists.txt b/src/wayland/CMakeLists.txt index 6940039bcd..b7341613d6 100644 --- a/src/wayland/CMakeLists.txt +++ b/src/wayland/CMakeLists.txt @@ -7,10 +7,10 @@ set(SERVER_LIB_SRCS clientconnection.cpp compositor_interface.cpp contrast_interface.cpp - datacontroldevice_interface.cpp - datacontroldevicemanager_interface.cpp - datacontroloffer_interface.cpp - datacontrolsource_interface.cpp + datacontroldevice_v1_interface.cpp + datacontroldevicemanager_v1_interface.cpp + datacontroloffer_v1_interface.cpp + datacontrolsource_v1_interface.cpp datadevice_interface.cpp datadevicemanager_interface.cpp dataoffer_interface.cpp @@ -346,10 +346,10 @@ set(SERVER_LIB_HEADERS clientconnection.h compositor_interface.h contrast_interface.h - datacontroldevice_interface.h - datacontroldevicemanager_interface.h - datacontroloffer_interface.h - datacontrolsource_interface.h + datacontroldevice_v1_interface.h + datacontroldevicemanager_v1_interface.h + datacontroloffer_v1_interface.h + datacontrolsource_v1_interface.h datadevice_interface.h datadevicemanager_interface.h dataoffer_interface.h diff --git a/src/wayland/autotests/server/test_datacontrol_interface.cpp b/src/wayland/autotests/server/test_datacontrol_interface.cpp index 7d58180cfb..53a31b9cbc 100644 --- a/src/wayland/autotests/server/test_datacontrol_interface.cpp +++ b/src/wayland/autotests/server/test_datacontrol_interface.cpp @@ -27,9 +27,9 @@ License along with this library. If not, see . #include "../../src/server/compositor_interface.h" #include "../../src/server/display.h" #include "../../src/server/seat_interface.h" -#include "../../src/server/datacontroldevice_interface.h" -#include "../../src/server/datacontroldevicemanager_interface.h" -#include "../../src/server/datacontrolsource_interface.h" +#include "../../src/server/datacontroldevice_v1_interface.h" +#include "../../src/server/datacontroldevicemanager_v1_interface.h" +#include "../../src/server/datacontrolsource_v1_interface.h" #include #include @@ -135,7 +135,7 @@ private: SeatInterface *m_seat; CompositorInterface *m_serverCompositor; - DataControlDeviceManagerInterface *m_dataControlDeviceManagerInterface; + DataControlDeviceManagerV1Interface *m_dataControlDeviceManagerInterface; DataControlDeviceManager *m_dataControlDeviceManager; @@ -172,7 +172,7 @@ void DataControlInterfaceTest::initTestCase() m_seat->create(); m_serverCompositor = m_display.createCompositor(this); m_serverCompositor->create(); - m_dataControlDeviceManagerInterface = m_display.createDataControlDeviceManager(this); + m_dataControlDeviceManagerInterface = m_display.createDataControlDeviceManagerV1(this); QVERIFY(m_serverCompositor->isValid()); // setup connection diff --git a/src/wayland/server/datacontroldevice_interface.cpp b/src/wayland/datacontroldevice_v1_interface.cpp similarity index 51% rename from src/wayland/server/datacontroldevice_interface.cpp rename to src/wayland/datacontroldevice_v1_interface.cpp index 28bdf5f060..46104978ab 100644 --- a/src/wayland/server/datacontroldevice_interface.cpp +++ b/src/wayland/datacontroldevice_v1_interface.cpp @@ -3,10 +3,10 @@ SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ -#include "datacontroldevice_interface.h" -#include "datacontroldevicemanager_interface.h" -#include "datacontroloffer_interface.h" -#include "datacontrolsource_interface.h" +#include "datacontroldevice_v1_interface.h" +#include "datacontroldevicemanager_v1_interface.h" +#include "datacontroloffer_v1_interface.h" +#include "datacontrolsource_v1_interface.h" #include "display.h" #include "seat_interface.h" #include "surface_interface.h" @@ -18,16 +18,16 @@ namespace KWaylandServer { -class DataControlDeviceInterfacePrivate: public QtWaylandServer::zwlr_data_control_device_v1 +class DataControlDeviceV1InterfacePrivate: public QtWaylandServer::zwlr_data_control_device_v1 { public: - DataControlDeviceInterfacePrivate(DataControlDeviceInterface *q, SeatInterface *seat, wl_resource *resource); + DataControlDeviceV1InterfacePrivate(DataControlDeviceV1Interface *q, SeatInterface *seat, wl_resource *resource); - DataControlOfferInterface *createDataOffer(AbstractDataSource *source); + DataControlOfferV1Interface *createDataOffer(AbstractDataSource *source); - DataControlDeviceInterface *q; + DataControlDeviceV1Interface *q; QPointer seat; - QPointer selection; + QPointer selection; protected: void zwlr_data_control_device_v1_destroy_resource(Resource *resource) override; @@ -36,19 +36,19 @@ protected: }; -DataControlDeviceInterfacePrivate::DataControlDeviceInterfacePrivate(DataControlDeviceInterface *_q, SeatInterface *seat, wl_resource *resource) +DataControlDeviceV1InterfacePrivate::DataControlDeviceV1InterfacePrivate(DataControlDeviceV1Interface *_q, SeatInterface *seat, wl_resource *resource) : QtWaylandServer::zwlr_data_control_device_v1(resource) , q(_q) , seat(seat) { } -void DataControlDeviceInterfacePrivate::zwlr_data_control_device_v1_set_selection(Resource *resource, wl_resource *source) +void DataControlDeviceV1InterfacePrivate::zwlr_data_control_device_v1_set_selection(Resource *resource, wl_resource *source) { - DataControlSourceInterface *dataSource = nullptr; + DataControlSourceV1Interface *dataSource = nullptr; if (source) { - dataSource = DataControlSourceInterface::get(source); + dataSource = DataControlSourceV1Interface::get(source); Q_ASSERT(dataSource); if (dataSource == seat->selection()) { wl_resource_post_error(resource->handle, error::error_used_source, @@ -63,12 +63,12 @@ void DataControlDeviceInterfacePrivate::zwlr_data_control_device_v1_set_selectio emit q->selectionChanged(selection); } -void DataControlDeviceInterfacePrivate::zwlr_data_control_device_v1_destroy(QtWaylandServer::zwlr_data_control_device_v1::Resource *resource) +void DataControlDeviceV1InterfacePrivate::zwlr_data_control_device_v1_destroy(QtWaylandServer::zwlr_data_control_device_v1::Resource *resource) { wl_resource_destroy(resource->handle); } -DataControlOfferInterface *DataControlDeviceInterfacePrivate::createDataOffer(AbstractDataSource *source) +DataControlOfferV1Interface *DataControlDeviceV1InterfacePrivate::createDataOffer(AbstractDataSource *source) { if (!source) { // a data offer can only exist together with a source @@ -80,38 +80,38 @@ DataControlOfferInterface *DataControlDeviceInterfacePrivate::createDataOffer(Ab return nullptr; } - DataControlOfferInterface *offer = new DataControlOfferInterface(source, data_offer_resource); + DataControlOfferV1Interface *offer = new DataControlOfferV1Interface(source, data_offer_resource); send_data_offer(offer->resource()); offer->sendAllOffers(); return offer; } -void DataControlDeviceInterfacePrivate::zwlr_data_control_device_v1_destroy_resource(QtWaylandServer::zwlr_data_control_device_v1::Resource *resource) +void DataControlDeviceV1InterfacePrivate::zwlr_data_control_device_v1_destroy_resource(QtWaylandServer::zwlr_data_control_device_v1::Resource *resource) { Q_UNUSED(resource) delete q; } -DataControlDeviceInterface::DataControlDeviceInterface(SeatInterface *seat, wl_resource *resource) +DataControlDeviceV1Interface::DataControlDeviceV1Interface(SeatInterface *seat, wl_resource *resource) : QObject() - , d(new DataControlDeviceInterfacePrivate(this, seat, resource)) + , d(new DataControlDeviceV1InterfacePrivate(this, seat, resource)) { seat->d_func()->registerDataControlDevice(this); } -DataControlDeviceInterface::~DataControlDeviceInterface() = default; +DataControlDeviceV1Interface::~DataControlDeviceV1Interface() = default; -SeatInterface *DataControlDeviceInterface::seat() const +SeatInterface *DataControlDeviceV1Interface::seat() const { return d->seat; } -DataControlSourceInterface *DataControlDeviceInterface::selection() const +DataControlSourceV1Interface *DataControlDeviceV1Interface::selection() const { return d->selection; } -void DataControlDeviceInterface::sendSelection(AbstractDataSource *other) +void DataControlDeviceV1Interface::sendSelection(AbstractDataSource *other) { if (!other) { sendClearSelection(); @@ -124,7 +124,7 @@ void DataControlDeviceInterface::sendSelection(AbstractDataSource *other) d->send_selection(r->resource()); } -void DataControlDeviceInterface::sendClearSelection() +void DataControlDeviceV1Interface::sendClearSelection() { d->send_selection(nullptr); } diff --git a/src/wayland/server/datacontroldevice_interface.h b/src/wayland/datacontroldevice_v1_interface.h similarity index 53% rename from src/wayland/server/datacontroldevice_interface.h rename to src/wayland/datacontroldevice_v1_interface.h index e2a6041805..1346da8285 100644 --- a/src/wayland/server/datacontroldevice_interface.h +++ b/src/wayland/datacontroldevice_v1_interface.h @@ -16,9 +16,9 @@ namespace KWaylandServer { class AbstractDataSource; -class DataControlDeviceManagerInterface; -class DataControlOfferInterface; -class DataControlSourceInterface; +class DataControlDeviceManagerV1Interface; +class DataControlOfferV1Interface; +class DataControlSourceV1Interface; class SeatInterface; class SurfaceInterface; @@ -26,38 +26,38 @@ class SurfaceInterface; * @brief Represents the Resource for the wl_data_device interface. * * @see SeatInterface - * @see DataControlSourceInterface + * @see DataControlSourceV1Interface * Lifespan is mapped to the underlying object **/ -class DataControlDeviceInterfacePrivate; +class DataControlDeviceV1InterfacePrivate; -class KWAYLANDSERVER_EXPORT DataControlDeviceInterface : public QObject +class KWAYLANDSERVER_EXPORT DataControlDeviceV1Interface : public QObject { Q_OBJECT public: - ~DataControlDeviceInterface() override; + ~DataControlDeviceV1Interface() override; SeatInterface *seat() const; - DataControlSourceInterface *selection() const; + DataControlSourceV1Interface *selection() const; void sendSelection(AbstractDataSource *other); void sendClearSelection(); Q_SIGNALS: - void selectionChanged(KWaylandServer::DataControlSourceInterface*); + void selectionChanged(KWaylandServer::DataControlSourceV1Interface*); void selectionCleared(); private: - friend class DataControlDeviceManagerInterfacePrivate; - explicit DataControlDeviceInterface(SeatInterface *seat, wl_resource *resource); + friend class DataControlDeviceManagerV1InterfacePrivate; + explicit DataControlDeviceV1Interface(SeatInterface *seat, wl_resource *resource); - QScopedPointer d; + QScopedPointer d; }; } -Q_DECLARE_METATYPE(KWaylandServer::DataControlDeviceInterface*) +Q_DECLARE_METATYPE(KWaylandServer::DataControlDeviceV1Interface*) #endif diff --git a/src/wayland/server/datacontroldevicemanager_interface.cpp b/src/wayland/datacontroldevicemanager_v1_interface.cpp similarity index 52% rename from src/wayland/server/datacontroldevicemanager_interface.cpp rename to src/wayland/datacontroldevicemanager_v1_interface.cpp index 04bf80bb3c..1759c247a5 100644 --- a/src/wayland/server/datacontroldevicemanager_interface.cpp +++ b/src/wayland/datacontroldevicemanager_v1_interface.cpp @@ -4,9 +4,9 @@ SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ -#include "datacontroldevicemanager_interface.h" -#include "datacontroldevice_interface.h" -#include "datacontrolsource_interface.h" +#include "datacontroldevicemanager_v1_interface.h" +#include "datacontroldevice_v1_interface.h" +#include "datacontrolsource_v1_interface.h" #include "global_p.h" #include "display.h" #include "seat_interface_p.h" @@ -17,12 +17,12 @@ static const int s_version = 1; namespace KWaylandServer { -class DataControlDeviceManagerInterfacePrivate : public QtWaylandServer::zwlr_data_control_manager_v1 +class DataControlDeviceManagerV1InterfacePrivate : public QtWaylandServer::zwlr_data_control_manager_v1 { public: - DataControlDeviceManagerInterfacePrivate(DataControlDeviceManagerInterface *q, Display *d); + DataControlDeviceManagerV1InterfacePrivate(DataControlDeviceManagerV1Interface *q, Display *d); - DataControlDeviceManagerInterface *q; + DataControlDeviceManagerV1Interface *q; protected: void zwlr_data_control_manager_v1_create_data_source(Resource *resource, uint32_t id) override; @@ -30,24 +30,24 @@ protected: void zwlr_data_control_manager_v1_destroy(Resource *resource) override; }; -DataControlDeviceManagerInterfacePrivate::DataControlDeviceManagerInterfacePrivate(DataControlDeviceManagerInterface *q, Display *d) +DataControlDeviceManagerV1InterfacePrivate::DataControlDeviceManagerV1InterfacePrivate(DataControlDeviceManagerV1Interface *q, Display *d) : QtWaylandServer::zwlr_data_control_manager_v1(*d, s_version) , q(q) { } -void DataControlDeviceManagerInterfacePrivate::zwlr_data_control_manager_v1_create_data_source(Resource *resource, uint32_t id) +void DataControlDeviceManagerV1InterfacePrivate::zwlr_data_control_manager_v1_create_data_source(Resource *resource, uint32_t id) { wl_resource *data_source_resource = wl_resource_create(resource->client(), &zwlr_data_control_source_v1_interface, resource->version(), id); if (!data_source_resource) { wl_resource_post_no_memory(resource->handle); return; } - DataControlSourceInterface *dataSource = new DataControlSourceInterface(q, data_source_resource); + DataControlSourceV1Interface *dataSource = new DataControlSourceV1Interface(q, data_source_resource); emit q->dataSourceCreated(dataSource); } -void DataControlDeviceManagerInterfacePrivate::zwlr_data_control_manager_v1_get_data_device(Resource *resource, uint32_t id, wl_resource *seat) +void DataControlDeviceManagerV1InterfacePrivate::zwlr_data_control_manager_v1_get_data_device(Resource *resource, uint32_t id, wl_resource *seat) { SeatInterface *s = SeatInterface::get(seat); Q_ASSERT(s); @@ -60,22 +60,22 @@ void DataControlDeviceManagerInterfacePrivate::zwlr_data_control_manager_v1_get_ wl_resource_post_no_memory(resource->handle); return; } - DataControlDeviceInterface *dataDevice = new DataControlDeviceInterface(s, data_device_resource); + DataControlDeviceV1Interface *dataDevice = new DataControlDeviceV1Interface(s, data_device_resource); emit q->dataDeviceCreated(dataDevice); } -void DataControlDeviceManagerInterfacePrivate::zwlr_data_control_manager_v1_destroy(QtWaylandServer::zwlr_data_control_manager_v1::Resource *resource) +void DataControlDeviceManagerV1InterfacePrivate::zwlr_data_control_manager_v1_destroy(QtWaylandServer::zwlr_data_control_manager_v1::Resource *resource) { wl_resource_destroy(resource->handle); } -DataControlDeviceManagerInterface::DataControlDeviceManagerInterface(Display *display, QObject *parent) +DataControlDeviceManagerV1Interface::DataControlDeviceManagerV1Interface(Display *display, QObject *parent) : QObject(parent) - , d(new DataControlDeviceManagerInterfacePrivate(this, display)) + , d(new DataControlDeviceManagerV1InterfacePrivate(this, display)) { } -DataControlDeviceManagerInterface::~DataControlDeviceManagerInterface() = default; +DataControlDeviceManagerV1Interface::~DataControlDeviceManagerV1Interface() = default; } diff --git a/src/wayland/server/datacontroldevicemanager_interface.h b/src/wayland/datacontroldevicemanager_v1_interface.h similarity index 50% rename from src/wayland/server/datacontroldevicemanager_interface.h rename to src/wayland/datacontroldevicemanager_v1_interface.h index 9210f1f8e8..e1acf343bc 100644 --- a/src/wayland/server/datacontroldevicemanager_interface.h +++ b/src/wayland/datacontroldevicemanager_v1_interface.h @@ -14,29 +14,29 @@ namespace KWaylandServer { class Display; -class DataControlSourceInterface; -class DataControlDeviceManagerInterfacePrivate; -class DataControlDeviceInterface; +class DataControlSourceV1Interface; +class DataControlDeviceManagerV1InterfacePrivate; +class DataControlDeviceV1Interface; /** * @brief Represents the Global for zwlr_data_control_manager_v1 interface. * **/ -class KWAYLANDSERVER_EXPORT DataControlDeviceManagerInterface : public QObject +class KWAYLANDSERVER_EXPORT DataControlDeviceManagerV1Interface : public QObject { Q_OBJECT public: - ~DataControlDeviceManagerInterface() override; + ~DataControlDeviceManagerV1Interface() override; Q_SIGNALS: - void dataSourceCreated(KWaylandServer::DataControlSourceInterface *dataSource); - void dataDeviceCreated(KWaylandServer::DataControlDeviceInterface *dataDevice); + void dataSourceCreated(KWaylandServer::DataControlSourceV1Interface *dataSource); + void dataDeviceCreated(KWaylandServer::DataControlDeviceV1Interface *dataDevice); private: - explicit DataControlDeviceManagerInterface(Display *display, QObject *parent = nullptr); + explicit DataControlDeviceManagerV1Interface(Display *display, QObject *parent = nullptr); friend class Display; - QScopedPointer d; + QScopedPointer d; }; } diff --git a/src/wayland/server/datacontroloffer_interface.cpp b/src/wayland/datacontroloffer_v1_interface.cpp similarity index 51% rename from src/wayland/server/datacontroloffer_interface.cpp rename to src/wayland/datacontroloffer_v1_interface.cpp index 7c660c4d55..dce03c40d0 100644 --- a/src/wayland/server/datacontroloffer_interface.cpp +++ b/src/wayland/datacontroloffer_v1_interface.cpp @@ -3,9 +3,9 @@ SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ -#include "datacontroloffer_interface.h" -#include "datacontroldevice_interface.h" -#include "datacontrolsource_interface.h" +#include "datacontroloffer_v1_interface.h" +#include "datacontroldevice_v1_interface.h" +#include "datacontrolsource_v1_interface.h" // Qt #include #include @@ -17,12 +17,12 @@ namespace KWaylandServer { -class DataControlOfferInterfacePrivate : public QtWaylandServer::zwlr_data_control_offer_v1 +class DataControlOfferV1InterfacePrivate : public QtWaylandServer::zwlr_data_control_offer_v1 { public: - DataControlOfferInterfacePrivate(DataControlOfferInterface *q, AbstractDataSource *source, wl_resource *resource); + DataControlOfferV1InterfacePrivate(DataControlOfferV1Interface *q, AbstractDataSource *source, wl_resource *resource); - DataControlOfferInterface *q; + DataControlOfferV1Interface *q; QPointer source; protected: @@ -31,25 +31,25 @@ protected: void zwlr_data_control_offer_v1_destroy_resource(Resource *resource) override; }; -DataControlOfferInterfacePrivate::DataControlOfferInterfacePrivate(DataControlOfferInterface *_q, AbstractDataSource *source, wl_resource *resource) +DataControlOfferV1InterfacePrivate::DataControlOfferV1InterfacePrivate(DataControlOfferV1Interface *_q, AbstractDataSource *source, wl_resource *resource) : QtWaylandServer::zwlr_data_control_offer_v1(resource) , q(_q) , source(source) { } -void DataControlOfferInterfacePrivate::zwlr_data_control_offer_v1_destroy(QtWaylandServer::zwlr_data_control_offer_v1::Resource *resource) +void DataControlOfferV1InterfacePrivate::zwlr_data_control_offer_v1_destroy(QtWaylandServer::zwlr_data_control_offer_v1::Resource *resource) { wl_resource_destroy(resource->handle); } -void DataControlOfferInterfacePrivate::zwlr_data_control_offer_v1_destroy_resource(QtWaylandServer::zwlr_data_control_offer_v1::Resource *resource) +void DataControlOfferV1InterfacePrivate::zwlr_data_control_offer_v1_destroy_resource(QtWaylandServer::zwlr_data_control_offer_v1::Resource *resource) { Q_UNUSED(resource) delete q; } -void DataControlOfferInterfacePrivate::zwlr_data_control_offer_v1_receive(Resource *resource, const QString &mimeType, qint32 fd) +void DataControlOfferV1InterfacePrivate::zwlr_data_control_offer_v1_receive(Resource *resource, const QString &mimeType, qint32 fd) { Q_UNUSED(resource) if (!source) { @@ -59,9 +59,9 @@ void DataControlOfferInterfacePrivate::zwlr_data_control_offer_v1_receive(Resour source->requestData(mimeType, fd); } -DataControlOfferInterface::DataControlOfferInterface(AbstractDataSource *source, wl_resource *resource) +DataControlOfferV1Interface::DataControlOfferV1Interface(AbstractDataSource *source, wl_resource *resource) : QObject() - , d(new DataControlOfferInterfacePrivate(this, source, resource)) + , d(new DataControlOfferV1InterfacePrivate(this, source, resource)) { Q_ASSERT(source); connect(source, &AbstractDataSource::mimeTypeOffered, this, @@ -71,9 +71,9 @@ DataControlOfferInterface::DataControlOfferInterface(AbstractDataSource *source, ); } -DataControlOfferInterface::~DataControlOfferInterface() = default; +DataControlOfferV1Interface::~DataControlOfferV1Interface() = default; -void DataControlOfferInterface::sendAllOffers() +void DataControlOfferV1Interface::sendAllOffers() { Q_ASSERT(d->source); for (const QString &mimeType : d->source->mimeTypes()) { @@ -81,7 +81,7 @@ void DataControlOfferInterface::sendAllOffers() } } -wl_resource *DataControlOfferInterface::resource() const +wl_resource *DataControlOfferV1Interface::resource() const { return d->resource()->handle; } diff --git a/src/wayland/server/datacontroloffer_interface.h b/src/wayland/datacontroloffer_v1_interface.h similarity index 54% rename from src/wayland/server/datacontroloffer_interface.h rename to src/wayland/datacontroloffer_v1_interface.h index 96633380f2..80a4f2bf24 100644 --- a/src/wayland/server/datacontroloffer_interface.h +++ b/src/wayland/datacontroloffer_v1_interface.h @@ -10,7 +10,7 @@ #include -#include "datacontroldevicemanager_interface.h" +#include "datacontroldevicemanager_v1_interface.h" struct wl_resource; @@ -18,33 +18,33 @@ namespace KWaylandServer { class AbstractDataSource; -class DataControlDeviceInterface; -class DataControlSourceInterface; -class DataControlOfferInterfacePrivate; +class DataControlDeviceV1Interface; +class DataControlSourceV1Interface; +class DataControlOfferV1InterfacePrivate; /** * @brief Represents the Resource for the wl_data_offer interface. * Lifespan is mapped to the underlying object **/ -class KWAYLANDSERVER_EXPORT DataControlOfferInterface : public QObject +class KWAYLANDSERVER_EXPORT DataControlOfferV1Interface : public QObject { Q_OBJECT public: - ~DataControlOfferInterface() override; + ~DataControlOfferV1Interface() override; void sendAllOffers(); wl_resource *resource() const; private: - friend class DataControlDeviceInterfacePrivate; - explicit DataControlOfferInterface(AbstractDataSource *source, wl_resource *resource); + friend class DataControlDeviceV1InterfacePrivate; + explicit DataControlOfferV1Interface(AbstractDataSource *source, wl_resource *resource); - QScopedPointer d; + QScopedPointer d; }; } -Q_DECLARE_METATYPE(KWaylandServer::DataControlOfferInterface*) +Q_DECLARE_METATYPE(KWaylandServer::DataControlOfferV1Interface*) #endif diff --git a/src/wayland/datacontrolsource_v1_interface.cpp b/src/wayland/datacontrolsource_v1_interface.cpp new file mode 100644 index 0000000000..cf9ed49946 --- /dev/null +++ b/src/wayland/datacontrolsource_v1_interface.cpp @@ -0,0 +1,92 @@ +/* + SPDX-FileCopyrightText: 2020 David Edmundson + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ +#include "datacontrolsource_v1_interface.h" +#include "datacontroldevicemanager_v1_interface.h" +#include "clientconnection.h" +#include "resource_p.h" +// Qt +#include +// Wayland +#include +// system +#include + +namespace KWaylandServer +{ + +class DataControlSourceV1InterfacePrivate : public QtWaylandServer::zwlr_data_control_source_v1 +{ +public: + DataControlSourceV1InterfacePrivate(DataControlSourceV1Interface *q, ::wl_resource *resource); + + QStringList mimeTypes; + DataControlSourceV1Interface *q; + +protected: + void zwlr_data_control_source_v1_destroy_resource(Resource *resource) override; + void zwlr_data_control_source_v1_offer(Resource *resource, const QString &mime_type) override; + void zwlr_data_control_source_v1_destroy(Resource *resource) override; +}; + +DataControlSourceV1InterfacePrivate::DataControlSourceV1InterfacePrivate(DataControlSourceV1Interface *_q, ::wl_resource *resource) + : QtWaylandServer::zwlr_data_control_source_v1(resource) + , q(_q) +{ +} + +void DataControlSourceV1InterfacePrivate::zwlr_data_control_source_v1_destroy_resource(QtWaylandServer::zwlr_data_control_source_v1::Resource *resource) +{ + Q_UNUSED(resource) + delete q; +} + +void DataControlSourceV1InterfacePrivate::zwlr_data_control_source_v1_offer(Resource *, const QString &mimeType) +{ + mimeTypes << mimeType; + emit q->mimeTypeOffered(mimeType); +} + +void DataControlSourceV1InterfacePrivate::zwlr_data_control_source_v1_destroy(QtWaylandServer::zwlr_data_control_source_v1::Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +DataControlSourceV1Interface::DataControlSourceV1Interface(DataControlDeviceManagerV1Interface *parent, ::wl_resource *resource) + : AbstractDataSource(nullptr, parent) + , d(new DataControlSourceV1InterfacePrivate(this, resource)) +{ +} + +DataControlSourceV1Interface::~DataControlSourceV1Interface() = default; + +void DataControlSourceV1Interface::requestData(const QString &mimeType, qint32 fd) +{ + d->send_send(mimeType, fd); + close(fd); +} + +void DataControlSourceV1Interface::cancel() +{ + d->send_cancelled(); +} + +QStringList DataControlSourceV1Interface::mimeTypes() const +{ + return d->mimeTypes; +} + +wl_client *DataControlSourceV1Interface::client() +{ + return d->resource()->client(); +} + +DataControlSourceV1Interface *DataControlSourceV1Interface::get(wl_resource *native) +{ + auto priv = static_cast(QtWaylandServer::zwlr_data_control_source_v1::Resource::fromResource(native)->object()); + return priv->q; +} + +} diff --git a/src/wayland/server/datacontrolsource_interface.h b/src/wayland/datacontrolsource_v1_interface.h similarity index 56% rename from src/wayland/server/datacontrolsource_interface.h rename to src/wayland/datacontrolsource_v1_interface.h index 8d67fcf00f..1a81499ea7 100644 --- a/src/wayland/server/datacontrolsource_interface.h +++ b/src/wayland/datacontrolsource_v1_interface.h @@ -10,23 +10,23 @@ #include -#include "datacontroldevicemanager_interface.h" +#include "datacontroldevicemanager_v1_interface.h" namespace KWaylandServer { -class DataControlSourceInterfacePrivate; +class DataControlSourceV1InterfacePrivate; /** * @brief Represents the Resource for the zwlr_data_control_source_v1 interface. * Lifespan is mapped to the underlying object **/ -class KWAYLANDSERVER_EXPORT DataControlSourceInterface : public AbstractDataSource +class KWAYLANDSERVER_EXPORT DataControlSourceV1Interface : public AbstractDataSource { Q_OBJECT public: - ~DataControlSourceInterface() override; + ~DataControlSourceV1Interface() override; void requestData(const QString &mimeType, qint32 fd) override; void cancel() override; @@ -34,17 +34,17 @@ public: QStringList mimeTypes() const override; wl_client *client() override; - static DataControlSourceInterface *get(wl_resource *native); + static DataControlSourceV1Interface *get(wl_resource *native); private: - friend class DataControlDeviceManagerInterfacePrivate; - explicit DataControlSourceInterface(DataControlDeviceManagerInterface *parent, ::wl_resource *resource); + friend class DataControlDeviceManagerV1InterfacePrivate; + explicit DataControlSourceV1Interface(DataControlDeviceManagerV1Interface *parent, ::wl_resource *resource); - QScopedPointer d; + QScopedPointer d; }; } -Q_DECLARE_METATYPE(KWaylandServer::DataControlSourceInterface*) +Q_DECLARE_METATYPE(KWaylandServer::DataControlSourceV1Interface*) #endif diff --git a/src/wayland/display.cpp b/src/wayland/display.cpp index 8f61acc417..ee356c1f55 100644 --- a/src/wayland/display.cpp +++ b/src/wayland/display.cpp @@ -46,7 +46,7 @@ #include "xdgdecoration_interface.h" #include "eglstream_controller_interface.h" #include "keystate_interface.h" -#include "datacontroldevicemanager_interface.h" +#include "datacontroldevicemanager_v1_interface.h" #include #include @@ -517,9 +517,9 @@ TabletManagerInterface *Display::createTabletManagerInterface(QObject *parent) return d; } -DataControlDeviceManagerInterface *Display::createDataControlDeviceManager(QObject *parent) +DataControlDeviceManagerV1Interface *Display::createDataControlDeviceManagerV1(QObject *parent) { - auto m = new DataControlDeviceManagerInterface(this, parent); + auto m = new DataControlDeviceManagerV1Interface(this, parent); connect(this, &Display::aboutToTerminate, m, [m] { delete m; }); return m; } diff --git a/src/wayland/display.h b/src/wayland/display.h index ccb5499e82..7b59d9d49f 100644 --- a/src/wayland/display.h +++ b/src/wayland/display.h @@ -77,7 +77,7 @@ class EglStreamControllerInterface; class KeyStateInterface; class LinuxDmabufUnstableV1Interface; class TabletManagerInterface; -class DataControlDeviceManagerInterface; +class DataControlDeviceManagerV1Interface; /** * @brief Class holding the Wayland server display loop. @@ -309,10 +309,10 @@ public: EglStreamControllerInterface *createEglStreamControllerInterface(QObject *parent = nullptr); /** - * Creates the DataControlDeviceManager + * Creates the DataControlDeviceManagerV1 * */ - DataControlDeviceManagerInterface *createDataControlDeviceManager(QObject *parent = nullptr); + DataControlDeviceManagerV1Interface *createDataControlDeviceManagerV1(QObject *parent = nullptr); /** * Creates the entry point to support wacom-like tablets and pens. diff --git a/src/wayland/seat_interface.cpp b/src/wayland/seat_interface.cpp index 06570c8a14..1424148497 100644 --- a/src/wayland/seat_interface.cpp +++ b/src/wayland/seat_interface.cpp @@ -10,8 +10,8 @@ #include "display.h" #include "datadevice_interface.h" #include "datasource_interface.h" -#include "datacontroldevice_interface.h" -#include "datacontrolsource_interface.h" +#include "datacontroldevice_v1_interface.h" +#include "datacontrolsource_v1_interface.h" #include "keyboard_interface.h" #include "keyboard_interface_p.h" #include "pointer_interface.h" @@ -333,7 +333,7 @@ void SeatInterface::Private::registerDataDevice(DataDeviceInterface *dataDevice) } } -void SeatInterface::Private::registerDataControlDevice(DataControlDeviceInterface *dataDevice) +void SeatInterface::Private::registerDataControlDevice(DataControlDeviceV1Interface *dataDevice) { Q_ASSERT(dataDevice->seat() == q); dataControlDevices << dataDevice; @@ -342,13 +342,13 @@ void SeatInterface::Private::registerDataControlDevice(DataControlDeviceInterfac }; QObject::connect(dataDevice, &QObject::destroyed, q, dataDeviceCleanup); - QObject::connect(dataDevice, &DataControlDeviceInterface::selectionChanged, q, + QObject::connect(dataDevice, &DataControlDeviceV1Interface::selectionChanged, q, [this, dataDevice] { q->setSelection(dataDevice->selection()); } ); - QObject::connect(dataDevice, &DataControlDeviceInterface::selectionCleared, q, + QObject::connect(dataDevice, &DataControlDeviceV1Interface::selectionCleared, q, [this, dataDevice] { Q_UNUSED(dataDevice); q->setSelection(nullptr); diff --git a/src/wayland/seat_interface.h b/src/wayland/seat_interface.h index 98b0fc91ac..1fe2f38d52 100644 --- a/src/wayland/seat_interface.h +++ b/src/wayland/seat_interface.h @@ -768,7 +768,7 @@ Q_SIGNALS: private: friend class Display; - friend class DataControlDeviceInterface; + friend class DataControlDeviceV1Interface; friend class DataDeviceManagerInterface; friend class TextInputManagerUnstableV0Interface; friend class TextInputManagerUnstableV2Interface; diff --git a/src/wayland/seat_interface_p.h b/src/wayland/seat_interface_p.h index c6d39fb8cb..b632f4af76 100644 --- a/src/wayland/seat_interface_p.h +++ b/src/wayland/seat_interface_p.h @@ -22,7 +22,7 @@ namespace KWaylandServer class AbstractDataSource; class DataDeviceInterface; class DataSourceInterface; -class DataControlDeviceInterface; +class DataControlDeviceV1Interface; class TextInputInterface; class SeatInterface::Private : public Global::Private @@ -38,7 +38,7 @@ public: QVector dataDevicesForSurface(SurfaceInterface *surface) const; TextInputInterface *textInputForSurface(SurfaceInterface *surface) const; void registerDataDevice(DataDeviceInterface *dataDevice); - void registerDataControlDevice(DataControlDeviceInterface *dataDevice); + void registerDataControlDevice(DataControlDeviceV1Interface *dataDevice); void registerTextInput(TextInputInterface *textInput); void endDrag(quint32 serial); @@ -52,7 +52,7 @@ public: QVector keyboards; QVector touchs; QVector dataDevices; - QVector dataControlDevices; + QVector dataControlDevices; QVector textInputs; diff --git a/src/wayland/server/datacontrolsource_interface.cpp b/src/wayland/server/datacontrolsource_interface.cpp deleted file mode 100644 index 4561c8d790..0000000000 --- a/src/wayland/server/datacontrolsource_interface.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - SPDX-FileCopyrightText: 2020 David Edmundson - - SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL -*/ -#include "datacontrolsource_interface.h" -#include "datacontroldevicemanager_interface.h" -#include "clientconnection.h" -#include "resource_p.h" -// Qt -#include -// Wayland -#include -// system -#include - -namespace KWaylandServer -{ - -class DataControlSourceInterfacePrivate : public QtWaylandServer::zwlr_data_control_source_v1 -{ -public: - DataControlSourceInterfacePrivate(DataControlSourceInterface *q, ::wl_resource *resource); - - QStringList mimeTypes; - DataControlSourceInterface *q; - -protected: - void zwlr_data_control_source_v1_destroy_resource(Resource *resource) override; - void zwlr_data_control_source_v1_offer(Resource *resource, const QString &mime_type) override; - void zwlr_data_control_source_v1_destroy(Resource *resource) override; -}; - -DataControlSourceInterfacePrivate::DataControlSourceInterfacePrivate(DataControlSourceInterface *_q, ::wl_resource *resource) - : QtWaylandServer::zwlr_data_control_source_v1(resource) - , q(_q) -{ -} - -void DataControlSourceInterfacePrivate::zwlr_data_control_source_v1_destroy_resource(QtWaylandServer::zwlr_data_control_source_v1::Resource *resource) -{ - Q_UNUSED(resource) - delete q; -} - -void DataControlSourceInterfacePrivate::zwlr_data_control_source_v1_offer(Resource *, const QString &mimeType) -{ - mimeTypes << mimeType; - emit q->mimeTypeOffered(mimeType); -} - -void DataControlSourceInterfacePrivate::zwlr_data_control_source_v1_destroy(QtWaylandServer::zwlr_data_control_source_v1::Resource *resource) -{ - wl_resource_destroy(resource->handle); -} - -DataControlSourceInterface::DataControlSourceInterface(DataControlDeviceManagerInterface *parent, ::wl_resource *resource) - : AbstractDataSource(nullptr, parent) - , d(new DataControlSourceInterfacePrivate(this, resource)) -{ -} - -DataControlSourceInterface::~DataControlSourceInterface() = default; - -void DataControlSourceInterface::requestData(const QString &mimeType, qint32 fd) -{ - d->send_send(mimeType, fd); - close(fd); -} - -void DataControlSourceInterface::cancel() -{ - d->send_cancelled(); -} - -QStringList DataControlSourceInterface::mimeTypes() const -{ - return d->mimeTypes; -} - -wl_client *DataControlSourceInterface::client() -{ - return d->resource()->client(); -} - -DataControlSourceInterface *DataControlSourceInterface::get(wl_resource *native) -{ - auto priv = static_cast(QtWaylandServer::zwlr_data_control_source_v1::Resource::fromResource(native)->object()); - return priv->q; -} - -}