Fix class names for data control wrappers
The data control protocol is unstable. Therefore, class names must have "V1" suffix.
This commit is contained in:
parent
c3094c686e
commit
1c3059c74b
16 changed files with 215 additions and 215 deletions
|
@ -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
|
||||
|
|
|
@ -27,9 +27,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
#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 <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
|
@ -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
|
||||
|
|
|
@ -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<SeatInterface> seat;
|
||||
QPointer<DataControlSourceInterface> selection;
|
||||
QPointer<DataControlSourceV1Interface> 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);
|
||||
}
|
|
@ -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<DataControlDeviceInterfacePrivate> d;
|
||||
QScopedPointer<DataControlDeviceV1InterfacePrivate> d;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(KWaylandServer::DataControlDeviceInterface*)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::DataControlDeviceV1Interface*)
|
||||
|
||||
#endif
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -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<DataControlDeviceManagerInterfacePrivate> d;
|
||||
QScopedPointer<DataControlDeviceManagerV1InterfacePrivate> d;
|
||||
};
|
||||
|
||||
}
|
|
@ -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 <QStringList>
|
||||
#include <QPointer>
|
||||
|
@ -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<AbstractDataSource> 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;
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include <KWaylandServer/kwaylandserver_export.h>
|
||||
|
||||
#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<DataControlOfferInterfacePrivate> d;
|
||||
QScopedPointer<DataControlOfferV1InterfacePrivate> d;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(KWaylandServer::DataControlOfferInterface*)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::DataControlOfferV1Interface*)
|
||||
|
||||
#endif
|
92
src/wayland/datacontrolsource_v1_interface.cpp
Normal file
92
src/wayland/datacontrolsource_v1_interface.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
#include "datacontrolsource_v1_interface.h"
|
||||
#include "datacontroldevicemanager_v1_interface.h"
|
||||
#include "clientconnection.h"
|
||||
#include "resource_p.h"
|
||||
// Qt
|
||||
#include <QStringList>
|
||||
// Wayland
|
||||
#include <qwayland-server-wlr-data-control-unstable-v1.h>
|
||||
// system
|
||||
#include <unistd.h>
|
||||
|
||||
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<DataControlSourceV1InterfacePrivate*>(QtWaylandServer::zwlr_data_control_source_v1::Resource::fromResource(native)->object());
|
||||
return priv->q;
|
||||
}
|
||||
|
||||
}
|
|
@ -10,23 +10,23 @@
|
|||
|
||||
#include <KWaylandServer/kwaylandserver_export.h>
|
||||
|
||||
#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<DataControlSourceInterfacePrivate> d;
|
||||
QScopedPointer<DataControlSourceV1InterfacePrivate> d;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(KWaylandServer::DataControlSourceInterface*)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::DataControlSourceV1Interface*)
|
||||
|
||||
#endif
|
|
@ -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 <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<DataDeviceInterface *> 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<KeyboardInterface*> keyboards;
|
||||
QVector<TouchInterface*> touchs;
|
||||
QVector<DataDeviceInterface*> dataDevices;
|
||||
QVector<DataControlDeviceInterface*> dataControlDevices;
|
||||
QVector<DataControlDeviceV1Interface*> dataControlDevices;
|
||||
|
||||
QVector<TextInputInterface*> textInputs;
|
||||
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
#include "datacontrolsource_interface.h"
|
||||
#include "datacontroldevicemanager_interface.h"
|
||||
#include "clientconnection.h"
|
||||
#include "resource_p.h"
|
||||
// Qt
|
||||
#include <QStringList>
|
||||
// Wayland
|
||||
#include <qwayland-server-wlr-data-control-unstable-v1.h>
|
||||
// system
|
||||
#include <unistd.h>
|
||||
|
||||
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<DataControlSourceInterfacePrivate*>(QtWaylandServer::zwlr_data_control_source_v1::Resource::fromResource(native)->object());
|
||||
return priv->q;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue