diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-11-13 15:40:14 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2019-05-10 12:35:00 +0000 |
commit | 5ec182df699041699f514d164a161c299fde5d19 (patch) | |
tree | 5f646078ba391c4327414f532991f8e1f687de59 /src/client/qwaylanddataoffer_p.h | |
parent | 811e38787536c65122d780ad3d7b16757bb7d0bb (diff) | |
download | qtwayland-5ec182df699041699f514d164a161c299fde5d19.tar.gz |
Client: Implement primary-selection-unstable-v1
[ChangeLog][QPA plugin] Added support for middle mouse pasting through the
primary-selection-unstable-v1 protocol.
Fixes: QTBUG-66008
Change-Id: I7c8fb9aa2c856f5b6794aeab1ee75d80cad05dcd
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client/qwaylanddataoffer_p.h')
-rw-r--r-- | src/client/qwaylanddataoffer_p.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/client/qwaylanddataoffer_p.h b/src/client/qwaylanddataoffer_p.h index 5412400a..9cf1483c 100644 --- a/src/client/qwaylanddataoffer_p.h +++ b/src/client/qwaylanddataoffer_p.h @@ -65,27 +65,40 @@ namespace QtWaylandClient { class QWaylandDisplay; class QWaylandMimeData; -class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer : public QtWayland::wl_data_offer +class QWaylandAbstractDataOffer +{ +public: + virtual void startReceiving(const QString &mimeType, int fd) = 0; + virtual QMimeData *mimeData() = 0; + + virtual ~QWaylandAbstractDataOffer() = default; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandDataOffer + : public QtWayland::wl_data_offer // needs to be the first because we do static casts from the user pointer to the wrapper + , public QWaylandAbstractDataOffer { public: explicit QWaylandDataOffer(QWaylandDisplay *display, struct ::wl_data_offer *offer); ~QWaylandDataOffer() override; + QMimeData *mimeData() override; QString firstFormat() const; - QMimeData *mimeData(); + void startReceiving(const QString &mimeType, int fd) override; protected: void data_offer_offer(const QString &mime_type) override; private: + QWaylandDisplay *m_display = nullptr; QScopedPointer<QWaylandMimeData> m_mimeData; }; class QWaylandMimeData : public QInternalMimeData { public: - explicit QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display); + explicit QWaylandMimeData(QWaylandAbstractDataOffer *dataOffer); ~QWaylandMimeData() override; void appendFormat(const QString &mimeType); @@ -98,13 +111,12 @@ protected: private: int readData(int fd, QByteArray &data) const; - mutable QWaylandDataOffer *m_dataOffer = nullptr; - QWaylandDisplay *m_display = nullptr; + QWaylandAbstractDataOffer *m_dataOffer = nullptr; mutable QStringList m_types; mutable QHash<QString, QByteArray> m_data; }; -} +} // namespace QtWaylandClient QT_END_NAMESPACE #endif |