2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2014-11-06 09:02:49 +00:00
|
|
|
|
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
|
|
|
|
*/
|
2014-11-06 09:02:49 +00:00
|
|
|
#ifndef WAYLAND_SERVER_DATA_DEVICE_INTERFACE_H
|
|
|
|
#define WAYLAND_SERVER_DATA_DEVICE_INTERFACE_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
#include <KWaylandServer/kwaylandserver_export.h>
|
2014-11-06 09:02:49 +00:00
|
|
|
|
2014-11-14 08:45:02 +00:00
|
|
|
#include "resource.h"
|
2014-11-06 09:02:49 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2014-11-06 09:02:49 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
class DataDeviceManagerInterface;
|
2016-03-01 06:49:04 +00:00
|
|
|
class DataOfferInterface;
|
2014-11-06 09:02:49 +00:00
|
|
|
class DataSourceInterface;
|
2020-05-12 11:26:48 +00:00
|
|
|
class AbstractDataSource;
|
2014-11-06 09:02:49 +00:00
|
|
|
class SeatInterface;
|
|
|
|
class SurfaceInterface;
|
|
|
|
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
2019-09-15 18:59:45 +00:00
|
|
|
* @brief DataDeviceInterface allows clients to share data by copy-and-paste and drag-and-drop.
|
|
|
|
*
|
|
|
|
* The data device is per seat.
|
|
|
|
* Copy-and-paste use the selection functions.
|
|
|
|
*
|
|
|
|
* Represents the Resource for the wl_data_device interface.
|
2015-09-10 11:36:42 +00:00
|
|
|
*
|
|
|
|
* @see SeatInterface
|
|
|
|
* @see DataSourceInterface
|
|
|
|
**/
|
2014-11-14 08:45:02 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT DataDeviceInterface : public Resource
|
2014-11-06 09:02:49 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
virtual ~DataDeviceInterface();
|
|
|
|
|
|
|
|
SeatInterface *seat() const;
|
|
|
|
DataSourceInterface *dragSource() const;
|
|
|
|
SurfaceInterface *origin() const;
|
|
|
|
SurfaceInterface *icon() const;
|
|
|
|
|
2016-03-01 06:49:04 +00:00
|
|
|
/**
|
|
|
|
* @returns the serial of the implicit grab which started the drag
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
quint32 dragImplicitGrabSerial() const;
|
|
|
|
|
2014-11-06 09:02:49 +00:00
|
|
|
DataSourceInterface *selection() const;
|
|
|
|
|
2020-05-12 11:26:48 +00:00
|
|
|
void sendSelection(KWaylandServer::AbstractDataSource *other);
|
2014-11-27 12:38:24 +00:00
|
|
|
void sendClearSelection();
|
2016-03-01 06:49:04 +00:00
|
|
|
/**
|
|
|
|
* The event is sent when a drag-and-drop operation is ended because the implicit grab is removed.
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
void drop();
|
|
|
|
/**
|
|
|
|
* Updates the SurfaceInterface to which drag motion events are sent.
|
|
|
|
*
|
|
|
|
* If a SurfaceInterface was registered in this DataDeviceInterface for drag motion events, it
|
|
|
|
* will be sent a leave event.
|
|
|
|
*
|
|
|
|
* If @p surface is not null it will be sent a drag enter event.
|
|
|
|
*
|
|
|
|
* @param surface The SurfaceInterface which gets motion events
|
|
|
|
* @param serial The serial to be used for enter/leave
|
|
|
|
* @since 5.6
|
|
|
|
**/
|
|
|
|
void updateDragTarget(SurfaceInterface *surface, quint32 serial);
|
2019-02-06 08:26:43 +00:00
|
|
|
/**
|
|
|
|
* Mark this DataDeviceInterface as being a proxy device for @p remote.
|
|
|
|
* @since 5.56
|
|
|
|
**/
|
|
|
|
void updateProxy(SurfaceInterface *remote);
|
2014-11-06 15:56:50 +00:00
|
|
|
|
2014-11-06 09:02:49 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void dragStarted();
|
2020-04-29 14:56:38 +00:00
|
|
|
void selectionChanged(KWaylandServer::DataSourceInterface*);
|
2014-11-06 09:02:49 +00:00
|
|
|
void selectionCleared();
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class DataDeviceManagerInterface;
|
2014-11-20 15:40:14 +00:00
|
|
|
explicit DataDeviceInterface(SeatInterface *seat, DataDeviceManagerInterface *parent, wl_resource *parentResource);
|
2014-11-06 09:02:49 +00:00
|
|
|
|
|
|
|
class Private;
|
2014-11-14 08:45:02 +00:00
|
|
|
Private *d_func() const;
|
2014-11-06 09:02:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
Q_DECLARE_METATYPE(KWaylandServer::DataDeviceInterface*)
|
2014-11-06 09:02:49 +00:00
|
|
|
|
|
|
|
#endif
|